mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Björn Töpel" <bjorn@kernel.org>
To: Charlie Jenkins <charlie@rivosinc.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>, Ron Economos <re@w6rz.net>,
	Samuel Holland <samuel.holland@sifive.com>,
	Andreas Schwab <schwab@linux-m68k.org>
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	Charlie Jenkins <charlie@rivosinc.com>
Subject: Re: [PATCH v4 0/2] riscv: Fix issues with module loading
Date: Wed, 29 Nov 2023 08:26:01 +0100	[thread overview]
Message-ID: <87bkbd9g1i.fsf@all.your.base.are.belong.to.us> (raw)
In-Reply-To: <20231127-module_linking_freeing-v4-0-a2ca1d7027d0@rivosinc.com>

Charlie Jenkins <charlie@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@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@rivosinc.com>

  parent reply	other threads:[~2023-11-29  7:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 22:04 Charlie Jenkins
2023-11-27 22:04 ` [PATCH v4 1/2] riscv: Safely remove entries from relocation list Charlie Jenkins
2023-11-29  7:29   ` Björn Töpel
2023-12-04 20:30   ` Lad, Prabhakar
2023-11-27 22:05 ` [PATCH v4 2/2] riscv: Correct type casting in module loading Charlie Jenkins
2023-12-04 20:32   ` Lad, Prabhakar
2023-11-29  7:26 ` Björn Töpel [this message]
2023-12-06 12:10 ` [PATCH v4 0/2] riscv: Fix issues with " patchwork-bot+linux-riscv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkbd9g1i.fsf@all.your.base.are.belong.to.us \
    --to=bjorn@kernel.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=charlie@rivosinc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=re@w6rz.net \
    --cc=samuel.holland@sifive.com \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®