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]
Message-ID: <20240210235009.2405808-15-ukaszb@chromium.org>
Date: Sun, 11 Feb 2024 00:49:44 +0100
From: Łukasz Bartosik <ukaszb@...omium.org>
To: Jason Baron <jbaron@...mai.com>,
	Jim Cromie <jim.cromie@...il.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Kees Cook <keescook@...omium.org>,
	Douglas Anderson <dianders@...omium.org>
Cc: Guenter Roeck <groeck@...gle.com>,
	Yaniv Tzoreff <yanivt@...gle.com>,
	Benson Leung <bleung@...gle.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Vincent Whitchurch <vincent.whitchurch@...s.com>,
	Pekka Paalanen <ppaalanen@...il.com>,
	Sean Paul <seanpaul@...omium.org>,
	Daniel Vetter <daniel@...ll.ch>,
	Simon Ser <contact@...rsion.fr>,
	John Ogness <john.ogness@...utronix.de>,
	Petr Mladek <pmladek@...e.com>,
	Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
	linux-kernel@...r.kernel.org,
	upstream@...ihalf.com
Subject: [PATCH v4 14/39] dyndbg: update default trace destination on reopen

The change updates default trace destination when a user requests
to open '0' ('0' writes debug logs to global trace-events buffer
/sys/kernel/tracing/trace) or open an already opened trace instance.

Signed-off-by: Łukasz Bartosik <ukaszb@...omium.org>
---
 lib/dynamic_debug.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index f41b0b0c8b47..f91c51234456 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -354,10 +354,21 @@ static void update_tr_default_dst(int trace_dst)
 static int handle_trace_open_cmd(const char *arg)
 {
 	struct dd_private_tracebuf *buf;
-	int idx, ret = 0;
+	int idx = 0, ret = 0;
 
 	mutex_lock(&ddebug_lock);
 
+	/*
+	 * request to open '0' or an already opened trace instance
+	 * results in update of default trace destination
+	 */
+	if (!strcmp(arg, DD_TR_EVENT))
+		goto update;
+
+	idx = find_tr_instance(arg);
+	if (idx >= 0)
+		goto update;
+
 	/* bit 0 is not used, reserved for trace prdbg and devdbg events */
 	idx = find_next_zero_bit(trc_tbl.bmap, trc_tbl.bmap_size, 1);
 	if (idx == trc_tbl.bmap_size) {
@@ -371,12 +382,6 @@ static int handle_trace_open_cmd(const char *arg)
 		goto end;
 	}
 
-	if (find_tr_instance(arg) >= 0) {
-		pr_err("instance is already opened name:%s\n", arg);
-		ret = -EEXIST;
-		goto end;
-	}
-
 	buf = &trc_tbl.buf[idx];
 	buf->name = kstrdup(arg, GFP_KERNEL);
 	if (!buf->name) {
@@ -402,6 +407,7 @@ static int handle_trace_open_cmd(const char *arg)
 	buf->use_cnt = 0;
 	set_bit(idx, trc_tbl.bmap);
 	v3pr_info("opened trace instance idx=%d, name=%s\n", idx, arg);
+update:
 	update_tr_default_dst(idx);
 end:
 	mutex_unlock(&ddebug_lock);
-- 
2.43.0.687.g38aa6559b0-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ