Machine freezes after running KASAN KUnit test 21 with a GCC 13.2 built kernel but runs tests fine with a CLANG 18 build kernel (v6.9-rc5, 32bit ppc, PowerMac G4 DP)
Andrey Konovalov
andreyknvl at gmail.com
Fri May 17 23:02:28 AEST 2024
On Wed, May 1, 2024 at 2:42 PM 'Erhard Furtner' via kasan-dev
<kasan-dev at googlegroups.com> wrote:
>
> On Sat, 27 Apr 2024 20:50:20 +0200
> Erhard Furtner <erhard_f at mailbox.org> wrote:
>
> > Greetings!
> >
> > Building kernel v6.9-rc5 with GCC 13.2 + binutils 2.42 and running KASAN KUnit tests (CONFIG_KASAN_INLINE=y, CONFIG_KASAN_KUNIT_TEST=y) on my Dual CPU PowerMac G4 DP always freezes the machine after test 21 (see attached dmesg gcc_v02). Sometimes the G4 is able to reboot, most of the time it just freezes:
>
> Turns out this is not a ppc specific issue at all, happens also on my AMD FX 8370, tested on kernel v6.9-rc6. clang18 built kernel runs and passes KASAN KUnit tests fine whereas a gcc13 built kernel freezes or reboots after test 20 (ppc after test 21):
>
> [...]
> ok 16 kmalloc_uaf_16
> # kmalloc_oob_in_memset: EXPECTATION FAILED at mm/kasan/kasan_test.c:566
> KASAN failure expected in "memset(ptr, 0, size + KASAN_GRANULE_SIZE)", but none occurred
> not ok 17 kmalloc_oob_in_memset
> # kmalloc_oob_memset_2: EXPECTATION FAILED at mm/kasan/kasan_test.c:496
> KASAN failure expected in "memset(ptr + size - 1, 0, memset_size)", but none occurred
> not ok 18 kmalloc_oob_memset_2
> # kmalloc_oob_memset_4: EXPECTATION FAILED at mm/kasan/kasan_test.c:514
> KASAN failure expected in "memset(ptr + size - 3, 0, memset_size)", but none occurred
> not ok 19 kmalloc_oob_memset_4
> # kmalloc_oob_memset_8: EXPECTATION FAILED at mm/kasan/kasan_test.c:532
> KASAN failure expected in "memset(ptr + size - 7, 0, memset_size)", but none occurred
> not ok 20 kmalloc_oob_memset_8
> # kmalloc_oob_memset_16: EXPECTATION FAILED at mm/kasan/kasan_test.c:550
> KASAN failure expected in "memset(ptr + size - 15, 0, memset_size)", but none occurred
+Nico, who also encountered this issue.
Mailed a patch that should fix this:
https://lore.kernel.org/linux-mm/20240517130118.759301-1-andrey.konovalov@linux.dev/T/#u
You can consider disabling CONFIG_FORTIFY_SOURCE for now as a workaround.
Thank you!
More information about the Linuxppc-dev
mailing list