From: Blaisorblade <blaisorblade@yahoo.it>
To: Jeff Dike <jdike@addtoit.com>
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org,
user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] [PATCH 04/10] uml: make execvp safe for our usage
Date: Sat, 21 Oct 2006 02:11:28 +0200 [thread overview]
Message-ID: <200610210211.28502.blaisorblade@yahoo.it> (raw)
In-Reply-To: <20061018183707.GB6566@ccure.user-mode-linux.org>
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
next prev parent reply other threads:[~2006-10-21 0:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-17 21:19 [PATCH 00/10] Various UML patches for 2.6.19 Paolo 'Blaisorblade' Giarrusso
2006-10-17 21:27 ` [PATCH 01/10] uml: remove some leftover PPC code Paolo 'Blaisorblade' Giarrusso
2006-10-17 21:27 ` [PATCH 02/10] uml: split memory allocation prototypes out of user.h Paolo 'Blaisorblade' Giarrusso
2006-10-17 21:27 ` [PATCH 03/10] uml: fix prototypes Paolo 'Blaisorblade' Giarrusso
2006-10-18 18:32 ` [uml-devel] " Jeff Dike
2006-10-21 1:42 ` Blaisorblade
2006-10-17 21:27 ` [PATCH 04/10] uml: make execvp safe for our usage Paolo 'Blaisorblade' Giarrusso
2006-10-18 18:37 ` [uml-devel] " Jeff Dike
2006-10-21 0:11 ` Blaisorblade [this message]
2006-10-25 15:10 ` Jeff Dike
2006-10-21 1:16 ` Blaisorblade
2006-10-17 21:27 ` [PATCH 05/10] uml: code convention cleanup of a file Paolo 'Blaisorblade' Giarrusso
2006-10-17 21:27 ` [PATCH 06/10] uml: reenable compilation of enable_timer, disabled by mistake Paolo 'Blaisorblade' Giarrusso
2006-10-17 21:27 ` [PATCH 07/10] uml: use DEFCONFIG_LIST to avoid reading host's config Paolo 'Blaisorblade' Giarrusso
2006-10-17 21:27 ` [PATCH 08/10] uml: cleanup run_helper() API to fix a leak Paolo 'Blaisorblade' Giarrusso
2006-10-17 21:27 ` [PATCH 09/10] uml: kconfig - silence warning Paolo 'Blaisorblade' Giarrusso
2006-10-17 21:27 ` [PATCH 10/10] uml: mmapper - remove just added but wrong "const" attribute Paolo 'Blaisorblade' Giarrusso
2006-10-18 18:41 ` [uml-devel] [PATCH 00/10] Various UML patches for 2.6.19 Jeff Dike
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200610210211.28502.blaisorblade@yahoo.it \
--to=blaisorblade@yahoo.it \
--cc=akpm@osdl.org \
--cc=jdike@addtoit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox