|
Message-ID: <20230530233529.GZ4163@brightrain.aerifal.cx>
Date: Tue, 30 May 2023 19:35:30 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: [PATCH] [RFC] make clone() usable
As discussed before (see the 2021 thread "Incorrect thread TID
caching") clone() has been effectively unusable because it produces a
child process in invalid state, with wrong tid in its thread
structure, among other problems.
The attached proposed patch attempts to make clone() usable by having
it share the _Fork logic for establishing a consistent process state
after forking, and also blocks use of flags which produce invalid
state.
With CLONE_VM, the old behavior is kept, with a caveat that the child
context is extremely restrictive, ala vfork.
It was raised previously (pardon the pun) that raise() should perhaps
be modified to make a SYS_gettid syscall rather than using the thread
structure tid, so that it's possible to call raise() in a vfork
context without signaling the wrong process. It might make sense to do
that now too.
Rich
View attachment "clone.diff" of type "text/plain" (3063 bytes)
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.