]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/kasan: Don't store metadata inside kmalloc object when slub_debug_orig_size is on
authorFeng Tang <feng.tang@intel.com>
Wed, 11 Sep 2024 06:45:31 +0000 (14:45 +0800)
committerVlastimil Babka <vbabka@suse.cz>
Tue, 29 Oct 2024 09:43:23 +0000 (10:43 +0100)
commitfb5eda0dfe2256b468fc4e95207a4df88457274f
treebaf6e79edd6c08dd02fd3f985507a5b1323397f5
parent704573851b51808b45dae2d62059d1d8189138a2
mm/kasan: Don't store metadata inside kmalloc object when slub_debug_orig_size is on

For a kmalloc object, when both kasan and slub redzone sanity check
are enabled, they could both manipulate its data space like storing
kasan free meta data and setting up kmalloc redzone, and may affect
accuracy of that object's 'orig_size'.

As an accurate 'orig_size' will be needed by some function like
krealloc() soon, save kasan's free meta data in slub's metadata area
instead of inside object when 'orig_size' is enabled.

This will make it easier to maintain/understand the code. Size wise,
when these two options are both enabled, the slub meta data space is
already huge, and this just slightly increase the overall size.

Signed-off-by: Feng Tang <feng.tang@intel.com>
Acked-by: Andrey Konovalov <andreyknvl@gmail.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/kasan/generic.c
mm/slab.h
mm/slub.c