mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
Modules fixes for 6.16-rc6
This includes 2 fixes: one introduced in the current release cycle (v6.16-rc1) and another introduced back in v6.4-rc1. Both have been in linux-next since next-250701 and have passed the modules ci tests using kdevops. Finally, 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 commitc50d295c37
("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 b3b91325f3c7 ("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. Signed-off-by: Daniel Gomez <da.gomez@samsung.com> -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE73Ua4R8Pc+G5xjxTQJ6jxB8ZUfsFAmhta7AACgkQQJ6jxB8Z UftulhAAiK78CFOdIcKbGKMD8tBGCHUT6IVCskY0E3aqDmhZiNEXhpmwKnOq56zo ztbwg81Acc41t0Y283vgmZuEpJbzmS47qRYIZEhk5BuLdKl3Hn91Iyi3sdZLB9gD VaYkpY0y4V3pWL5AM/9rtnLvY7PSLZG0bnAeS2fsOzxN5DIn2IIdD3WsU++96O+k LHIik7dXcBQQKOukRClAI+cZiU2IGGG/FcDuMmANcsw+E4GKTBQunZiixTZOjdgi e//NMYw1+Y5DJQ/i7C3Fl6+W+r/8/HPkRxyZ3Wt79WBZxwV/Hp5iTG9652vHKE1i ybBDwlJkQC/EQsup4NKzDby38bPW1tdYwwK0dNbMRGxNICqNe7rq5fEG4WjTjXAA H2O5VZ84Ys1SRx+uXeu83aog6fdiZ9DezGuaxFgrTRHUken2QvxJ/HTXe1BmMNY5 9BbHPrG22dp+dEDptSVaDWWMQZ6OP73gXrPYowQC8/FOm9NdBXVIH9hvvI7KRSf5 OC4A7nyZCDNW/Dwzc6yi3qAWMkKCR6IGMqN9vFiR3iIkaHJN1KABFzaVmh3JpR+B 6TsuO8/EIu9Ue25VgMehSj9LuGFgbhcfg40N2Fj/7+vgAM4Rd5sOw/NyiaD8xUPC j0Ql4ehZiOQof8wAhdxpHFQQjO30UdpQgOmUO1yNUdmuPIpdSN0= =dQvQ -----END PGP SIGNATURE----- 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 commitc50d295c37
("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()
This commit is contained in:
commit
7278212738
|
@ -16824,8 +16824,8 @@ F: include/dt-bindings/clock/mobileye,eyeq5-clk.h
|
|||
MODULE SUPPORT
|
||||
M: Luis Chamberlain <mcgrof@kernel.org>
|
||||
M: Petr Pavlu <petr.pavlu@suse.com>
|
||||
M: Daniel Gomez <da.gomez@kernel.org>
|
||||
R: Sami Tolvanen <samitolvanen@google.com>
|
||||
R: Daniel Gomez <da.gomez@samsung.com>
|
||||
L: linux-modules@vger.kernel.org
|
||||
L: linux-kernel@vger.kernel.org
|
||||
S: Maintained
|
||||
|
|
|
@ -1573,8 +1573,14 @@ static int apply_relocations(struct module *mod, const struct load_info *info)
|
|||
if (infosec >= info->hdr->e_shnum)
|
||||
continue;
|
||||
|
||||
/* Don't bother with non-allocated sections */
|
||||
if (!(info->sechdrs[infosec].sh_flags & SHF_ALLOC))
|
||||
/*
|
||||
* Don't bother with non-allocated sections.
|
||||
* An exception is the percpu section, which has separate allocations
|
||||
* for individual CPUs. We relocate the percpu section in the initial
|
||||
* ELF template and subsequently copy it to the per-CPU destinations.
|
||||
*/
|
||||
if (!(info->sechdrs[infosec].sh_flags & SHF_ALLOC) &&
|
||||
(!infosec || infosec != info->index.pcpu))
|
||||
continue;
|
||||
|
||||
if (info->sechdrs[i].sh_flags & SHF_RELA_LIVEPATCH)
|
||||
|
@ -2696,9 +2702,8 @@ static int find_module_sections(struct module *mod, struct load_info *info)
|
|||
|
||||
static int move_module(struct module *mod, struct load_info *info)
|
||||
{
|
||||
int i;
|
||||
enum mod_mem_type t = 0;
|
||||
int ret = -ENOMEM;
|
||||
int i, ret;
|
||||
enum mod_mem_type t = MOD_MEM_NUM_TYPES;
|
||||
bool codetag_section_found = false;
|
||||
|
||||
for_each_mod_mem_type(type) {
|
||||
|
@ -2776,7 +2781,7 @@ static int move_module(struct module *mod, struct load_info *info)
|
|||
return 0;
|
||||
out_err:
|
||||
module_memory_restore_rox(mod);
|
||||
for (t--; t >= 0; t--)
|
||||
while (t--)
|
||||
module_memory_free(mod, t);
|
||||
if (codetag_section_found)
|
||||
codetag_free_module_sections(mod);
|
||||
|
|
Loading…
Reference in New Issue
Block a user