[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210529200029.205306-28-jim.cromie@gmail.com>
Date: Sat, 29 May 2021 14:00:22 -0600
From: Jim Cromie <jim.cromie@...il.com>
To: jbaron@...mai.com, gregkh@...uxfoundation.org,
linux-kernel@...r.kernel.org
Cc: Jim Cromie <jim.cromie@...il.com>
Subject: [RFC PATCH v6 27/34] dyndbg: fixup protect header when deleting site
fix a null-ptr-deref when .site info is deleted.
$> echo +D > /proc/dynamic_debug/control
This protects the header.site pointer from zeroing; we need it for all
the SITE_CHK sanity checking. Probably should protect against
toggling the static_key too (in the same function), but this smaller
change fixes the crash.
Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
lib/dynamic_debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 659e864837ad..f2f6f2b20d01 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -247,7 +247,7 @@ static void ddebug_alter_site(struct _ddebug *dp,
#ifdef SITE_CHK
/* delete site info for this callsite */
if (modifiers->flags & _DPRINTK_FLAGS_DELETE_SITE) {
- if (dp->site) {
+ if (dp->site && !is_dyndbg_header_pair(dp, dp->site)) {
vpr_info("dropping site info %s.%s.%d\n", dp->site->filename,
dp->site->function, dp->lineno);
dp->site = NULL;
--
2.31.1
Powered by blists - more mailing lists