[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1171978145.22720.21.camel@golias.tesarici.cz>
Date: Tue, 20 Feb 2007 14:29:04 +0100
From: Petr Tesařík <ptesarik@...e.cz>
To: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc: Andrew Morton <akpm@...l.org>
Subject: [PATCH] free pages in remove_arg_zero()
Hello,
I've found a bug when executing scripts:
When a script is loaded, load_script() replaces argv[0] with the
name of the interpreter and the filename passed to the exec syscall.
However, there is no guarantee that the length of the interpreter
name plus the length of the filename is greater than the length of
the original argv[0]. If the difference happens to cross a page boundary,
setup_arg_pages() will call install_arg_page() with an address outside
the VMA.
Therefore, remove_arg_zero() must free all pages which would be unused
after the argument is removed.
Signed-off-by: Petr Tesarik <ptesarik@...e.cz>
--- linux-sles9.orig/fs/exec.c
+++ linux-sles9/fs/exec.c
@@ -1000,6 +1000,8 @@ void remove_arg_zero(struct linux_binprm
continue;
offset = 0;
kunmap_atomic(kaddr, KM_USER0);
+ __free_page(page);
+ bprm->page[bprm->p/PAGE_SIZE - 1] = NULL;
inside:
page = bprm->page[bprm->p/PAGE_SIZE];
kaddr = kmap_atomic(page, KM_USER0);
Download attachment "signature.asc" of type "application/pgp-signature" (190 bytes)
Powered by blists - more mailing lists