]> www.infradead.org Git - users/jedix/linux-maple.git/commit
kasan: improve free meta storage in Generic KASAN
authorJuntong Deng <juntong.deng@outlook.com>
Sun, 19 Nov 2023 20:46:29 +0000 (04:46 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 20 Nov 2023 21:16:44 +0000 (13:16 -0800)
commit3216f7c8d91ada0b63fc59a4e2bb650897e00fa7
tree4f584b5c3a5867d94d0f236abf648d446b64e509
parent3eaa44642de2c975d9674984294567444839c5ee
kasan: improve free meta storage in Generic KASAN

Currently free meta can only be stored in object if the object is not
smaller than free meta.

After the improvement, even when the object is smaller than free meta, it
is still possible to store part of the free meta in the object, reducing
the increased size of the redzone.

Example:

free meta size: 16 bytes
alloc meta size: 16 bytes
object size: 8 bytes
optimal redzone size (object_size <= 64): 16 bytes

Before improvement:
actual redzone size = alloc meta size + free meta size = 32 bytes

After improvement:
actual redzone size = alloc meta size + (free meta size - object size)
                    = 24 bytes

Link: https://lkml.kernel.org/r/VI1P193MB0752DE2CCD9046B5FED0AA8E99B5A@VI1P193MB0752.EURP193.PROD.OUTLOOK.COM
Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
Suggested-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/kasan/generic.c