On Wednesday 18 October 2006 20:37, Jeff Dike wrote:
> On Tue, Oct 17, 2006 at 11:27:11PM +0200, Paolo 'Blaisorblade' Giarrusso 
wrote:
> > 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 
UML.

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
http://www.user-mode-linux.org/~blaisorblade
Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to