[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20191202112437.b7dc520eeea0690623263ad5@kernel.org>
Date: Mon, 2 Dec 2019 11:24:37 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Anders Roxell <anders.roxell@...aro.org>
Cc: paulmck@...nel.org, joel@...lfernandes.org,
"Naveen N . Rao" <naveen.n.rao@...ux.ibm.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
David Miller <davem@...emloft.net>,
Masami Hiramatsu <mhiramat@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: 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@...aro.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@...nel.org>
Powered by blists - more mailing lists