mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Anders Roxell <anders.roxell@linaro.org>
Cc: paulmck@kernel.org, joel@joelfernandes.org,
	"Naveen N . Rao" <naveen.n.rao@linux.ibm.com>,
	Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
	David Miller <davem@davemloft.net>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: next-20191122: qemu arm64: WARNING: suspicious RCU usage
Date: Mon, 2 Dec 2019 11:24:37 +0900	[thread overview]
Message-ID: <20191202112437.b7dc520eeea0690623263ad5@kernel.org> (raw)
In-Reply-To: <CADYN=9LGeAzBtgZOwA4ro+KnXp=1J1i7h3Sne6BqHvaf4Z6byA@mail.gmail.com>

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>

      reply	other threads:[~2019-12-02  2:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22 21:43 Anders Roxell
2019-12-02  2:24 ` Masami Hiramatsu [this message]

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=20191202112437.b7dc520eeea0690623263ad5@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=anders.roxell@linaro.org \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=paulmck@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

all inboxes | Powered by JetHome®