All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	rcu <rcu@vger.kernel.org>,
	lance@osuosl.org, Zhouyi Zhou <zhouzhouyi@gmail.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: BUG : PowerPC RCU: torture test failed with __stack_chk_fail
Date: Mon, 24 Apr 2023 12:25:42 -0700	[thread overview]
Message-ID: <ZEbXtmFUPKA5cl6P@boqun-archlinux> (raw)
In-Reply-To: <20230424172900.GR19790@gate.crashing.org>

On Mon, Apr 24, 2023 at 12:29:00PM -0500, Segher Boessenkool wrote:
> On Mon, Apr 24, 2023 at 08:28:55AM -0700, Boqun Feng wrote:
> > On Mon, Apr 24, 2023 at 10:13:51AM -0500, Segher Boessenkool wrote:
> > > At what points can r13 change?  Only when some particular functions are
> > > called?
> > 
> > r13 is the local paca:
> > 
> > 	register struct paca_struct *local_paca asm("r13");
> > 
> > , which is a pointer to percpu data.
> 
> Yes, it is a global register variable.
> 
> > So if a task schedule from one CPU to anotehr CPU, the value gets
> > changed.
> 
> But the compiler does not see that something else changes local_paca (or

It's more like this, however, in this case r13 is not changed:

	CPU 0			CPU 1
	{r13 = 0x00}		{r13 = 0x04}

	<thread 1>
	<in interrupt>
	 _switch():
	  <switch to the stack of thread 2>
	  <no need to change r13>
	  <in thread 2>
	<thread 2>
				<thread 3>
				_switch():
				 <switch to the stack of thread 1>
				 <no need to change r13>
				 <in thread 1>
				<thread 1>

as you can see thread 1 schedules from CPU 0 to CPU 1 and neither CPU
changes its r13, but in the point of view for thread 1, its r13 changes.

> r13 some other way, via assembler code perhaps)?  Or is there a compiler
> bug?
> 

This looks to me a compiler bug, but I'm not 100% sure.

Regards,
Boqun


> If the latter is true:
> 
> Can you make a reproducer and open a GCC PR?  <https://gcc.gnu.org/bugs/>
> for how to get started doing that.  We need *exact* code that shows the
> problem, together with a compiler command line.  So that we can
> reproduce the problem.  That is step 0 in figuring out what is going on,
> and then maybe fixing the problem :-)
> 
> 
> Segher

WARNING: multiple messages have this Message-ID (diff)
From: Boqun Feng <boqun.feng@gmail.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	Joel Fernandes <joel@joelfernandes.org>,
	Zhouyi Zhou <zhouzhouyi@gmail.com>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	rcu <rcu@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	lance@osuosl.org, "Paul E. McKenney" <paulmck@kernel.org>
Subject: Re: BUG : PowerPC RCU: torture test failed with __stack_chk_fail
Date: Mon, 24 Apr 2023 12:25:42 -0700	[thread overview]
Message-ID: <ZEbXtmFUPKA5cl6P@boqun-archlinux> (raw)
In-Reply-To: <20230424172900.GR19790@gate.crashing.org>

On Mon, Apr 24, 2023 at 12:29:00PM -0500, Segher Boessenkool wrote:
> On Mon, Apr 24, 2023 at 08:28:55AM -0700, Boqun Feng wrote:
> > On Mon, Apr 24, 2023 at 10:13:51AM -0500, Segher Boessenkool wrote:
> > > At what points can r13 change?  Only when some particular functions are
> > > called?
> > 
> > r13 is the local paca:
> > 
> > 	register struct paca_struct *local_paca asm("r13");
> > 
> > , which is a pointer to percpu data.
> 
> Yes, it is a global register variable.
> 
> > So if a task schedule from one CPU to anotehr CPU, the value gets
> > changed.
> 
> But the compiler does not see that something else changes local_paca (or

It's more like this, however, in this case r13 is not changed:

	CPU 0			CPU 1
	{r13 = 0x00}		{r13 = 0x04}

	<thread 1>
	<in interrupt>
	 _switch():
	  <switch to the stack of thread 2>
	  <no need to change r13>
	  <in thread 2>
	<thread 2>
				<thread 3>
				_switch():
				 <switch to the stack of thread 1>
				 <no need to change r13>
				 <in thread 1>
				<thread 1>

as you can see thread 1 schedules from CPU 0 to CPU 1 and neither CPU
changes its r13, but in the point of view for thread 1, its r13 changes.

> r13 some other way, via assembler code perhaps)?  Or is there a compiler
> bug?
> 

This looks to me a compiler bug, but I'm not 100% sure.

Regards,
Boqun


> If the latter is true:
> 
> Can you make a reproducer and open a GCC PR?  <https://gcc.gnu.org/bugs/>
> for how to get started doing that.  We need *exact* code that shows the
> problem, together with a compiler command line.  So that we can
> reproduce the problem.  That is step 0 in figuring out what is going on,
> and then maybe fixing the problem :-)
> 
> 
> Segher

  reply	other threads:[~2023-04-24 19:27 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-22 12:46 BUG : PowerPC RCU: torture test failed with __stack_chk_fail Zhouyi Zhou
2023-04-22 19:19 ` Joel Fernandes
2023-04-22 19:19   ` Joel Fernandes
2023-04-23  1:37   ` Zhouyi Zhou
2023-04-23  1:37     ` Zhouyi Zhou
2023-04-23  5:45     ` Zhouyi Zhou
2023-04-23  5:45       ` Zhouyi Zhou
2023-04-22 19:28 ` Joel Fernandes
2023-04-22 19:28   ` Joel Fernandes
2023-04-24  0:32   ` Boqun Feng
2023-04-24  0:32     ` Boqun Feng
2023-04-24  4:00     ` Zhouyi Zhou
2023-04-24  4:00       ` Zhouyi Zhou
2023-04-24 13:14     ` Michael Ellerman
2023-04-24 13:14       ` Michael Ellerman
2023-04-24 15:13       ` Segher Boessenkool
2023-04-24 15:13         ` Segher Boessenkool
2023-04-24 15:28         ` Boqun Feng
2023-04-24 15:28           ` Boqun Feng
2023-04-24 17:29           ` Segher Boessenkool
2023-04-24 17:29             ` Segher Boessenkool
2023-04-24 19:25             ` Boqun Feng [this message]
2023-04-24 19:25               ` Boqun Feng
2023-04-24 18:55           ` Joel Fernandes
2023-04-24 18:55             ` Joel Fernandes
2023-04-25 10:13             ` Peter Zijlstra
2023-04-25 10:13               ` Peter Zijlstra
2023-04-25 10:58               ` Zhouyi Zhou
2023-04-25 10:58                 ` Zhouyi Zhou
2023-04-25 11:06                 ` Joel Fernandes
2023-04-25 11:06                   ` Joel Fernandes
2023-04-25  3:12                   ` Zhouyi Zhou
2023-04-25  3:12                     ` Zhouyi Zhou
2023-04-25 13:40                   ` Christophe Leroy
2023-04-25 13:40                     ` Christophe Leroy
2023-04-25 13:49                     ` Zhouyi Zhou
2023-04-25 13:49                       ` Zhouyi Zhou
2023-04-26  0:32                       ` Joel Fernandes
2023-04-26  0:32                         ` Joel Fernandes
2023-04-26  1:31                         ` Zhouyi Zhou
2023-04-26  1:31                           ` Zhouyi Zhou
2023-04-26  2:15                           ` Joel Fernandes
2023-04-26  2:15                             ` Joel Fernandes
2023-04-26  2:37                             ` Zhouyi Zhou
2023-04-26  2:37                               ` Zhouyi Zhou
2023-04-26  0:42                     ` Joel Fernandes
2023-04-26  0:42                       ` Joel Fernandes
2023-04-26 12:29                   ` Michael Ellerman
2023-04-26 12:29                     ` Michael Ellerman
2023-04-26 13:44                     ` Joel Fernandes
2023-04-26 13:44                       ` Joel Fernandes
2023-04-26 14:20                       ` Peter Zijlstra
2023-04-26 14:20                         ` Peter Zijlstra
2023-04-26 14:45                         ` Michael Ellerman
2023-04-26 14:45                           ` Michael Ellerman
2023-04-28 10:35                     ` Christophe Leroy
2023-04-28 10:35                       ` Christophe Leroy
2023-04-25 10:59               ` Joel Fernandes
2023-04-25 10:59                 ` Joel Fernandes
2023-04-25 11:53                 ` Peter Zijlstra
2023-04-25 11:53                   ` Peter Zijlstra
2023-04-25 13:36                   ` Christophe Leroy
2023-04-25 13:36                     ` Christophe Leroy
2023-04-24 22:07 ` Michael Ellerman
2023-04-24 22:13   ` Zhouyi Zhou
2023-04-24 22:13     ` Zhouyi Zhou
2023-04-25  6:01   ` Zhouyi Zhou
2023-04-25  6:01     ` Zhouyi Zhou
2023-04-25  9:27     ` Zhouyi Zhou
2023-04-25  9:27       ` Zhouyi Zhou
2023-04-27  3:09       ` Michael Ellerman
2023-04-27  3:09         ` Michael Ellerman
2023-04-27  3:32         ` Zhouyi Zhou
2023-04-27  3:32           ` Zhouyi Zhou
2023-04-27  9:21         ` Zhouyi Zhou
2023-04-27  9:21           ` Zhouyi Zhou
2023-04-27 14:13           ` Michael Ellerman
2023-04-27 14:13             ` Michael Ellerman
2023-04-27 14:29             ` Zhouyi Zhou
2023-04-27 14:29               ` Zhouyi Zhou

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=ZEbXtmFUPKA5cl6P@boqun-archlinux \
    --to=boqun.feng@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=lance@osuosl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=segher@kernel.crashing.org \
    --cc=zhouzhouyi@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.