Thread (27 messages) 27 messages, 9 authors, 2007-08-22

Re: [patch 0/3] no MAX_ARG_PAGES -v2

From: Ollie Wild <hidden>
Date: 2007-06-14 20:59:21
Also in: linux-arch, lkml

quoted hunk ↗ jump to hunk
@@ -1385,6 +1401,10 @@ int do_execve(char * filename,
                goto out;
        bprm->argv_len = env_p - bprm->p;

+       retval = expand_arg_vma(bprm);
+       if (retval < 0)
+               goto out;
+
        retval = search_binary_handler(bprm,regs);
        if (retval >= 0) {
                /* execve success */
At this point bprm->argc hasn't been finalized yet.  For example, the
script binfmt reads the script header and adds additional arguments.
The flush_old_exec() function is a better place to call this.

I'm not 100% sure this is the right way to handle this, though.  The
problem isn't as simple as ensuring the stack doesn't overflow during
argument allocation.  We also need to ensure the program has
sufficient stack space to run subsequently.  Otherwise, the observable
behavior is identical.  Since we can't realistically predict
acceptable stack availability requirements, some amount of uncertainty
is always going to exist.  A good heuristic, though, might be to limit
argument size to a percentage (say 25%) of maximum stack size and
validate this inside copy_strings().

Ollie

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help