* vfork(2) behavior not consistent with fork(2) (was: vfork(2) fails after unshare(CLONE_NEWTIME) (was: [Bug 215769] man 2 vfork() does not document corner case when PID == 1))
[not found] ` <20220406084613.3srklyt27qxcmrcx@wittgenstein>
@ 2022-04-06 19:22 ` Alejandro Colomar
2022-04-06 19:26 ` vfork(2) behavior not consistent with fork(2) Florian Weimer
0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Colomar @ 2022-04-06 19:22 UTC (permalink / raw)
To: Christian Brauner, Florian Weimer, Michael Kerrisk
Cc: linux-kernel,
Коренберг Марк,
Andrei Vagin, Dmitry Safonov, Thomas Gleixner, Arnd Bergmann,
Serge Hallyn, bugzilla-daemon, linux-api
> $ sudo ./vfork_newpid
> vfork_newpid: PID: 8479
> vfork_newpid: PID 8479 exiting after execve(2): Success
> print_pid: PID 1 exiting.
I definitely think this is a kernel (or glibc) bug.
execve(2) is supposed to _never_ return 0 (and errno 0).
I submitted a new bug to discuss it.
Please see <https://bugzilla.kernel.org/show_bug.cgi?id=215813>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: vfork(2) behavior not consistent with fork(2)
2022-04-06 19:22 ` vfork(2) behavior not consistent with fork(2) (was: vfork(2) fails after unshare(CLONE_NEWTIME) (was: [Bug 215769] man 2 vfork() does not document corner case when PID == 1)) Alejandro Colomar
@ 2022-04-06 19:26 ` Florian Weimer
2022-04-06 19:31 ` [Bug 215813] syscall(SYS_vfork) causes execve() to return 0. (was: vfork(2) behavior not consistent with fork(2)) Alejandro Colomar
0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2022-04-06 19:26 UTC (permalink / raw)
To: Alejandro Colomar
Cc: Christian Brauner, Michael Kerrisk, linux-kernel,
Коренберг Марк,
Andrei Vagin, Dmitry Safonov, Thomas Gleixner, Arnd Bergmann,
Serge Hallyn, bugzilla-daemon, linux-api
* Alejandro Colomar:
>> $ sudo ./vfork_newpid
>> vfork_newpid: PID: 8479
>> vfork_newpid: PID 8479 exiting after execve(2): Success
>> print_pid: PID 1 exiting.
>
>
> I definitely think this is a kernel (or glibc) bug.
> execve(2) is supposed to _never_ return 0 (and errno 0).
> I submitted a new bug to discuss it.
>
> Please see <https://bugzilla.kernel.org/show_bug.cgi?id=215813>
It's not clear if this is valid. The syscall function in glibc does not
protect the on-stack return address against overwriting, so it can't be
used to call SYS_vfork on x86.
Can you reproduce this with a true inline syscall, or the glibc vfork
function (which protects the return address)?
Thanks,
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bug 215813] syscall(SYS_vfork) causes execve() to return 0. (was: vfork(2) behavior not consistent with fork(2))
2022-04-06 19:26 ` vfork(2) behavior not consistent with fork(2) Florian Weimer
@ 2022-04-06 19:31 ` Alejandro Colomar
0 siblings, 0 replies; 3+ messages in thread
From: Alejandro Colomar @ 2022-04-06 19:31 UTC (permalink / raw)
To: Florian Weimer
Cc: Christian Brauner, Michael Kerrisk, linux-kernel,
Коренберг Марк,
Andrei Vagin, Dmitry Safonov, Thomas Gleixner, Arnd Bergmann,
Serge Hallyn, linux-api, bugzilla-daemon
Hi Florian,
On 4/6/22 21:26, Florian Weimer wrote:
> It's not clear if this is valid. The syscall function in glibc does not
> protect the on-stack return address against overwriting, so it can't be
> used to call SYS_vfork on x86.
>
> Can you reproduce this with a true inline syscall, or the glibc vfork
> function (which protects the return address)?
If you tell me how I can call a syscall without the libc wrapper or
syscall(2), sure, I can try :)
If syscall(2) can't be used for certain syscalls, maybe we should
document that.
Thanks,
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-06 21:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <bug-215769-216477@https.bugzilla.kernel.org/>
[not found] ` <bug-215769-216477-to2O9X1Knw@https.bugzilla.kernel.org/>
[not found] ` <4fb02f5f-60f9-42af-ddd5-fe5af877231f@gmail.com>
[not found] ` <20220404080519.pi6izyuop3mmdg2g@wittgenstein>
[not found] ` <ae2cbf67-aace-bc40-418e-7b41873f814a@gmail.com>
[not found] ` <20220406084613.3srklyt27qxcmrcx@wittgenstein>
2022-04-06 19:22 ` vfork(2) behavior not consistent with fork(2) (was: vfork(2) fails after unshare(CLONE_NEWTIME) (was: [Bug 215769] man 2 vfork() does not document corner case when PID == 1)) Alejandro Colomar
2022-04-06 19:26 ` vfork(2) behavior not consistent with fork(2) Florian Weimer
2022-04-06 19:31 ` [Bug 215813] syscall(SYS_vfork) causes execve() to return 0. (was: vfork(2) behavior not consistent with fork(2)) Alejandro Colomar
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).