[PATCH v2 7/8] exec: Generic execfd support
Eric W. Biederman
ebiederm at xmission.com
Fri May 22 03:28:39 UTC 2020
Rob Landley <rob at landley.net> writes:
> On 5/20/20 11:05 AM, Eric W. Biederman wrote:
> Toybox would _like_ proc mounted, but can't assume it. I'm writing a new
> bash-compatible shell with nommu support, which means in order to do subshell
> and background tasks if (!CONFIG_FORK) I need to create a pipe pair, vfork(),
> have the child exec itself to unblock the parent, and then read the context data
> that just got discarded through the pipe from the parent. ("Wheee." And you can
> quote me on that.)
Do you have clone(CLONE_VM) ? If my quick skim of the kernel sources is
correct that should be the same as vfork except without causing the
parent to wait for you. Which I think would remove the need to reexec
yourself.
>> The file descriptor is stored in mm->exe_file.
>> Probably the most straight forward implementation is to allow
>> execveat(AT_EXE_FILE, ...).
>
> Cool, that works.
>
>> You can look at binfmt_misc for how to reopen an open file descriptor.
>
> Added to the todo heap.
Yes I don't think it would be a lot of code.
I think you might be better served with clone(CLONE_VM) as it doesn't
block so you don't need to feed yourself your context over a pipe.
Eric
More information about the Linux-security-module-archive
mailing list