linux-embedded.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: linux-embedded@vger.kernel.org
Subject: execve(NULL, argv, envp) for nommu?
Date: Tue, 5 Sep 2017 02:34:53 -0500	[thread overview]
Message-ID: <324c00d9-06a6-1fc5-83fe-5bd36d874501@landley.net> (raw)

For years I've wanted an execve() system call modification that let me
pass a NULL as the first argument to say "re-exec this program please".
Because on nommu you've got to exec something to unblock vfork(), and
daemons (or things like busybox and toybox) want to re-exec themselves.
I just hit this again trying to implement a nommu-friendly strace(): the
one on github doesn't SIGSTOP the child before the execve() of the
process to trace because vfork(), and just races and misses the first
few system calls on nommu instead...)

The problem with exec /proc/self/exe is A) I haven't necessarily got
/proc mounted, B) in a chroot the original binary might not be in scope
anymore. But I'm already _running_ this program. If I could fork() I
could already get a second copy of the sucker and call main() again
myself if necessary, but I can't, so...

I'm aware there's a possible "but what if it was suid and it's already
dropped privileges" argument, and I'm fine with execve(NULL) not
honoring the suid bit if people feel that way. I just wanna unblock
vfork() while still running this code. (A way to detect I did this would
be great too, but the normal tweaking of argv[] or envp[] to let main
know we're a child still works.)

Is there a _reason_ the kernel doesn't do this, or has nobody bothered
to code it up yet?

Rob

             reply	other threads:[~2017-09-05  7:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-05  7:34 Rob Landley [this message]
2017-09-05  9:00 ` execve(NULL, argv, envp) for nommu? Geert Uytterhoeven
2017-09-05 13:24   ` Alan Cox
2017-09-06  1:12     ` Rob Landley
2017-09-08 21:18       ` Rob Landley
2017-09-11 15:15         ` Oleg Nesterov
2017-09-12 10:48           ` Rob Landley
2017-09-12 11:30             ` Geert Uytterhoeven
2017-09-12 13:45               ` Rob Landley
2017-09-13 19:33                 ` Alan Cox
2017-09-12 15:45             ` Oleg Nesterov
2017-09-13 14:20               ` Oleg Nesterov
2017-09-11 18:14       ` Alan Cox

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=324c00d9-06a6-1fc5-83fe-5bd36d874501@landley.net \
    --to=rob@landley.net \
    --cc=linux-embedded@vger.kernel.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).