On Sun, Sep 22, 2024 at 1:49 AM Andrey Konovalov <andreyknvl@xxxxxxxxx> wrote: > > I tried running the tests with this patch applied, but unfortunately > the added test fails on arm64, most likely due to missing annotations > in arm64 asm code. Thanks for testing it on arm64. I've checked other arch and found out that only s390, x86 are using <linux/instrumented.h> header with KASAN and friends in annotations. <linux/kasan-checks.h> is in arm64 and x86. While the current [PATCH v4] has x86 only instrumentations for __get/put_kernel_nofault, I think, we can take as an example copy_from_user solution here: https://elixir.bootlin.com/linux/v6.11-rc7/source/include/linux/uaccess.h#L162-L164 , which should be a generic instrumentation of __get/put_kernel_nofault for all arch. I can try to make a separate PATCH with this solution. > We need to either mark the added test as x86-only via > KASAN_TEST_NEEDS_CONFIG_ON or add annotations for arm64. > > With annotations for arm64, the test might still fail for other > architectures, but I think that's fine: hopefully relevant people will > add annotations in time. But I consider both x86 and arm64 important, > so we should keep the tests working there. > > If you decide to add annotations for arm64, please also test both > KASAN_SW_TAGS and KASAN_HW_TAGS modes. Please suggest if the solution above to make a generic instrumentation of __get/put_kernel_nofault is suitable. Otherwise, for this patch as you've suggested, we can add KASAN_TEST_NEEDS_CONFIG_ON(test, CONFIG_X86); to make sure that kunit test is for x86 only and I can add arm64 kasan-checks with SW, HW tags in separate "mm, arm64" PATCH.