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: <b595166b7ece013b371c2bac1098533f1ffa12d0.1743438749.git.namcao@linutronix.de>
Date: Mon, 31 Mar 2025 18:50:42 +0200
From: Nam Cao <namcao@...utronix.de>
To: Christian Brauner <brauner@...nel.org>
Cc: Shuah Khan <shuah@...nel.org>,
	John Ogness <john.ogness@...utronix.de>,
	linux-kselftest@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Nam Cao <namcao@...utronix.de>
Subject: [PATCH 1/3] selftests: coredump: Properly initialize pointer

The buffer pointer "line" is not initialized. This pointer is passed to
getline().

It can still work if the stack is zero-initialized, because getline() can
work with a NULL pointer as buffer.

But this is obviously broken. This bug shows up while running the test on a
riscv64 machine.

Fix it by properly initializing the pointer.

Fixes: 15858da53542 ("selftests: coredump: Add stackdump test")
Signed-off-by: Nam Cao <namcao@...utronix.de>
---
 tools/testing/selftests/coredump/stackdump_test.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/coredump/stackdump_test.c b/tools/testing/selftests/coredump/stackdump_test.c
index 137b2364a082..1dc54e128586 100644
--- a/tools/testing/selftests/coredump/stackdump_test.c
+++ b/tools/testing/selftests/coredump/stackdump_test.c
@@ -100,6 +100,8 @@ TEST_F(coredump, stackdump)
 	FILE *file;
 	pid_t pid;
 
+	line = NULL;
+
 	/*
 	 * Step 1: Setup core_pattern so that the stackdump script is executed when the child
 	 * process crashes
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ