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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed, 24 Jul 2013 23:30:50 +0200
From:	Daniel Nilsson <daniel@...l.se>
To:	viro@...iv.linux.org.uk
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	Daniel Nilsson <daniel@...l.se>
Subject: [PATCH] VFS: Prevent core dump with core_pattern set to empty string

If the core_pattern (proc/sys/core_pattern) is set to an empty string
a core dump is still made but to a file with a filename set by an
uninitialized buffer in format_corename(). This patch fixes the use of the
uninitialized buffer and also aborts the core dump with a warning message
when core_pattern is set to an empty string.

Tested and developed against 3.11-rc2

Signed-off-by: Daniel Nilsson <daniel@...l.se>
---
 fs/coredump.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/fs/coredump.c b/fs/coredump.c
index 72f816d..5035402 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -170,6 +170,11 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm)
 	if (ispipe)
 		++pat_ptr;
 
+	if (*pat_ptr == '\0') {
+		err = cn_printf(cn, "");
+		goto out;
+	}
+
 	/* Repeat as long as we have more pattern to process and more output
 	   space */
 	while (*pat_ptr) {
@@ -617,6 +622,13 @@ void do_coredump(siginfo_t *siginfo)
 			goto fail_unlock;
 		}
 
+		if (cn.corename[0] == '\0') {
+			printk(KERN_WARNING
+			       "core_pattern contains an empty string!\n");
+			printk(KERN_WARNING "Skipping core dump\n");
+			goto fail_unlock;
+		}
+
 		cprm.file = filp_open(cn.corename,
 				 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag,
 				 0600);
-- 
1.7.9.5

--
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