|
|
Message-ID: <20251212023438.GM1827@brightrain.aerifal.cx>
Date: Thu, 11 Dec 2025 21:34:38 -0500
From: Rich Felker <dalias@...c.org>
To: Florian Weimer <fweimer@...hat.com>
Cc: Bill Roberts <bill.roberts@....com>, musl@...ts.openwall.com
Subject: Re: [RFC 03/14] aarch64: rewrite vfork routine in C using
inline asm
On Thu, Dec 11, 2025 at 01:09:50PM +0100, Florian Weimer wrote:
> * Bill Roberts:
>
> > diff --git a/src/process/aarch64/vfork.c b/src/process/aarch64/vfork.c
> > new file mode 100644
> > index 00000000..87ec8ebf
> > --- /dev/null
> > +++ b/src/process/aarch64/vfork.c
> > @@ -0,0 +1,21 @@
> > +#include <sys/types.h>
> > +
> > +#include "syscall.h"
> > +
> > +pid_t vfork(void)
> > +{
> > + /* aarch64 Linux syscall: x8 = nr, x0..x5 = args, ret in x0 */
> > + register long x8 __asm__("x8") = 220; /* SYS_clone */
> > + register long x0 __asm__("x0") = 0x4111; /* SIGCHLD | CLONE_VM | CLONE_VFORK */
> > + register long x1 __asm__("x1") = 0; /* arg2 = 0 */
> > +
> > + __asm__ volatile (
> > + "svc 0\n\t"
> > + ".hidden __syscall_ret\n\t"
> > + "b __syscall_ret\n\t"
> > + : "+r"(x0) /* x0 = in/out */
> > + : "r"(x1), "r"(x8) /* inputs */
> > + : "memory", "cc"
> > + );
> > + __builtin_unreachable();
> > +}
>
> This is incompatible with building with -fstack-protector-all, isn't it?
As noted in my reply to the 00/14 cover letter for the patch series, a
number of these are not valid. This one is making a tail call from
inline asm with the stack in unknown state (invalid use of inline
asm), and more fundamentally, vfork cannot be implemented in C.
Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.