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 <[email protected]> --- 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);
Attachment:
signature.asc
Description: Toto je =?iso-8859-2?Q?digit=E1ln=EC?= =?ISO-8859-1?Q?_podepsan=E1?= =?iso-8859-2?Q?_=E8=E1st?= =?ISO-8859-1?Q?_zpr=E1vy?=
- Follow-Ups:
- Re: [PATCH] free pages in remove_arg_zero()
- From: Andrew Morton <[email protected]>
- Re: [PATCH] free pages in remove_arg_zero()
- Prev by Date: Re: [PATCH 1/3] net/bridge/br_if.c: don't use _WORK_NAR
- Next by Date: Re: [PATCH] free swap space when (re)activating page
- Previous by thread: 2.6.18.7 OK, 2.6.19.4 & 2.6.20 & 2.6.20.1 NOT
- Next by thread: Re: [PATCH] free pages in remove_arg_zero()
- Index(es):