summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorWalter Wu <walter-zh.wu@mediatek.com>2019-09-23 18:34:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-24 18:54:07 -0400
commitae8f06b31a83e54777514308a63f669a1fed519e (patch)
tree2963246f28ec918cfa7b5d75742eda07cf8deb62 /lib
parentc59180ae3e5b43d3534748b19a57905712ea5fff (diff)
kasan: add memory corruption identification for software tag-based mode
Add memory corruption identification at bug report for software tag-based mode. The report shows whether it is "use-after-free" or "out-of-bound" error instead of "invalid-access" error. This will make it easier for programmers to see the memory corruption problem. We extend the slab to store five old free pointer tag and free backtrace, we can check if the tagged address is in the slab record and make a good guess if the object is more like "use-after-free" or "out-of-bound". therefore every slab memory corruption can be identified whether it's "use-after-free" or "out-of-bound". [aryabinin@virtuozzo.com: simplify & clenup code] Link: https://lkml.kernel.org/r/3318f9d7-a760-3cc8-b700-f06108ae745f@virtuozzo.com] Link: http://lkml.kernel.org/r/20190821180332.11450-1-aryabinin@virtuozzo.com Signed-off-by: Walter Wu <walter-zh.wu@mediatek.com> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Acked-by: Andrey Konovalov <andreyknvl@google.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Alexander Potapenko <glider@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig.kasan8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index 7fa97a8b5717..6c9682ce0254 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -134,6 +134,14 @@ config KASAN_S390_4_LEVEL_PAGING
134 to 3TB of RAM with KASan enabled). This options allows to force 134 to 3TB of RAM with KASan enabled). This options allows to force
135 4-level paging instead. 135 4-level paging instead.
136 136
137config KASAN_SW_TAGS_IDENTIFY
138 bool "Enable memory corruption identification"
139 depends on KASAN_SW_TAGS
140 help
141 This option enables best-effort identification of bug type
142 (use-after-free or out-of-bounds) at the cost of increased
143 memory consumption.
144
137config TEST_KASAN 145config TEST_KASAN
138 tristate "Module for testing KASAN for bug detection" 146 tristate "Module for testing KASAN for bug detection"
139 depends on m && KASAN 147 depends on m && KASAN