posix_spawn(): errno in older glibc versions

Felipe Gasper felipe@felipegasper.com
Mon Mar 4 13:04:00 GMT 2019


> On Mar 4, 2019, at 2:59 AM, Florian Weimer <fweimer@redhat.com> wrote:
> 
> * Felipe Gasper:
> 
>> The clone()d process (which is a CLONE_VFORK) also, per strace, does a
>> whole mess of signal-setting prior to the execve(). This also appears
>> to violate vfork()’s documentation.
> 
> How so?

vfork’s man page says that only _exit or an exec function should follow the vfork in the child process, but I see a bunch of signal-handling calls in the child before the exec.

I guess this is another case of just knowing that it’s ok with the tested versions of Linux’s kernel?

> 
>> Also, at least on the Ubuntu box, posix_spawn()’s man page appears to
>> be incorrect:
>> 
>> -----
>>       The  posix_spawn()  and  posix_spawnp() functions fail only in the case
>>       where the underlying fork(2) or vfork(2) call fails;  in  these  cases,
>>       these functions return an error number, which will be one of the errors
>>       described for fork(2) or vfork(2).
>> -----
>> 
>> From what I see, the clone() clearly succeeds, but it’s the exec’s
>> success/failure that posix_spawn() reports. This is much more useful
>> behavior, IMO--does that just need to make its way into the man page?
> 
> Well, there is the matter of the emulations, where you do not actually
> get a report of the execve error.  I'm not sure to what extent the
> man-pages project intends to cover those.

All the same, the man page makes no mention of the (hugely preferable!) behaviour I’m seeing in the newer glibc.

I’d be happy to file a bug report against the man page but wasn’t successful in finding the repo to verify that the latest version hasn’t addressed this. If you know it off-hand, would you be able to share?

Thank you!

-FG



More information about the Libc-help mailing list