]> git.baikalelectronics.ru Git - kernel.git/commit
mm, kfence: support kmem_dump_obj() for KFENCE objects
authorMarco Elver <elver@google.com>
Fri, 15 Apr 2022 02:13:40 +0000 (19:13 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Apr 2022 21:49:55 +0000 (14:49 -0700)
commitcc2836a7cfe338f5b5b6d893f38cb9f323c8227e
tree9194074ed5008747db7b6a0aed068751d8b50b20
parent3e3997e5614054e4979595cca8e98b50fa49e95e
mm, kfence: support kmem_dump_obj() for KFENCE objects

Calling kmem_obj_info() via kmem_dump_obj() on KFENCE objects has been
producing garbage data due to the object not actually being maintained
by SLAB or SLUB.

Fix this by implementing __kfence_obj_info() that copies relevant
information to struct kmem_obj_info when the object was allocated by
KFENCE; this is called by a common kmem_obj_info(), which also calls the
slab/slub/slob specific variant now called __kmem_obj_info().

For completeness, kmem_dump_obj() now displays if the object was
allocated by KFENCE.

Link: https://lore.kernel.org/all/20220323090520.GG16885@xsang-OptiPlex-9020/
Link: https://lkml.kernel.org/r/20220406131558.3558585-1-elver@google.com
Fixes: b723e76453c7 ("mm, kfence: insert KFENCE hooks for SLUB")
Fixes: 03ab8f193f9c ("mm, kfence: insert KFENCE hooks for SLAB")
Signed-off-by: Marco Elver <elver@google.com>
Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz> [slab]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/kfence.h
mm/kfence/core.c
mm/kfence/kfence.h
mm/kfence/report.c
mm/slab.c
mm/slab.h
mm/slab_common.c
mm/slob.c
mm/slub.c