linux/mm/kasan
Andrey Konovalov c7d68c4502 BACKPORT: kasan, arm64: allow using KUnit tests with HW_TAGS mode
[ Conflicts due to conflicts when reverting the FROMGIT version. ]

On a high level, this patch allows running KUnit KASAN tests with the
hardware tag-based KASAN mode.

Internally, this change reenables tag checking at the end of each KASAN
test that triggers a tag fault and leads to tag checking being disabled.

Also simplify is_write calculation in report_tag_fault.

With this patch KASAN tests are still failing for the hardware tag-based
mode; fixes come in the next few patches.

[andreyknvl@google.com: export HW_TAGS symbols for KUnit tests]
  Link: https://lkml.kernel.org/r/e7eeb252da408b08f0c81b950a55fb852f92000b.1613155970.git.andreyknvl@google.com

Link: https://linux-review.googlesource.com/id/Id94dc9eccd33b23cda4950be408c27f879e474c8
Link: https://lkml.kernel.org/r/51b23112cf3fd62b8f8e9df81026fa2b15870501.1610733117.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Branislav Rankov <Branislav.Rankov@arm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Evgenii Stepanov <eugenis@google.com>
Cc: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: Marco Elver <elver@google.com>
Cc: Peter Collingbourne <pcc@google.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit f05842cfb9)
Bug: 172318110
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Change-Id: I56c2fb669b1440b6bb3cd5e41e514a6179ea3b81
2021-03-05 19:34:00 +00:00
..
common.c Revert "BACKPORT: kasan: remove redundant config option" 2021-03-05 19:33:02 +00:00
generic.c FROMGIT: kasan: fix bug detection via ksize for HW_TAGS mode 2021-02-07 13:41:42 -08:00
hw_tags.c BACKPORT: kasan, arm64: allow using KUnit tests with HW_TAGS mode 2021-03-05 19:34:00 +00:00
init.c UPSTREAM: arm/kasan: fix the array size of kasan_early_shadow_pte[] 2021-03-05 19:32:48 +00:00
kasan.h BACKPORT: kasan, arm64: allow using KUnit tests with HW_TAGS mode 2021-03-05 19:34:00 +00:00
Makefile UPSTREAM: kasan, arm64: implement HW_TAGS runtime 2021-01-19 21:47:30 -08:00
quarantine.c FROMGIT: kasan: prefix global functions with kasan_ 2021-02-07 13:41:41 -08:00
report_generic.c Revert "BACKPORT: kasan: remove redundant config option" 2021-03-05 19:33:02 +00:00
report_hw_tags.c FROMGIT: kasan: prefix global functions with kasan_ 2021-02-07 13:41:41 -08:00
report_sw_tags.c FROMGIT: kasan: prefix global functions with kasan_ 2021-02-07 13:41:41 -08:00
report.c FROMGIT: kasan: add compiler barriers to KUNIT_EXPECT_KASAN_FAIL 2021-02-07 13:41:41 -08:00
shadow.c FROMGIT: kasan: ensure poisoning size alignment 2021-02-16 15:33:32 +01:00
sw_tags.c FROMGIT: kasan: fix bug detection via ksize for HW_TAGS mode 2021-02-07 13:41:42 -08:00