[PATCH v4 0/2] riscv: Fix issues with module loading
Björn Töpel
bjorn at kernel.org
Tue Nov 28 23:26:01 PST 2023
Charlie Jenkins <charlie at rivosinc.com> writes:
> Module loading did not account for multiple threads concurrently loading
> modules. This patch fixes that issue. There is also a small patch to fix
> the type of a __le16 variable.
>
> Signed-off-by: Charlie Jenkins <charlie at rivosinc.com>
> ---
> Changes in v4:
> - Make functions only used internally static
> - Free data structures on kmalloc failure (Andreas)
> - Link to v3: https://lore.kernel.org/r/20231122-module_linking_freeing-v3-0-8e9e412a3305@rivosinc.com
>
> Changes in v3:
> - Cleanup pointer passing (Samuel)
> - Correct indentation (Samuel)
> - Check for kmalloc failures (Samuel)
> - Link to v2: https://lore.kernel.org/r/20231121-module_linking_freeing-v2-1-974bfcd3664e@rivosinc.com
>
> Changes in v2:
> - Support linking modules concurrently across threads.
> - Link to v1: https://lore.kernel.org/r/20231120-module_linking_freeing-v1-1-fff81d7289fc@rivosinc.com
>
> ---
> Charlie Jenkins (2):
> riscv: Safely remove entries from relocation list
> riscv: Correct type casting in module loading
I got hit by this on QEMU for 6.7-rc3:
| Unable to handle kernel paging request at virtual address 6b6b6b6b6b6b6b83
| Oops [#1]
| Modules linked in:
| CPU: 3 PID: 1 Comm: systemd Not tainted 6.7.0-rc3 #1
| Hardware name: riscv-virtio,qemu (DT)
| epc : process_accumulated_relocations+0x70/0x162
| ra : process_accumulated_relocations+0x96/0x162
| epc : ffffffff8000c528 ra : ffffffff8000c54e sp : ff20000000023ab0
| gp : ffffffff8257fea0 tp : ff60000080860040 t0 : ff60000083934d68
| t1 : 0000000000000006 t2 : 0000000000000002 s0 : ff20000000023b30
| s1 : 6b6b6b6b6b6b6b6b a0 : ffffffff80ed48d8 a1 : 0000000000000000
| a2 : ff1c0000040a9610 a3 : 0000000000000000 a4 : 0000000000000000
| a5 : ff600000832d6990 a6 : ff1c0000040e4d10 a7 : 000000000bbb1d6d
| s2 : 0000000000000023 s3 : 0000000000000230 s4 : ffffffff0264dd40
| s5 : 000000000000003e s6 : ffffffff81401898 s7 : ffffffff0264d040
| s8 : ff60000083934e80 s9 : ffffffff825b7240 s10: ff60000083934de0
| s11: ff200000007a25b0 t3 : ffffffff0264d000 t4 : ffffffff0264d040
| t5 : 0000000000000017 t6 : ff60000083367eb8
| status: 0000000200000120 badaddr: 6b6b6b6b6b6b6b83 cause: 000000000000000d
| [<ffffffff8000c528>] process_accumulated_relocations+0x70/0x162
| [<ffffffff8000ca9a>] apply_relocate_add+0x142/0x37a
| [<ffffffff800e79f0>] load_module+0x1720/0x227c
| [<ffffffff800e8790>] init_module_from_file+0x82/0xba
| [<ffffffff800e8940>] __riscv_sys_finit_module+0x178/0x300
| [<ffffffff80ec9160>] do_trap_ecall_u+0xc6/0x142
| [<ffffffff80ed5cac>] ret_from_exception+0x0/0x64
| Code: 060d 3783 010d 3823 f804 3b83 018d 6384 8363 0a97 (a903) 0184
| ---[ end trace 0000000000000000 ]---
This series resolved the issue for me.
Tested-by: Björn Töpel <bjorn at rivosinc.com>
More information about the linux-riscv
mailing list