summaryrefslogtreecommitdiff
path: root/src/process/aarch64/vfork.s
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2022-07-16 15:55:51 +0200
committerRich Felker <dalias@aerifal.cx>2022-08-01 13:37:39 -0400
commit4f48da008d1fb3ccab2ad76523c104aa3fa8d8b6 (patch)
treebbd789ccc386052dcbf4e8952a31a6a9696e5dfb /src/process/aarch64/vfork.s
parent7d568410b455390362e2bcfb7c50fcf9c8833d9b (diff)
downloadmusl-4f48da008d1fb3ccab2ad76523c104aa3fa8d8b6.tar.gz
aarch64: add vfork
The generic vfork implementation uses clone(SIGCHLD) which has fork semantics. Implement vfork as clone(SIGCHLD|CLONE_VM|CLONE_VFORK, 0) instead which has vfork semantics. (stack == 0 means sp is unchanged in the child.) Some users rely on vfork semantics when memory overcommit is disabled or when the vfork child runs code that synchronizes with the parent process (non-conforming).
Diffstat (limited to 'src/process/aarch64/vfork.s')
-rw-r--r--src/process/aarch64/vfork.s9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/process/aarch64/vfork.s b/src/process/aarch64/vfork.s
new file mode 100644
index 00000000..429bec8c
--- /dev/null
+++ b/src/process/aarch64/vfork.s
@@ -0,0 +1,9 @@
+.global vfork
+.type vfork,%function
+vfork:
+ mov x8, 220 // SYS_clone
+ mov x0, 0x4111 // SIGCHLD | CLONE_VM | CLONE_VFORK
+ mov x1, 0
+ svc 0
+ .hidden __syscall_ret
+ b __syscall_ret