[lkml]   [2006]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [uml-devel] [PATCH 04/10] uml: make execvp safe for our usage
On Wednesday 18 October 2006 20:37, Jeff Dike wrote:
> On Tue, Oct 17, 2006 at 11:27:11PM +0200, Paolo 'Blaisorblade' Giarrusso
> > Reimplement execvp for our purposes - after we call fork() it is
> > fundamentally unsafe to use the kernel allocator - current is not valid
> > there.
> This is horriby ugly.

Detail why. The code of execvp()? Passing in the buffer?
I'm not saying it's the brightest code around here, but it's ok for me.

> Can we instead do something different like
> check out the paths of helpers at early boot, before the kernel is
> running, save them, and simply execve them later?
I initially thought to design a two-steps API with a "which" operation (where
memory allocation was used) to call later execvp(); when I saw the glibc
implementation (it allocates one single fixed-size buffer) I saw it was
simpler this way.

Additionally, error handling cannot be done properly without trying an exec -
I think it is also ok to drop this execvp semantic, so that if the first
binary found in path is marked executable but has the wrong binary format the
whole thing just does not start.

The current implementation already diverges from glibc - it never calls
directly the shell passing a script, because IMHO execve() will care for that
(and testing confirmed this IIRC).

I'd not do that at boot, but just before the fork()+execve() - it is
conceivable that a given user will install a support binary after booting

I must say that I've seen files without the shebang working ok (if having the
executable bit set) when executed from the shell, and I've had the doubt
execvp() would handle that.

> At that point, something like running "which foo" would be fine by me.

Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade
Chiacchiera con i tuoi amici in tempo reale!*

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-10-21 02:13    [W:0.067 / U:19.100 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site