Message ID | cover.1628779805.git.andreyknvl@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | kasan: test: avoid crashing the kernel with HW_TAGS | expand |
On Thu, Aug 12, 2021 at 4:53 PM <andrey.konovalov@linux.dev> wrote: > > From: Andrey Konovalov <andreyknvl@gmail.com> > > KASAN tests do out-of-bounds and use-after-free accesses. Running the > tests works fine for the GENERIC mode, as it uses qurantine and redzones. > But the HW_TAGS mode uses neither, and running the tests might crash > the kernel. > > Rework the tests to avoid corrupting kernel memory. > > Changes v1->v2: > - Touch both good and bad memory in memset tests as suggested by Marco. Ah, I forgot to include your reviews/acks, Marco. Perhaps you can give one for the whole series now. Thanks!
On Thu, 12 Aug 2021 at 17:06, Andrey Konovalov <andreyknvl@gmail.com> wrote: > On Thu, Aug 12, 2021 at 4:53 PM <andrey.konovalov@linux.dev> wrote: > > From: Andrey Konovalov <andreyknvl@gmail.com> > > > > KASAN tests do out-of-bounds and use-after-free accesses. Running the > > tests works fine for the GENERIC mode, as it uses qurantine and redzones. > > But the HW_TAGS mode uses neither, and running the tests might crash > > the kernel. > > > > Rework the tests to avoid corrupting kernel memory. > > > > Changes v1->v2: > > - Touch both good and bad memory in memset tests as suggested by Marco. > > Ah, I forgot to include your reviews/acks, Marco. > > Perhaps you can give one for the whole series now. Reviewed-by: Marco Elver <elver@google.com> Looks good, thank you!
From: Andrey Konovalov <andreyknvl@gmail.com> KASAN tests do out-of-bounds and use-after-free accesses. Running the tests works fine for the GENERIC mode, as it uses qurantine and redzones. But the HW_TAGS mode uses neither, and running the tests might crash the kernel. Rework the tests to avoid corrupting kernel memory. Changes v1->v2: - Touch both good and bad memory in memset tests as suggested by Marco. Andrey Konovalov (8): kasan: test: rework kmalloc_oob_right kasan: test: avoid writing invalid memory kasan: test: avoid corrupting memory via memset kasan: test: disable kmalloc_memmove_invalid_size for HW_TAGS kasan: test: only do kmalloc_uaf_memset for generic mode kasan: test: clean up ksize_uaf kasan: test: avoid corrupting memory in copy_user_test kasan: test: avoid corrupting memory in kasan_rcu_uaf lib/test_kasan.c | 80 +++++++++++++++++++++++++++++------------ lib/test_kasan_module.c | 20 +++++------ 2 files changed, 66 insertions(+), 34 deletions(-)