public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Michal Pecio <michal.pecio@gmail.com>
Cc: bp@alien8.de, da.gomez@samsung.com, dave.hansen@linux.intel.com,
	hpa@zytor.com, jpoimboe@kernel.org, linux-kernel@vger.kernel.org,
	linux-modules@vger.kernel.org, mcgrof@kernel.org,
	mingo@redhat.com, paulmck@kernel.org, peterz@infradead.org,
	petr.pavlu@suse.com, samitolvanen@google.com, tglx@linutronix.de,
	x86@kernel.org
Subject: Re: [PATCH v3 22/28] x86: Use RCU in all users of __module_address().
Date: Mon, 3 Nov 2025 12:37:50 +0100	[thread overview]
Message-ID: <20251103113750.qam3KIkT@linutronix.de> (raw)
In-Reply-To: <20251103113907.4e647f33.michal.pecio@gmail.com>

On 2025-11-03 11:39:07 [+0100], Michal Pecio wrote:
> Sorry, I forgot to include the link. There is also a similar warning
> regarding __this_cpu_read(). Pretty sure the kernel is SMP.
> 
> https://bbs.archlinux.org/viewtopic.php?id=309960

The stack trace is a bit odd. The compressed version is:
| BUG: using smp_processor_id() in preemptible [00000000] code: Xorg/1183
| caller is in_entry_stack+0x11/0x60
| CPU: 3 UID: 1000 PID: 1183 Comm: Xorg Tainted: P           OE       6.16.12-hardened1-1-hardened #1 PREEMPT(full)  6edb90a7a07fab33bbee72d6d5ef53ba6eec3b9c
| Tainted: [P]=PROPRIETARY_MODULE, [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
| Hardware name: ASUS All Series/Z97-E, BIOS 0803 02/23/2016
| Call Trace:
|  <TASK>
|  dump_stack_lvl+0x5d/0x80
|  check_preemption_disabled+0xe5/0xf0
|  in_entry_stack+0x11/0x60
|  get_stack_info+0x2c/0x80
|  stack_access_ok+0x51/0xa0
|  unwind_next_frame+0x1cb/0x7b0
|  arch_stack_walk+0xa6/0x110
|  stack_trace_save+0x4d/0x70
|  __kfence_alloc+0xb7/0x6f0
|  __kmalloc_noprof+0x520/0x560
|  os_alloc_mem+0x108/0x120 [nvidia 9746d397d5c5bffeb186e829669bb24c0846a4a7]
|  _nv015295rm+0x34/0x50 [nvidia 9746d397d5c5bffeb186e829669bb24c0846a4a7]
|  _nv015297rm+0x2b/0xd0 [nvidia 9746d397d5c5bffeb186e829669bb24c0846a4a7]
|  _nv016352rm+0x1c/0x90 [nvidia 9746d397d5c5bffeb186e829669bb24c0846a4a7]
|  _nv059298rm+0x65/0xb0 [nvidia 9746d397d5c5bffeb186e829669bb24c0846a4a7]
|  _nv054041rm+0x20f/0x360 [nvidia 9746d397d5c5bffeb186e829669bb24c0846a4a7]
|  _nv056165rm+0x54/0xd0 [nvidia 9746d397d5c5bffeb186e829669bb24c0846a4a7]
|  _nv056096rm+0xa0/0x500 [nvidia 9746d397d5c5bffeb186e829669bb24c0846a4a7]
|  _nv015919rm+0x424/0x680 [nvidia 9746d397d5c5bffeb186e829669bb24c0846a4a7]
|  _nv054015rm+0x69/0xd0 [nvidia 9746d397d5c5bffeb186e829669bb24c0846a4a7]
|  _nv014185rm+0x86/0xa0 [nvidia 9746d397d5c5bffeb186e829669bb24c0846a4a7]
|  _nv000652rm+0x5e/0x70 [nvidia 9746d397d5c5bffeb186e829669bb24c0846a4a7]
|  rm_kernel_rmapi_op+0x167/0x273 [nvidia 9746d397d5c5bffeb186e829669bb24c0846a4a7]
|  nvkms_call_rm+0x4c/0x80 [nvidia_modeset 90775ea8a26c5e58b97ef4b3f46eb45efa040eb2]
|  _nv003168kms+0x42/0x50 [nvidia_modeset 90775ea8a26c5e58b97ef4b3f46eb45efa040eb2]
|  ? do_syscall_64+0x82/0x8d0
|  ? entry_SYSCALL_64_after_hwframe+0x76/0x7e
|  </TASK>

The last two entries start with a '?' which means it did not originate
from the "stack unwind" but was laying around while passing through.
I would expect the last two entries to be there without the '?' because
userland (as in X here) enters the kernel via a proper syscall entry
which should be part of the stack strace.

Now, get_stack_info() where the warning originates: It starts with a
check to see if the stack pointer belongs to the current task's stack
frame which it does not. Then it checks if the task found is the
currently running task. That it does. So in that case, we must be
serving an exception (such as an IRQ) because the stack does not belong
to the current task.  However preemption is not disabled which indicates
that we do not do this.
This in turn suggests that nvidia replaced the stack from while entering
the syscall probably in _nv003168kms() or the binary blob which invokes
the kernel function does not have a proper ORC entry which leads to a
wrong turn in the process.

So the warning is well deserved.

Sebastian

  reply	other threads:[~2025-11-03 11:37 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08  9:04 [PATCH v3 00/28] module: Use RCU instead of RCU-sched Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 01/28] module: Extend the preempt disabled section in dereference_symbol_descriptor() Sebastian Andrzej Siewior
2025-01-08  9:55   ` Helge Deller
2025-01-08 10:52     ` Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 02/28] module: Begin to move from RCU-sched to RCU Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 03/28] module: Use proper RCU assignment in add_kallsyms() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 04/28] module: Use RCU in find_kallsyms_symbol() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 05/28] module: Use RCU in module_get_kallsym() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 06/28] module: Use RCU in find_module_all() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 07/28] module: Use RCU in __find_kallsyms_symbol_value() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 08/28] module: Use RCU in module_kallsyms_on_each_symbol() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 09/28] module: Remove module_assert_mutex_or_preempt() from try_add_tainted_module() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 10/28] module: Use RCU in find_symbol() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 11/28] module: Use RCU in __is_module_percpu_address() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 12/28] module: Allow __module_address() to be called from RCU section Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 13/28] module: Use RCU in search_module_extables() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 14/28] module: Use RCU in all users of __module_address() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 15/28] module: Use RCU in all users of __module_text_address() Sebastian Andrzej Siewior
2025-04-23 15:17   ` Benjamin Berg
2025-04-23 18:16     ` Paul E. McKenney
2025-04-24  9:05       ` Sebastian Andrzej Siewior
2025-04-24  9:30         ` Benjamin Berg
2025-04-24 14:47           ` Paul E. McKenney
2025-04-24 15:17           ` Peter Zijlstra
2025-01-08  9:04 ` [PATCH v3 16/28] ARM: " Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 17/28] arm64: " Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 18/28] LoongArch/orc: Use RCU in all users of __module_address() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 19/28] LoongArch: ftrace: Use RCU in all users of __module_text_address() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 20/28] powerpc/ftrace: " Sebastian Andrzej Siewior
2025-01-20 10:09   ` Shrikanth Hegde
2025-01-08  9:04 ` [PATCH v3 21/28] cfi: Use RCU while invoking __module_address() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 22/28] x86: Use RCU in all users of __module_address() Sebastian Andrzej Siewior
2025-11-03 10:08   ` Michal Pecio
2025-11-03 10:34     ` Sebastian Andrzej Siewior
2025-11-03 10:39       ` Michal Pecio
2025-11-03 11:37         ` Sebastian Andrzej Siewior [this message]
2025-11-03 17:37           ` Michal Pecio
2025-01-08  9:04 ` [PATCH v3 23/28] jump_label: " Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 24/28] jump_label: Use RCU in all users of __module_text_address() Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 25/28] bpf: " Sebastian Andrzej Siewior
2025-01-09 18:38   ` Alexei Starovoitov
2025-01-09 20:54     ` Sebastian Andrzej Siewior
2025-01-09 21:00       ` Alexei Starovoitov
2025-01-29  8:47         ` [PATCH v3.5 " Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 26/28] kprobes: " Sebastian Andrzej Siewior
2025-01-28  5:44   ` Masami Hiramatsu
2025-01-28  7:10     ` Sebastian Andrzej Siewior
2025-01-29  8:49     ` [PATCH v3.5 25/28] " Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 27/28] static_call: " Sebastian Andrzej Siewior
2025-01-08  9:04 ` [PATCH v3 28/28] bug: Use RCU instead RCU-sched to protect module_bug_list Sebastian Andrzej Siewior
2025-01-13 11:09 ` [PATCH v3 00/28] module: Use RCU instead of RCU-sched Petr Pavlu
2025-01-13 13:23   ` Sebastian Andrzej Siewior
2025-01-24 17:49   ` Sebastian Andrzej Siewior
2025-01-27 12:22     ` Petr Pavlu
2025-01-29  8:52       ` Sebastian Andrzej Siewior
2025-01-30 13:42         ` Petr Pavlu

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=20251103113750.qam3KIkT@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=bp@alien8.de \
    --cc=da.gomez@samsung.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=michal.pecio@gmail.com \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=petr.pavlu@suse.com \
    --cc=samitolvanen@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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