From: Rob Landley <rob@landley.net>
To: Alan Cox <gnomes@lxorguk.ukuu.org.uk>,
Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Linux Embedded <linux-embedded@vger.kernel.org>,
Oleg Nesterov <oleg@redhat.com>,
dalias@libc.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: execve(NULL, argv, envp) for nommu?
Date: Tue, 5 Sep 2017 20:12:01 -0500 [thread overview]
Message-ID: <ab6e6e8b-7040-a07d-5502-405701182568@landley.net> (raw)
In-Reply-To: <20170905142436.262ed118@alans-desktop>
On 09/05/2017 08:24 AM, Alan Cox wrote:
>>> 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...
>
> You can - ptrace 8)
Oh I can call clone() with various flags and try to fake it myself, it
just won't do what I want. :)
>>> honoring the suid bit if people feel that way. I just wanna unblock
>>> vfork() while still running this code.
>
> Would it make more sense to have a way to promote your vfork into a
> fork when you hit these cases (I appreciate that fork on NOMMU has a much
> higher performance cost as you start having to softmmu copy or swap
> pages).
It's not the performance cost, it's rewriting all the pointers.
Without address translation, copying the existing mappings to a new
range requires finding and adjusting every pointer to the old data,
which you can do for the executable mappings in PIE* binaries, but
tracking down all the pointers on the stack, heap, and in your global
variables? Flaming pain.
Making fork() work on nommu is basically the same problem as making
garbage collection work in C on mmu. Thus those of us who defend vfork()
from the people who don't understand why it exists periodically
suggesting we remove it.
> Alan
Rob
* or FDPIC, which is basically just PIE with 4 individually relocatable
text/data/rodata/bss segments instead of one big mapping you relocate as
a contiguous block; both work on nommu but fdpic can fit into more
fragmented memory, and becauase the segments are independent it lets
nommu share some segments between processes (code+rodata**) without
sharing others (data and bss). That's why nommu can't run normal elf but
can run PIE or FDPIC binaries. Or binflt which is the old a.out version.
** Don't ask me what happens when rodata contains a constant pointer to
a bss or data object. I'm guessing the compiler Does A Thing. Ask Rich
Felker?
next prev parent reply other threads:[~2017-09-06 1:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-05 7:34 execve(NULL, argv, envp) for nommu? Rob Landley
2017-09-05 9:00 ` Geert Uytterhoeven
2017-09-05 13:24 ` Alan Cox
2017-09-06 1:12 ` Rob Landley [this message]
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=ab6e6e8b-7040-a07d-5502-405701182568@landley.net \
--to=rob@landley.net \
--cc=dalias@libc.org \
--cc=geert@linux-m68k.org \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=linux-embedded@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
/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 NNTP newsgroup(s).