[PATCH] backport v2.6 elf_core_dump() flaw fix (CAN-2005-1263)

Linux Kernel Mailing List <[email protected]> Thu, 12 May 2005 12:08:33 +0000
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1515, 2005/05/12 09:08:33-03:00, [email protected]

	[PATCH] backport v2.6 elf_core_dump() flaw fix (CAN-2005-1263)
	
	Backport of 2.6 fix for elf core dump issue reported by
	Paul Starzetz <[email protected]>.
	
	Reference: CAN-2005-1263
	
	Signed-off-by: Chris Wright <[email protected]>



 binfmt_elf.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff -Nru a/fs/binfmt_elf.c b/fs/binfmt_elf.c
--- a/fs/binfmt_elf.c	2005-05-12 15:03:06 -07:00
+++ b/fs/binfmt_elf.c	2005-05-12 15:03:06 -07:00
@@ -222,7 +222,7 @@
 	}
 
 	__put_user((elf_addr_t)argc,--sp);
-	current->mm->arg_start = (unsigned long) p;
+	current->mm->arg_start = current->mm->arg_end = (unsigned long) p;
 	while (argc-->0) {
 		__put_user((elf_caddr_t)(unsigned long)p,argv++);
 		len = strnlen_user(p, PAGE_SIZE*MAX_ARG_PAGES);
@@ -1159,7 +1159,7 @@
 	/* first copy the parameters from user space */
 	memset(&psinfo, 0, sizeof(psinfo));
 	{
-		int i, len;
+		unsigned int i, len;
 
 		len = current->mm->arg_end - current->mm->arg_start;
 		if (len >= ELF_PRARGSZ)