debugobjects: Allow debug_obj_descr to be const
authorStephen Boyd <swboyd@chromium.org>
Sat, 15 Aug 2020 00:40:26 +0000 (17:40 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 24 Sep 2020 19:56:24 +0000 (21:56 +0200)
commitaedcade6f4fa9a1e65f327fc42de3fb47660646c
treed0a0555c297faf4a47ef5c42648b98eaaa1e2527
parent805c6d3c19210c90c109107d189744e960eae025
debugobjects: Allow debug_obj_descr to be const

The debugobject core could be slightly harder to corrupt if the
debug_obj_descr would be a pointer to const memory.

Depending on the architecture, const data structures are placed into
read-only memory and thus are harder to corrupt or hijack.

This descriptor is used to fix up stuff like timers and workqueues when
core kernel data structures are busted, so moving the descriptors to
read-only memory will make debugobjects more resilient to something going
wrong and then corrupting the function pointers inside struct
debug_obj_descr.

Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20200815004027.2046113-2-swboyd@chromium.org
include/linux/debugobjects.h
lib/debugobjects.c