linux/mm/kasan
Feng Tang 5d1ba31087 mm: kasan: Extend kasan_metadata_size() to also cover in-object size
When kasan is enabled for slab/slub, it may save kasan' free_meta
data in the former part of slab object data area in slab object's
free path, which works fine.

There is ongoing effort to extend slub's debug function which will
redzone the latter part of kmalloc object area, and when both of
the debug are enabled, there is possible conflict, especially when
the kmalloc object has small size, as caught by 0Day bot [1].

To solve it, slub code needs to know the in-object kasan's meta
data size. Currently, there is existing kasan_metadata_size()
which returns the kasan's metadata size inside slub's metadata
area, so extend it to also cover the in-object meta size by
adding a boolean flag 'in_object'.

There is no functional change to existing code logic.

[1]. https://lore.kernel.org/lkml/YuYm3dWwpZwH58Hu@xsang-OptiPlex-9020/

Reported-by: kernel test robot <oliver.sang@intel.com>
Suggested-by: Andrey Konovalov <andreyknvl@gmail.com>
Signed-off-by: Feng Tang <feng.tang@intel.com>
Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
2022-11-10 16:27:46 +01:00
..
common.c stackdepot: reserve 5 extra bits in depot_stack_handle_t 2022-10-03 14:03:18 -07:00
generic.c mm: kasan: Extend kasan_metadata_size() to also cover in-object size 2022-11-10 16:27:46 +01:00
hw_tags.c kasan: support kasan.stacktrace for SW_TAGS 2022-10-03 14:03:01 -07:00
init.c kasan: use MAX_PTRS_PER_* for early shadow tables 2021-06-29 10:53:53 -07:00
kasan_test_module.c kasan: move tests to mm/kasan/ 2022-10-03 14:03:02 -07:00
kasan_test.c Random number generator fixes for Linux 6.1-rc1. 2022-10-16 15:27:07 -07:00
kasan.h kasan: dynamically allocate stack ring entries 2022-10-03 14:03:02 -07:00
Makefile kasan: move tests to mm/kasan/ 2022-10-03 14:03:02 -07:00
quarantine.c kasan: give better names to shadow values 2022-05-13 07:20:19 -07:00
report_generic.c kasan: better invalid/double-free report header 2022-10-03 14:03:02 -07:00
report_hw_tags.c kasan: simplify kasan_find_first_bad_addr call sites 2022-03-24 19:06:49 -07:00
report_sw_tags.c kasan: simplify kasan_find_first_bad_addr call sites 2022-03-24 19:06:49 -07:00
report_tags.c kasan: better invalid/double-free report header 2022-10-03 14:03:02 -07:00
report.c kasan: better invalid/double-free report header 2022-10-03 14:03:02 -07:00
shadow.c UML: add support for KASAN under x86_64 2022-07-17 23:35:22 +02:00
sw_tags.c kasan: support kasan.stacktrace for SW_TAGS 2022-10-03 14:03:01 -07:00
tags.c kasan: dynamically allocate stack ring entries 2022-10-03 14:03:02 -07:00