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: <1254542832.5405.6.camel@hurina>
Date:	Sat, 03 Oct 2009 00:07:12 -0400
From:	Timo Sirainen <tss@....fi>
To:	linux-kernel@...r.kernel.org
Subject: [PATCH] proc/pid/cmdline: Handle invalid cmdline change failures
 correctly.

Handle access_process_vm() failures correctly in /proc/pid/cmdline.
This bug might have leaked kernel memory to userspace.

Signed-off-by: Timo Sirainen <tss@....fi>
---
 fs/proc/base.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 837469a..f66cc4c 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -252,7 +252,7 @@ struct mm_struct *mm_for_maps(struct task_struct *task)
 
 static int proc_pid_cmdline(struct task_struct *task, char * buffer)
 {
-	int res = 0;
+	int res = 0, res2;
 	unsigned int len;
 	struct mm_struct *mm = get_task_mm(task);
 	if (!mm)
@@ -277,8 +277,9 @@ static int proc_pid_cmdline(struct task_struct *task, char * buffer)
 			len = mm->env_end - mm->env_start;
 			if (len > PAGE_SIZE - res)
 				len = PAGE_SIZE - res;
-			res += access_process_vm(task, mm->env_start, buffer+res, len, 0);
-			res = strnlen(buffer, res);
+			res2 = access_process_vm(task, mm->env_start, buffer+res, len, 0);
+			if (res2 > 0)
+				res = strnlen(buffer, res + res2);
 		}
 	}
 out_mm:
-- 
1.6.3.3


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