]> www.infradead.org Git - users/jedix/linux-maple.git/commit
kasan: test: avoid corrupting memory via memset
authorAndrey Konovalov <andreyknvl@gmail.com>
Mon, 23 Aug 2021 23:59:24 +0000 (09:59 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Aug 2021 23:34:03 +0000 (09:34 +1000)
commit8a18c37a4ced6040f62f6845c534ea6ba012108c
tree0ca58c0d89d57b96024710b4e7bda55dde80b178
parent1b20e9ea1aa1cb365bc9da5e80ca2c5067865179
kasan: test: avoid corrupting memory via memset

kmalloc_oob_memset_*() tests do writes past the allocated objects.  As the
result, they corrupt memory, which might lead to crashes with the HW_TAGS
mode, as it neither uses quarantine nor redzones.

Adjust the tests to only write memory within the aligned kmalloc objects.

Also add a comment mentioning that memset tests are designed to touch both
valid and invalid memory.

Link: https://lkml.kernel.org/r/64fd457668a16e7b58d094f14a165f9d5170c5a9.1628779805.git.andreyknvl@gmail.com
Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
lib/test_kasan.c