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-next>] [day] [month] [year] [list]
Message-Id: <20251125082420.856030-1-hehuiwen@kylinos.cn>
Date: Tue, 25 Nov 2025 16:24:20 +0800
From: Huiwen He <hehuiwen@...inos.cn>
To: Jens Axboe <axboe@...nel.dk>
Cc: Steven Rostedt <rostedt@...dmis.org>,
	Masami Hiramatsu <mhiramat@...nel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	linux-block@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-trace-kernel@...r.kernel.org,
	Huiwen He <hehuiwen@...inos.cn>
Subject: [PATCH] blk-trace: Fix potential buffer overflow in blk_trace_setup()

The legacy struct blk_user_trace_setup has a 32-byte name field,
while buts2->name is a 64-byte buffer (BLKTRACE_BDEV_SIZE2).

Since commit 113cbd62824a ("blktrace: pass blk_user_trace2 to setup
functions"), blk_trace_setup() copied buts2->name into buts->name
using strcpy(). strcpy() performs no bounds checking on the destination
buffer, which can overflow if the source string exceeds 31 characters.

Replace deprecated [1] strcpy() with strscpy() to ensure proper bounds
checking and prevent potential buffer overflow.

Link: https://github.com/KSPP/linux/issues/88 [1]

Fixes: 113cbd62824a ("blktrace: pass blk_user_trace2 to setup functions")
Signed-off-by: Huiwen He <hehuiwen@...inos.cn>
---
 kernel/trace/blktrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index d031c8d80be4..50460e2e7212 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -793,7 +793,7 @@ int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
 		return PTR_ERR(bt);
 	}
 	blk_trace_setup_finalize(q, name, 1, bt, &buts2);
-	strcpy(buts.name, buts2.name);
+	strscpy(buts.name, buts2.name);
 	mutex_unlock(&q->debugfs_mutex);
 
 	if (copy_to_user(arg, &buts, sizeof(buts))) {
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ