lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 25 Jul 2011 15:42:47 -0600
From:	Jim Cromie <jim.cromie@...il.com>
To:	jbaron@...hat.com
Cc:	bvanassche@....org, joe@...ches.com, gregkh@...e.de,
	linux-kernel@...r.kernel.org, gnb@...h.org,
	Jim Cromie <jim.cromie@...il.com>
Subject: [PATCH 22/25] dynamic_debug: call ddebug_add_module() on dynamic_debug first.

In dynamic_debug_init(), find the dynamic-debug entries in the debug
section, and call ddebug_add_module on those entries 1st, before
doing all the others.  Doing this activates debug callsites in
dynamic_debug before the functions they're part of are used to
process other modules, making them useful for debugging debug
queries on those modules.  Without this, the debuggability of
queries depends upon whether the module is before or after
dynamic-debug in the __verbose data, ie link order.

Finding the dynamic-debug entries effectively splits the __verbose
data in 2; 1st we mark the found spot and process mark to end
(which starts with dynamic-debug entries), then process start to mark.
Refactor the block-finding code into dynamic_debug_init_helper(),
then call it on the 2 halves of the __verbose data.

Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
 lib/dynamic_debug.c |   53 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 5ec8165..6dbefb7 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -1068,29 +1068,52 @@ static int __init dynamic_debug_init_debugfs(void)
 	return 0;
 }
 
+static int __init dynamic_debug_init_helper(struct _ddebug *start,
+					struct _ddebug *end)
+{
+	struct _ddebug *iter, *block;
+	const char *modname = start->modname;
+	int ret, n = 0;
+
+	for (block = iter = start; iter < end; iter++) {
+		if (strcmp(modname, iter->modname)) {
+			ret = ddebug_add_module(block, n, modname);
+			if (ret)
+				return ret;
+			n = 0;
+			modname = iter->modname;
+			block = iter;
+		}
+		n++;
+	}
+	return ddebug_add_module(block, n, modname);
+}
+
 static int __init dynamic_debug_init(void)
 {
-	struct _ddebug *iter, *iter_start;
+	struct _ddebug *iter;
 	const char *modname = NULL;
 	int ret = 0;
-	int n = 0;
 
 	if (__start___verbose != __stop___verbose) {
+		/* find and process dynamic_debug entries 1st
+		   this might allow activating ddebug_add_module callsites
+		   prior to their use processing other modules. TBI
+		*/
 		iter = __start___verbose;
 		modname = iter->modname;
-		iter_start = iter;
-		for (; iter < __stop___verbose; iter++) {
-			if (strcmp(modname, iter->modname)) {
-				ret = ddebug_add_module(iter_start, n, modname);
-				if (ret)
-					goto out_free;
-				n = 0;
-				modname = iter->modname;
-				iter_start = iter;
-			}
-			n++;
-		}
-		ret = ddebug_add_module(iter_start, n, modname);
+
+		for (; iter < __stop___verbose; iter++)
+			if (!strcmp("dynamic_debug", iter->modname))
+				break;
+
+		ret = dynamic_debug_init_helper(iter, __stop___verbose);
+		if (ret)
+			goto out_free;
+
+		ret = dynamic_debug_init_helper(__start___verbose, iter);
+		if (ret)
+			goto out_free;
 	}
 
 	/* ddebug_query boot param got passed -> set it up */
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ