about summary refs log tree commit diff
path: root/NEWS
diff options
context:
space:
mode:
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>2023-08-24 13:42:17 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-09-05 13:08:48 -0300
commitce2bfb856987526c2f27fb934b5eedd70d3472d7 (patch)
tree8ed44c62c873017fea57dcabb55b0d3eda0550a3 /NEWS
parentad77b1bcca2499f422528c0af4b6f5565512d8bd (diff)
downloadglibc-ce2bfb856987526c2f27fb934b5eedd70d3472d7.tar.gz
glibc-ce2bfb856987526c2f27fb934b5eedd70d3472d7.tar.xz
glibc-ce2bfb856987526c2f27fb934b5eedd70d3472d7.zip
linux: Add posix_spawnattr_{get, set}cgroup_np (BZ 26371)
These functions allow to posix_spawn and posix_spawnp to use
CLONE_INTO_CGROUP with clone3, allowing the child process to
be created in a different cgroup version 2.  These are GNU
extensions that are available only for Linux, and also only
for the architectures that implement clone3 wrapper
(HAVE_CLONE3_WRAPPER).

To create a process on a different cgroupv2, one can use the:

  posix_spawnattr_t attr;
  posix_spawnattr_init (&attr);
  posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETCGROUP);
  posix_spawnattr_setcgroup_np (&attr, cgroup);
  posix_spawn (...)

Similar to other posix_spawn flags, POSIX_SPAWN_SETCGROUP control
whether the cgroup file descriptor will be used or not with
clone3.

There is no fallback if either clone3 does not support the flag
or if the architecture does not provide the clone3 wrapper, in
this case posix_spawn returns EOPNOTSUPP.

Checked on x86_64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Diffstat (limited to 'NEWS')
-rw-r--r--NEWS6
1 files changed, 6 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 1d9ce09488..0b9a247241 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,12 @@ Major new features:
   and under Linux a spare has been allocated: it was always zero
   in previous versions of glibc, and zero is not a valid result.
 
+* On Linux, the functions posix_spawnattr_getcgroup_np and
+  posix_spawnattr_setcgroup_np have been added, along with the
+  POSIX_SPAWN_SETCGROUP flag.  They allow posix_spawn and posix_spawnp
+  to set the cgroupv2 in the new process in a race-free manner.  These
+  functions are GNU extensions and require a kernel with clone3 support.
+
 Deprecated and removed features, and other changes affecting compatibility:
 
   [Add deprecations, removals and changes affecting compatibility here]