summaryrefslogtreecommitdiffstats
path: root/src/basic/raw-clone.h
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2024-08-28 19:15:10 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-09-01 03:44:39 +0200
commit9517c817472ee295a40b8e732cd7b6fb2b8509a1 (patch)
tree85bb121fca7825a8a8236fddec8c775f3d6f03f8 /src/basic/raw-clone.h
parentdocs/UIDS-GIDS: drop obsolete comment about Fedora (diff)
downloadsystemd-9517c817472ee295a40b8e732cd7b6fb2b8509a1.tar.xz
systemd-9517c817472ee295a40b8e732cd7b6fb2b8509a1.zip
basic/raw-clone: refuse CLONE_PIDFD too
Diffstat (limited to '')
-rw-r--r--src/basic/raw-clone.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/basic/raw-clone.h b/src/basic/raw-clone.h
index 6de67ab752..36202cc0ba 100644
--- a/src/basic/raw-clone.h
+++ b/src/basic/raw-clone.h
@@ -21,11 +21,12 @@
* parameter. Opposed to glibc's clone function, using this function does not set up a separate stack for the child, but
* relies on copy-on-write semantics on the one stack at a common virtual address, just as fork does.
*
- * To obtain copy-on-write semantics, flags must not contain CLONE_VM, and thus CLONE_THREAD and CLONE_SIGHAND (which
- * require CLONE_VM) are not usable.
+ * To obtain copy-on-write semantics, flags must not contain CLONE_VM, and thus CLONE_THREAD and CLONE_SIGHAND
+ * (which require CLONE_VM) are not usable.
*
- * 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.
+ * Additionally, as this function does not pass the ptid (pidfd in the case of CLONE_PIDFD), newtls and ctid
+ * parameters to the kernel, flags must not contain CLONE_PARENT_SETTID, CLONE_CHILD_SETTID, CLONE_CHILD_CLEARTID,
+ * CLONE_SETTLS, or CLONE_PIDFD.
*
* 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
@@ -37,8 +38,7 @@
static inline pid_t raw_clone(unsigned long flags) {
pid_t ret;
- assert((flags & (CLONE_VM|CLONE_PARENT_SETTID|CLONE_CHILD_SETTID|
- CLONE_CHILD_CLEARTID|CLONE_SETTLS)) == 0);
+ assert((flags & (CLONE_VM|CLONE_PARENT_SETTID|CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID|CLONE_SETTLS|CLONE_PIDFD)) == 0);
#if defined(__s390x__) || defined(__s390__) || defined(__CRIS__)
/* On s390/s390x and cris the order of the first and second arguments
* of the raw clone() system call is reversed. */