Re: [PATCH] binfmt: turn MAX_ARG_PAGES into a sysctl tunable

Ingo Molnar
2006-06-27T11:14:48Z

* Linus Torvalds <torvalds@osdl.org> wrote:

> On Tue, 27 Jun 2006, Ingo Molnar wrote:
> >
> > i thought about your "map execve pages directly into target" (since the
> > source gets destroyed anyway) suggestion back then, and unfortunately it
> > gets quite complex.
>
> No, you misunderstood.
>
> I wasn't actually suggesting mapping pages directly from the source
> into the destination. That is indeed horribly horribly complicated.

ok, that's good news :-)

> - And the whole reason for having a limited array basically goes away
> (the swappable thing is part of it, but the fact that the page
> tables themselves are just a lot more extensible than the silly
> array is just fundamentally a part of it too)
>
> So it's literally just the array I'd get rid of. Instead of insertign
> the page into the array, just insert it directly into the page table
> with "install_arg_page()".

ok, but there are a few logistical issues:

at copy_strings_kernel() time we dont yet know where in the target VM to
install the pages. A binformat might want to install all sorts of stuff
on the stack first, before it constructs the envp and copies the strings
themselves. So we dont know the precise alignment needed.

delaying the copying to setup_arg_pages() time does not seem to work
either, because that gets called after the old MM has been destroyed.

[ delaying the copying will also change behavior in error cases -
instead of returning with an error if the string pointers are bad
we'll have to kill the execve()ing process. ]

am i missing something?

Ingo