Thread (41 messages) 41 messages, 7 authors, 2023-04-28

Re: BUG : PowerPC RCU: torture test failed with __stack_chk_fail

From: Boqun Feng <hidden>
Date: 2023-04-24 19:26:27
Also in: lkml, rcu

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:
quoted
On Mon, Apr 24, 2023 at 10:13:51AM -0500, Segher Boessenkool wrote:
quoted
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.
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help