From: Joel Fernandes <joel@joelfernandes.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kbuild@01.org, kbuild-all@01.org,
LKML <linux-kernel@vger.kernel.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Joel Fernandes (Google)" <joel@joelfernandes.org>
Subject: Re: [rcu:dev.2019.09.23a 62/77] kernel/rcu/tree.c:2882 kfree_call_rcu() warn: inconsistent returns 'irqsave:flags'.
Date: Tue, 24 Sep 2019 08:15:12 -0400 [thread overview]
Message-ID: <CAEXW_YQYDom3AwWR1AUSCw5VvFzc6KrBH0KbuTvhkJ3OoxBfCg@mail.gmail.com> (raw)
In-Reply-To: <20190924080510.GL20699@kadam>
On Tue, Sep 24, 2019 at 4:05 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> tree: https://kernel.googlesource.com/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2019.09.23a
> head: 97de53b94582c208ee239178b208b8e8b9472585
> commit: 39676bb72323718a9e7bab1ba9c4a68319a96f62 [62/77] rcu: Add support for debug_objects debugging for kfree_rcu()
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> smatch warnings:
> kernel/rcu/tree.c:2882 kfree_call_rcu() warn: inconsistent returns 'irqsave:flags'.
> Locked on: line 2867
> Unlocked on: line 2882
>
> git remote add rcu https://kernel.googlesource.com/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
> git remote update rcu
> git checkout 39676bb72323718a9e7bab1ba9c4a68319a96f62
> vim +2882 kernel/rcu/tree.c
>
> 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2850) void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func)
> 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2851) {
> 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2852) unsigned long flags;
> 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2853) struct kfree_rcu_cpu *krcp;
> 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2854)
> 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2855) head->func = func;
> 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2856)
> 87970ccf5a9125 Paul E. McKenney 2019-09-19 2857 local_irq_save(flags); // For safely calling this_cpu_ptr().
> ^^^^^^^^^^^^^^^^^^^^^
> IRQs disabled.
>
> 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2858) krcp = this_cpu_ptr(&krc);
> ff8db005e371cb Paul E. McKenney 2019-09-19 2859 if (krcp->initialized)
> 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2860) spin_lock(&krcp->lock);
> 5f5046cc15d514 Joel Fernandes (Google 2019-08-05 2861)
> 87970ccf5a9125 Paul E. McKenney 2019-09-19 2862 // Queue the object but don't yet schedule the batch.
> 39676bb7232371 Joel Fernandes (Google 2019-09-22 2863) if (debug_rcu_head_queue(head)) {
> 39676bb7232371 Joel Fernandes (Google 2019-09-22 2864) // Probable double kfree_rcu(), just leak.
> 39676bb7232371 Joel Fernandes (Google 2019-09-22 2865) WARN_ONCE(1, "%s(): Double-freed call. rcu_head %p\n",
> 39676bb7232371 Joel Fernandes (Google 2019-09-22 2866) __func__, head);
> 39676bb7232371 Joel Fernandes (Google 2019-09-22 2867) return;
>
> Need to re-enable before returning.
Right. At this point the system has a bug anyway since it is a
double-free. But yes, no reason to introduce more bugs. Will fix.
Thank you, Dan!
next prev parent reply other threads:[~2019-09-24 12:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-24 8:05 [rcu:dev.2019.09.23a 62/77] kernel/rcu/tree.c:2882 kfree_call_rcu() warn: inconsistent returns 'irqsave:flags' Dan Carpenter
2019-09-24 12:15 ` Joel Fernandes [this message]
2019-09-24 16:03 ` Paul E. McKenney
2019-09-26 18:19 ` Joel Fernandes
2019-09-26 19:24 ` Paul E. McKenney
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=CAEXW_YQYDom3AwWR1AUSCw5VvFzc6KrBH0KbuTvhkJ3OoxBfCg@mail.gmail.com \
--to=joel@joelfernandes.org \
--cc=dan.carpenter@oracle.com \
--cc=kbuild-all@01.org \
--cc=kbuild@01.org \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).