mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* next-20191122: qemu arm64: WARNING: suspicious RCU usage
@ 2019-11-22 21:43 Anders Roxell
  2019-12-02  2:24 ` Masami Hiramatsu
  0 siblings, 1 reply; 2+ messages in thread
From: Anders Roxell @ 2019-11-22 21:43 UTC (permalink / raw)
  To: paulmck, joel
  Cc: Naveen N . Rao, Anil S Keshavamurthy, David Miller,
	Masami Hiramatsu, Linux Kernel Mailing List

Hi,

I'm seeing the following warning when I'm booting an arm64 allmodconfig
kernel [1] on linux-next; tag next-20191122, is this anything you've seen
before ?

The code seems to have introduced a long time ago and the warning was
added recently 28875945ba98 ("rcu: Add support for consolidated-RCU
reader checking").

[  193.853316][    T1] Kprobe smoke test: started
[  193.898283][    T1]
[  193.899587][    T1] =============================
[  193.901777][    T1] WARNING: suspicious RCU usage
[  193.903518][    T1] 5.4.0-rc8-next-20191122-00015-gaf188dd3de19 #1
Not tainted
[  193.906423][    T1] -----------------------------
[  193.908214][    T1] kernel/kprobes.c:329 RCU-list traversed in
non-reader section!!
[  193.911189][    T1]
[  193.911189][    T1] other info that might help us debug this:
[  193.911189][    T1]
[  193.914972][    T1]
[  193.914972][    T1] rcu_scheduler_active = 2, debug_locks = 1
[  193.918084][    T1] 1 lock held by swapper/0/1:
[  193.919774][    T1]  #0: ffffa00014255a30 (kprobe_mutex){+.+.}, at:
register_kprobe+0xa0/0xb28
[  193.923346][    T1]
[  193.923346][    T1] stack backtrace:
[  193.925877][    T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
5.4.0-rc8-next-20191122-00015-gaf188dd3de19 #1
[  193.929388][    T1] Hardware name: linux,dummy-virt (DT)
[  193.931247][    T1] Call trace:
[  193.932516][    T1]  dump_backtrace+0x0/0x2d0
[  193.933989][    T1]  show_stack+0x28/0x38
[  193.935375][    T1]  dump_stack+0x1e8/0x28c
[  193.936935][    T1]  lockdep_rcu_suspicious+0xf4/0x108
[  193.938727][    T1]  get_kprobe+0xe0/0x188
[  193.940251][    T1]  __get_valid_kprobe+0x30/0x168
[  193.941937][    T1]  register_kprobe+0xa8/0xb28
[  193.943541][    T1]  init_test_probes+0xf8/0x548
[  193.945220][    T1]  run_init_test_probes+0x6c/0xa0
[  193.946946][    T1]  do_one_initcall+0x4c8/0xae8
[  193.948646][    T1]  kernel_init_freeable+0x3e8/0x508
[  193.950393][    T1]  kernel_init+0x1c/0x208
[  193.951940][    T1]  ret_from_fork+0x10/0x18
[  194.367780][    T1] Kprobe smoke test: passed successfully

Cheers,
Anders
[1] http://people.linaro.org/~anders.roxell/kernel_config-next-20191122.config

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: next-20191122: qemu arm64: WARNING: suspicious RCU usage
  2019-11-22 21:43 next-20191122: qemu arm64: WARNING: suspicious RCU usage Anders Roxell
@ 2019-12-02  2:24 ` Masami Hiramatsu
  0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2019-12-02  2:24 UTC (permalink / raw)
  To: Anders Roxell
  Cc: paulmck, joel, Naveen N . Rao, Anil S Keshavamurthy,
	David Miller, Masami Hiramatsu, Linux Kernel Mailing List

Hello,

Sorry for replying so late.

On Fri, 22 Nov 2019 22:43:56 +0100
Anders Roxell <anders.roxell@linaro.org> wrote:

> Hi,
> 
> I'm seeing the following warning when I'm booting an arm64 allmodconfig
> kernel [1] on linux-next; tag next-20191122, is this anything you've seen
> before ?
> 
> The code seems to have introduced a long time ago and the warning was
> added recently 28875945ba98 ("rcu: Add support for consolidated-RCU
> reader checking").

I've never seen this but the warning itself is justified.

struct kprobe *get_kprobe(void *addr)
{
        struct hlist_head *head;
        struct kprobe *p;

        head = &kprobe_table[hash_ptr(addr, KPROBE_HASH_BITS)];
        hlist_for_each_entry_rcu(p, head, hlist) {  <---- this cause the warning
                if (p->addr == addr)
                        return p;
        }

        return NULL;
}

The kprobe_table itself is protected by kprobe_mutex OR rcu.
If the caller locks the kprobe_mutex, we can safely access the hash
table, this is what the register_kprobe does. If not, the caller must
disable preemption, this happens when a kprobe (breakpoint) is hit.

Thus, the kernel itself is safe, but it should be fixed.

Thank you,

-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-02  2:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 21:43 next-20191122: qemu arm64: WARNING: suspicious RCU usage Anders Roxell
2019-12-02  2:24 ` Masami Hiramatsu

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®