Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'modules-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux

Pull module updates from Luis Chamberlain:
"There are a few fixes / cleanups from Vincent, Chunhui, and Petr, but
the most important part of this pull request is the Rust community
stepping up to help maintain both C / Rust code for future Rust module
support. We grow the set of modules maintainers by three now, and with
this hope to scale to help address what's needed to properly support
future Rust module support.

A lot of exciting stuff coming in future kernel releases.

This has been on linux-next for ~ 3 weeks now with no issues"

* tag 'modules-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux:
module: Refine kmemleak scanned areas
module: abort module loading when sysfs setup suffer errors
MAINTAINERS: scale modules with more reviewers
module: Clean up the description of MODULE_SIG_<type>
module: Split modules_install compression and in-kernel decompression

+90 -73
+3
MAINTAINERS
··· 15678 15678 15679 15679 MODULE SUPPORT 15680 15680 M: Luis Chamberlain <mcgrof@kernel.org> 15681 + R: Petr Pavlu <petr.pavlu@suse.com> 15682 + R: Sami Tolvanen <samitolvanen@google.com> 15683 + R: Daniel Gomez <da.gomez@samsung.com> 15681 15684 L: linux-modules@vger.kernel.org 15682 15685 L: linux-kernel@vger.kernel.org 15683 15686 S: Maintained
+39 -38
kernel/module/Kconfig
··· 229 229 depends on MODULE_SIG_FORCE && !MODULE_SIG_ALL 230 230 231 231 choice 232 - prompt "Which hash algorithm should modules be signed with?" 232 + prompt "Hash algorithm to sign modules" 233 233 depends on MODULE_SIG || IMA_APPRAISE_MODSIG 234 234 help 235 235 This determines which sort of hashing algorithm will be used during ··· 239 239 the signature on that module. 240 240 241 241 config MODULE_SIG_SHA1 242 - bool "Sign modules with SHA-1" 242 + bool "SHA-1" 243 243 select CRYPTO_SHA1 244 244 245 245 config MODULE_SIG_SHA256 246 - bool "Sign modules with SHA-256" 246 + bool "SHA-256" 247 247 select CRYPTO_SHA256 248 248 249 249 config MODULE_SIG_SHA384 250 - bool "Sign modules with SHA-384" 250 + bool "SHA-384" 251 251 select CRYPTO_SHA512 252 252 253 253 config MODULE_SIG_SHA512 254 - bool "Sign modules with SHA-512" 254 + bool "SHA-512" 255 255 select CRYPTO_SHA512 256 256 257 257 config MODULE_SIG_SHA3_256 258 - bool "Sign modules with SHA3-256" 258 + bool "SHA3-256" 259 259 select CRYPTO_SHA3 260 260 261 261 config MODULE_SIG_SHA3_384 262 - bool "Sign modules with SHA3-384" 262 + bool "SHA3-384" 263 263 select CRYPTO_SHA3 264 264 265 265 config MODULE_SIG_SHA3_512 266 - bool "Sign modules with SHA3-512" 266 + bool "SHA3-512" 267 267 select CRYPTO_SHA3 268 268 269 269 endchoice ··· 279 279 default "sha3-384" if MODULE_SIG_SHA3_384 280 280 default "sha3-512" if MODULE_SIG_SHA3_512 281 281 282 - choice 283 - prompt "Module compression mode" 282 + config MODULE_COMPRESS 283 + bool "Module compression" 284 284 help 285 - This option allows you to choose the algorithm which will be used to 286 - compress modules when 'make modules_install' is run. (or, you can 287 - choose to not compress modules at all.) 288 - 289 - External modules will also be compressed in the same way during the 290 - installation. 291 - 292 - For modules inside an initrd or initramfs, it's more efficient to 293 - compress the whole initrd or initramfs instead. 294 - 285 + Enable module compression to reduce on-disk size of module binaries. 295 286 This is fully compatible with signed modules. 296 287 297 - Please note that the tool used to load modules needs to support the 298 - corresponding algorithm. module-init-tools MAY support gzip, and kmod 299 - MAY support gzip, xz and zstd. 288 + The tool used to work with modules needs to support the selected 289 + compression type. kmod MAY support gzip, xz and zstd. Other tools 290 + might have a limited selection of the supported types. 300 291 301 - Your build system needs to provide the appropriate compression tool 302 - to compress the modules. 292 + Note that for modules inside an initrd or initramfs, it's more 293 + efficient to compress the whole ramdisk instead. 303 294 304 - If in doubt, select 'None'. 295 + If unsure, say N. 305 296 306 - config MODULE_COMPRESS_NONE 307 - bool "None" 297 + choice 298 + prompt "Module compression type" 299 + depends on MODULE_COMPRESS 308 300 help 309 - Do not compress modules. The installed modules are suffixed 310 - with .ko. 301 + Choose the supported algorithm for module compression. 311 302 312 303 config MODULE_COMPRESS_GZIP 313 304 bool "GZIP" 314 305 help 315 - Compress modules with GZIP. The installed modules are suffixed 316 - with .ko.gz. 306 + Support modules compressed with GZIP. The installed modules are 307 + suffixed with .ko.gz. 317 308 318 309 config MODULE_COMPRESS_XZ 319 310 bool "XZ" 320 311 help 321 - Compress modules with XZ. The installed modules are suffixed 322 - with .ko.xz. 312 + Support modules compressed with XZ. The installed modules are 313 + suffixed with .ko.xz. 323 314 324 315 config MODULE_COMPRESS_ZSTD 325 316 bool "ZSTD" 326 317 help 327 - Compress modules with ZSTD. The installed modules are suffixed 328 - with .ko.zst. 318 + Support modules compressed with ZSTD. The installed modules are 319 + suffixed with .ko.zst. 329 320 330 321 endchoice 331 322 323 + config MODULE_COMPRESS_ALL 324 + bool "Automatically compress all modules" 325 + default y 326 + depends on MODULE_COMPRESS 327 + help 328 + Compress all modules during 'make modules_install'. 329 + 330 + Your build system needs to provide the appropriate compression tool 331 + for the selected compression type. External modules will also be 332 + compressed in the same way during the installation. 333 + 332 334 config MODULE_DECOMPRESS 333 335 bool "Support in-kernel module decompression" 334 - depends on MODULE_COMPRESS_GZIP || MODULE_COMPRESS_XZ || MODULE_COMPRESS_ZSTD 336 + depends on MODULE_COMPRESS 335 337 select ZLIB_INFLATE if MODULE_COMPRESS_GZIP 336 338 select XZ_DEC if MODULE_COMPRESS_XZ 337 339 select ZSTD_DECOMPRESS if MODULE_COMPRESS_ZSTD 338 340 help 339 - 340 341 Support for decompressing kernel modules by the kernel itself 341 342 instead of relying on userspace to perform this task. Useful when 342 343 load pinning security policy is enabled.
+4 -14
kernel/module/debug_kmemleak.c
··· 12 12 void kmemleak_load_module(const struct module *mod, 13 13 const struct load_info *info) 14 14 { 15 - unsigned int i; 16 - 17 - /* only scan the sections containing data */ 18 - kmemleak_scan_area(mod, sizeof(struct module), GFP_KERNEL); 19 - 20 - for (i = 1; i < info->hdr->e_shnum; i++) { 21 - /* Scan all writable sections that's not executable */ 22 - if (!(info->sechdrs[i].sh_flags & SHF_ALLOC) || 23 - !(info->sechdrs[i].sh_flags & SHF_WRITE) || 24 - (info->sechdrs[i].sh_flags & SHF_EXECINSTR)) 25 - continue; 26 - 27 - kmemleak_scan_area((void *)info->sechdrs[i].sh_addr, 28 - info->sechdrs[i].sh_size, GFP_KERNEL); 15 + /* only scan writable, non-executable sections */ 16 + for_each_mod_mem_type(type) { 17 + if (type != MOD_DATA && type != MOD_INIT_DATA) 18 + kmemleak_no_scan(mod->mem[type].base); 29 19 } 30 20 }
+42 -21
kernel/module/sysfs.c
··· 69 69 kfree(sect_attrs); 70 70 } 71 71 72 - static void add_sect_attrs(struct module *mod, const struct load_info *info) 72 + static int add_sect_attrs(struct module *mod, const struct load_info *info) 73 73 { 74 74 unsigned int nloaded = 0, i, size[2]; 75 75 struct module_sect_attrs *sect_attrs; 76 76 struct module_sect_attr *sattr; 77 77 struct bin_attribute **gattr; 78 + int ret; 78 79 79 80 /* Count loaded sections and allocate structures */ 80 81 for (i = 0; i < info->hdr->e_shnum; i++) ··· 86 85 size[1] = (nloaded + 1) * sizeof(sect_attrs->grp.bin_attrs[0]); 87 86 sect_attrs = kzalloc(size[0] + size[1], GFP_KERNEL); 88 87 if (!sect_attrs) 89 - return; 88 + return -ENOMEM; 90 89 91 90 /* Setup section attributes. */ 92 91 sect_attrs->grp.name = "sections"; ··· 104 103 sattr->address = sec->sh_addr; 105 104 sattr->battr.attr.name = 106 105 kstrdup(info->secstrings + sec->sh_name, GFP_KERNEL); 107 - if (!sattr->battr.attr.name) 106 + if (!sattr->battr.attr.name) { 107 + ret = -ENOMEM; 108 108 goto out; 109 + } 109 110 sect_attrs->nsections++; 110 111 sattr->battr.read = module_sect_read; 111 112 sattr->battr.size = MODULE_SECT_READ_SIZE; ··· 116 113 } 117 114 *gattr = NULL; 118 115 119 - if (sysfs_create_group(&mod->mkobj.kobj, &sect_attrs->grp)) 116 + ret = sysfs_create_group(&mod->mkobj.kobj, &sect_attrs->grp); 117 + if (ret) 120 118 goto out; 121 119 122 120 mod->sect_attrs = sect_attrs; 123 - return; 121 + return 0; 124 122 out: 125 123 free_sect_attrs(sect_attrs); 124 + return ret; 126 125 } 127 126 128 127 static void remove_sect_attrs(struct module *mod) ··· 163 158 kfree(notes_attrs); 164 159 } 165 160 166 - static void add_notes_attrs(struct module *mod, const struct load_info *info) 161 + static int add_notes_attrs(struct module *mod, const struct load_info *info) 167 162 { 168 163 unsigned int notes, loaded, i; 169 164 struct module_notes_attrs *notes_attrs; 170 165 struct bin_attribute *nattr; 171 - 172 - /* failed to create section attributes, so can't create notes */ 173 - if (!mod->sect_attrs) 174 - return; 166 + int ret; 175 167 176 168 /* Count notes sections and allocate structures. */ 177 169 notes = 0; ··· 178 176 ++notes; 179 177 180 178 if (notes == 0) 181 - return; 179 + return 0; 182 180 183 181 notes_attrs = kzalloc(struct_size(notes_attrs, attrs, notes), 184 182 GFP_KERNEL); 185 183 if (!notes_attrs) 186 - return; 184 + return -ENOMEM; 187 185 188 186 notes_attrs->notes = notes; 189 187 nattr = &notes_attrs->attrs[0]; ··· 203 201 } 204 202 205 203 notes_attrs->dir = kobject_create_and_add("notes", &mod->mkobj.kobj); 206 - if (!notes_attrs->dir) 204 + if (!notes_attrs->dir) { 205 + ret = -ENOMEM; 207 206 goto out; 207 + } 208 208 209 - for (i = 0; i < notes; ++i) 210 - if (sysfs_create_bin_file(notes_attrs->dir, 211 - &notes_attrs->attrs[i])) 209 + for (i = 0; i < notes; ++i) { 210 + ret = sysfs_create_bin_file(notes_attrs->dir, &notes_attrs->attrs[i]); 211 + if (ret) 212 212 goto out; 213 + } 213 214 214 215 mod->notes_attrs = notes_attrs; 215 - return; 216 + return 0; 216 217 217 218 out: 218 219 free_notes_attrs(notes_attrs, i); 220 + return ret; 219 221 } 220 222 221 223 static void remove_notes_attrs(struct module *mod) ··· 229 223 } 230 224 231 225 #else /* !CONFIG_KALLSYMS */ 232 - static inline void add_sect_attrs(struct module *mod, const struct load_info *info) { } 226 + static inline int add_sect_attrs(struct module *mod, const struct load_info *info) 227 + { 228 + return 0; 229 + } 233 230 static inline void remove_sect_attrs(struct module *mod) { } 234 - static inline void add_notes_attrs(struct module *mod, const struct load_info *info) { } 231 + static inline int add_notes_attrs(struct module *mod, const struct load_info *info) 232 + { 233 + return 0; 234 + } 235 235 static inline void remove_notes_attrs(struct module *mod) { } 236 236 #endif /* CONFIG_KALLSYMS */ 237 237 ··· 397 385 if (err) 398 386 goto out_unreg_modinfo_attrs; 399 387 400 - add_sect_attrs(mod, info); 401 - add_notes_attrs(mod, info); 388 + err = add_sect_attrs(mod, info); 389 + if (err) 390 + goto out_del_usage_links; 391 + 392 + err = add_notes_attrs(mod, info); 393 + if (err) 394 + goto out_unreg_sect_attrs; 402 395 403 396 return 0; 404 397 398 + out_unreg_sect_attrs: 399 + remove_sect_attrs(mod); 400 + out_del_usage_links: 401 + del_usage_links(mod); 405 402 out_unreg_modinfo_attrs: 406 403 module_remove_modinfo_attrs(mod, -1); 407 404 out_unreg_param:
+2
scripts/Makefile.modinst
··· 53 53 $(error module installation path cannot contain '$x'))) 54 54 55 55 suffix-y := 56 + ifdef CONFIG_MODULE_COMPRESS_ALL 56 57 suffix-$(CONFIG_MODULE_COMPRESS_GZIP) := .gz 57 58 suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz 58 59 suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst 60 + endif 59 61 60 62 modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules)) 61 63 install-$(CONFIG_MODULES) += $(modules)