lkml.org 
[lkml]   [2019]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: next-20191122: qemu arm64: WARNING: suspicious RCU usage
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>

\
 
 \ /
  Last update: 2019-12-02 03:25    [W:0.035 / U:0.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site