Re: [PATCH 04/11] kasan: add match-all tag tests
From: Alexander Potapenko <glider@google.com>
Date: 2021-01-12 08:06:23
Also in:
linux-arm-kernel, lkml
On Tue, Jan 5, 2021 at 7:28 PM Andrey Konovalov [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Add 3 new tests for tag-based KASAN modes: 1. Check that match-all pointer tag is not assigned randomly. 2. Check that 0xff works as a match-all pointer tag. 3. Check that there are no match-all memory tags. Note, that test #3 causes a significant number (255) of KASAN reports to be printed during execution for the SW_TAGS mode. Signed-off-by: Andrey Konovalov <redacted> Link: https://linux-review.googlesource.com/id/I78f1375efafa162b37f3abcb2c5bc2f3955dfd8e --- lib/test_kasan.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++ mm/kasan/kasan.h | 6 ++++ 2 files changed, 99 insertions(+)diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 46e578c8e842..f1eda0bcc780 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c@@ -13,6 +13,7 @@ #include <linux/mman.h> #include <linux/module.h> #include <linux/printk.h> +#include <linux/random.h> #include <linux/slab.h> #include <linux/string.h> #include <linux/uaccess.h>@@ -790,6 +791,95 @@ static void vmalloc_oob(struct kunit *test) vfree(area); } +/* + * Check that match-all pointer tag is not assigned randomly for + * tag-based modes. + */ +static void match_all_not_assigned(struct kunit *test) +{
Do we want to run this test in non-tag-based modes? Probably not?