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.16-rc6.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/modules/linux

Pull modules fixes from Daniel Gomez:
"This includes two fixes: one introduced in the current release cycle
and another introduced back in v6.4-rc1. Additionally, as Petr and
Luis mentioned in previous pull requests, add myself (Daniel Gomez) to
the list of modules maintainers.

The first was reported by Intel's kernel test robot, and it addresses
a crash exposed by Sebastian's commit c50d295c37f2 ("rds: Use
nested-BH locking for rds_page_remainder") by allowing relocations for
the per-CPU section even if it lacks the SHF_ALLOC flag.

Petr and Sebastian went down to the archive history (before Git) and
found the commit that broke it at [1] / [2] ("Don't relocate
non-allocated regions in modules.").

The second fix, reported and fixed by Petr (with additional cleanup),
resolves a memory leak by ensuring proper deallocation if module
loading fails.

We couldn't find a reproducer other than forcing it manually or
leveraging eBPF. So, I tested it by enabling error injection in the
codetag functions through the error path that produces the leak and
made it fail until execmem is unable to allocate more memory"

Link: https://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux-fullhistory.git/commit/?id=b3b91325f3c7 [1]
Link: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=1a6100caae [2]

* tag 'modules-6.16-rc6.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/modules/linux:
MAINTAINERS: update Daniel Gomez's role and email address
module: Make sure relocations are applied to the per-CPU section
module: Avoid unnecessary return value initialization in move_module()
module: Fix memory deallocation on error path in move_module()

+12 -7
+1 -1
MAINTAINERS
··· 16824 16824 MODULE SUPPORT 16825 16825 M: Luis Chamberlain <mcgrof@kernel.org> 16826 16826 M: Petr Pavlu <petr.pavlu@suse.com> 16827 + M: Daniel Gomez <da.gomez@kernel.org> 16827 16828 R: Sami Tolvanen <samitolvanen@google.com> 16828 - R: Daniel Gomez <da.gomez@samsung.com> 16829 16829 L: linux-modules@vger.kernel.org 16830 16830 L: linux-kernel@vger.kernel.org 16831 16831 S: Maintained
+11 -6
kernel/module/main.c
··· 1573 1573 if (infosec >= info->hdr->e_shnum) 1574 1574 continue; 1575 1575 1576 - /* Don't bother with non-allocated sections */ 1577 - if (!(info->sechdrs[infosec].sh_flags & SHF_ALLOC)) 1576 + /* 1577 + * Don't bother with non-allocated sections. 1578 + * An exception is the percpu section, which has separate allocations 1579 + * for individual CPUs. We relocate the percpu section in the initial 1580 + * ELF template and subsequently copy it to the per-CPU destinations. 1581 + */ 1582 + if (!(info->sechdrs[infosec].sh_flags & SHF_ALLOC) && 1583 + (!infosec || infosec != info->index.pcpu)) 1578 1584 continue; 1579 1585 1580 1586 if (info->sechdrs[i].sh_flags & SHF_RELA_LIVEPATCH) ··· 2702 2696 2703 2697 static int move_module(struct module *mod, struct load_info *info) 2704 2698 { 2705 - int i; 2706 - enum mod_mem_type t = 0; 2707 - int ret = -ENOMEM; 2699 + int i, ret; 2700 + enum mod_mem_type t = MOD_MEM_NUM_TYPES; 2708 2701 bool codetag_section_found = false; 2709 2702 2710 2703 for_each_mod_mem_type(type) { ··· 2781 2776 return 0; 2782 2777 out_err: 2783 2778 module_memory_restore_rox(mod); 2784 - for (t--; t >= 0; t--) 2779 + while (t--) 2785 2780 module_memory_free(mod, t); 2786 2781 if (codetag_section_found) 2787 2782 codetag_free_module_sections(mod);