diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-06-22 10:21:32 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-06-23 10:02:15 +0200 |
commit | 01ab446c35816ac17d63cf3b99367b8016856d5b (patch) | |
tree | b68172c4bb75c6b71e030cc793cf8c24cf75f1c5 /src/basic/raw-clone.h | |
parent | async: stop using threads for asynchronous_close() (diff) | |
download | systemd-01ab446c35816ac17d63cf3b99367b8016856d5b.tar.xz systemd-01ab446c35816ac17d63cf3b99367b8016856d5b.zip |
basic: add comments about raw_clone() calls not supporting threads/malloc in child
Diffstat (limited to 'src/basic/raw-clone.h')
-rw-r--r-- | src/basic/raw-clone.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/basic/raw-clone.h b/src/basic/raw-clone.h index a3b768f826..6de67ab752 100644 --- a/src/basic/raw-clone.h +++ b/src/basic/raw-clone.h @@ -27,6 +27,11 @@ * Additionally, as this function does not pass the ptid, newtls and ctid parameters to the kernel, flags must not * contain CLONE_PARENT_SETTID, CLONE_CHILD_SETTID, CLONE_CHILD_CLEARTID or CLONE_SETTLS. * + * WARNING: 💣 this call (just like glibc's own clone() wrapper) will not synchronize on glibc's malloc + * locks, which means they will be in an undefined state in the child if the parent is + * threaded. This means: the parent must either never use threads, or the child cannot use memory + * allocation itself. This is a major pitfall, hence be careful! 💣 + * * Returns: 0 in the child process and the child process id in the parent. */ static inline pid_t raw_clone(unsigned long flags) { |