Re: [PATCH] kasan: migrate copy_user_test to kunit

From: Andrey Konovalov
Date: Sat Oct 12 2024 - 18:49:45 EST


On Fri, Oct 11, 2024 at 11:12 AM Sabyrzhan Tasbolatov
<snovitoll@xxxxxxxxx> wrote:
>
> This has been tested on:
> - x86_64 with CONFIG_KASAN_GENERIC
> - arm64 with CONFIG_KASAN_SW_TAGS
> - arm64 with CONFIG_KASAN_HW_TAGS
>
> - arm64 SW_TAGS has 1 failing test which is in the mainline,
> will try to address it in different patch, not related to changes in this PR:
> [ 9.480716] # vmalloc_percpu: EXPECTATION FAILED at
> mm/kasan/kasan_test_c.c:1830
> [ 9.480716] Expected (u8)(__u8)((u64)(c_ptr) >> 56) < (u8)0xFF, but
> [ 9.480716] (u8)(__u8)((u64)(c_ptr) >> 56) == 255 (0xff)
> [ 9.480716] (u8)0xFF == 255 (0xff)
> [ 9.481936] # vmalloc_percpu: EXPECTATION FAILED at
> mm/kasan/kasan_test_c.c:1830
> [ 9.481936] Expected (u8)(__u8)((u64)(c_ptr) >> 56) < (u8)0xFF, but
> [ 9.481936] (u8)(__u8)((u64)(c_ptr) >> 56) == 255 (0xff)
> [ 9.481936] (u8)0xFF == 255 (0xff)

Could you share the kernel config that you use to get this failure?
This test works for me with my config...

> Here is my full console log of arm64-sw.log:
> https://gist.githubusercontent.com/novitoll/7ab93edca1f7d71925735075e84fc2ec/raw/6ef05758bcc396cd2f5796a5bcb5e41a091224cf/arm64-sw.log
>
> - arm64 HW_TAGS has 1 failing test related to new changes
> and AFAIU, it's known issue related to HW_TAGS:
>
> [ 11.167324] # copy_user_test_oob: EXPECTATION FAILED at
> mm/kasan/kasan_test_c.c:1992
> [ 11.167324] KASAN failure expected in "unused =
> strncpy_from_user(kmem, usermem, size + 1)", but none occurred
>
> Here is the console log of arm64-hw.log:
> https://gist.github.com/novitoll/7ab93edca1f7d71925735075e84fc2ec#file-arm64-hw-log-L11208

I don't remember seeing this issue before, did you manage to figure
out why this happens?

Thank you for working on this!