Re: Kernel crash due to memory corruption with v5.4.26-rt17 and PowerPC e500

From: Sebastian Andrzej Siewior
Date: Fri May 29 2020 - 09:14:58 EST


On 2020-05-04 11:40:08 [+0200], Mark Marshall wrote:
> The easiest way we have found to reproduce the crash is to repeatedly
> insert and then remove a module. The crash then appears to be related
> to either paging in the module or in exiting the mdev process. (The
> crash does also happen at other times, but it is hard to reproduce
> reliably then). This simple script will almost always crash:
>
> for i in $(seq 1000) ; do echo $i ; modprobe crc7 ; rmmod crc7 ; done

So I tried that on 5.6.14-rt7 with the qemu version of e500 (the SMP and
UP version). No luck. I don't have anything with real hardware.
Could you share the .config in case this is related?

> (The crc7 module is chosen as it is small and simple. Any module will
> work / crash).
>
> We have tried kernels v5.0, v5.2 and v5.6. The v5.0 and v5.2 kernels
> do not show the problem. The v5.6 kernel does show the problem.
> Switching of RT fixes the problem.
>
> I have reduced the functionality in the kernel to a bare minimum
> (removing networking, USB and PCI, as we have some out-of-tree patches
> in those areas) and we still get the crash.
â
> I have added some debugging code where the mm_struct and
> vma_area_struct have "poision" values at the start and the end, and
> this seems to show that the vma_area_struct is getting corrupted, but
> I'm not able to see where.

oh.

> We have switched on all of the debugging that we can, including
> KASAN, and this shows nothing.
>
>
> Can anyone help us? What can we try next? Is anyone using the e500
> with the RT kernel? Does anyone have any idea how to debug problems
> related to the error message "Bad rss-counter state"?
>
> Any help or advice would be most gratefully received.

I don't have any ideas. You could try to apply only a part of the RT
patch and see if it problem is still there. If you are lucky you find
the patch that introduces the problem. If not, the problem appears with
the RT switchâ

> Many thanks,
> Mark Marshall and Thomas Graziadei

Sebastian