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

Zhouyi Zhou
2023-04-25T09:28:04Z

On Tue, Apr 25, 2023 at 2:01 PM Zhouyi Zhou <zhouzhouyi@gmail.com> wrote:
>
> hi
>
> On Tue, Apr 25, 2023 at 6:07 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
> >
> > Zhouyi Zhou <zhouzhouyi@gmail.com> writes:
> > > Dear PowerPC and RCU developers:
> > > During the RCU torture test on mainline (on the VM of Opensource Lab
> > > of Oregon State University), SRCU-P failed with __stack_chk_fail:
> > ...
> > > by debugging, I see the r10 is assigned with r13 on c000000000226eb4,
> > > but if there is a context-switch before c000000000226edc, a false
> > > positive will be reported.
> > >
> > > [1] http://154.220.3.115/logs/0422/configformainline.txt
> >
> > Says:
> >
> > CONFIG_CC_VERSION_TEXT="powerpc64le-linux-gnu-gcc-10 (Ubuntu 10.4.0-4ubuntu1~22.04) 10.4.0"
> >
> > Do you see the same issue with a newer GCC?
> On PPC vm of Oregon State University (I can grant rsa-pub key ssh
> access if you are interested), I
> build and install the gcc from git, then use the newly built gcc to
> compile the kernel, the bug disappears,
> I don't know why. Following is what is do:
>
> 1) git clone git://gcc.gnu.org/git/gcc.git
> git rev-parse --short HEAD
> f0eabc52c9a
> 2) mkdir gcc/build
> 3) cd gcc/build
> 4) ../configure --disable-bootstrap --prefix=/home/ubuntu/gcc-install
> 5) make -j 4 //my VM has limited memory ;-)
> 6) make install
> 7) cd linux-dir
> git rev-parse --short HEAD
> 61d325dcbc05
> 8) export PATH=/home/ubuntu/gcc-install/bin:$PATH
> 9) make vmlinux -j 8
> 10) ./whilebash.sh [1]
>
> From the assembly code of srcu_gp_start_if_needed [2], I found stack protector
> is operated directly on r13:
>
> c000000000225098: 30 00 0d e9 ld r8,48(r13)
> c00000000022509c: 08 00 3c e9 ld r9,8(r28)
> c0000000002250a0: 14 42 29 7d add r9,r9,r8
> c0000000002250a4: ac 04 00 7c hwsync
> c0000000002250a8: 10 00 7b 3b addi r27,r27,16
> c0000000002250ac: 14 da 29 7d add r9,r9,r27
> c0000000002250b0: a8 48 00 7d ldarx r8,0,r9
> c0000000002250b4: 01 00 08 31 addic r8,r8,1
> c0000000002250b8: ad 49 00 7d stdcx. r8,0,r9
> c0000000002250bc: f4 ff c2 40 bne- c0000000002250b0
> <srcu_gp_start_if_needed+0x220>
> c0000000002250c0: 28 00 01 e9 ld r8,40(r1)
> c0000000002250c4: 78 0c 2d e9 ld r9,3192(r13)
> c0000000002250c8: 79 4a 08 7d xor. r8,r8,r9
> c0000000002250cc: 00 00 20 39 li r9,0
> c0000000002250d0: 90 03 82 40 bne c000000000225460
> <srcu_gp_start_if_needed+0x5d0>
>
> console.log is attached at [3].
>
> [1] 140.211.169.189/0425/whilebash.sh
> [2] http://140.211.169.189/0425/srcu_gp_start_if_needed.txt
> [3] http://140.211.169.189/0425/console.log
>
> I am very glad to cooperate if there is anything else I can do ;-)
>
> Cheers
> Zhouyi
> >
> > There's 12.2.0 here:
> > https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/
> > https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/ppc64le/12.2.0/
powerpc64le-linux-gnu-gcc-12 cross compiler on my Ubuntu 22.04 does
not seem to have that issue as gcc-10 does
[4] http://140.211.169.189/0425/srcu_gp_start_if_needed-gcc-12.txt
> >
> > Or if you can build in a Fedora 38 system or container, it has GCC 13.
> >
> > cheers