public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mztyvop at 0pointer dot net" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug libc/26371] New: [RFE] please add clone3() wrapper (in particular the CLONE_INTO_CGROUP feature of it) Date: Tue, 11 Aug 2020 10:24:23 +0000 [thread overview] Message-ID: <bug-26371-131@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=26371 Bug ID: 26371 Summary: [RFE] please add clone3() wrapper (in particular the CLONE_INTO_CGROUP feature of it) Product: glibc Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: mztyvop at 0pointer dot net CC: drepper.fsp at gmail dot com Target Milestone: --- In systemd we'd really like to make use of the new CLONE_INTO_CGROUP kernel feature available for clone3(). It would allows us removing some really ugly code in systemd: right now whenever PID 1 forks off a service process we manually migrate the process into the destination cgroup and we do this twice (once from the parent/PID 1 and once from the child, since we need to be sure the migration is complete before we continue in either). Unfortunately I don't see how we can properly make use of this in systemd, without glibc providing some form of support for clone3() for us. The problem is that if we issue clone3() with our own wrapper, glibc won't know about the call. Then, when in the child we issue setgroups(), setuid() and so on, the setxuid propagation stuff in glibc tries to propagate these credential changes to other threads — threads that don't actually exist in the child... Since issuing setuid() in some form is very typical during service invocation this means this pretty systematically deadlocks if we use clone3(). And that sucks. I am not aware of any work-around for this: we cannot tell glibc that a clone/fork has happened, we cannot tell glibc that all threads that existed in the parent suddenly vanished. Hence, it would be great if glibc would gain a clone3() wrapper. Or alternatively some way how we can turn off setxid propagation in the child? Or some way to tell glibc that a clone/fork/clone3 happened and it should forget about all its thread info? Here's a systemd PR that implements things in systemd with a manual wrapper for clone3(), and that then triggers the setxid deadlock as mentioned in the child: https://github.com/systemd/systemd/pull/16706 Ideas, suggestions how to deal with this with current glibc would be very welcome. I'd be quite sad if we'd have to wait for glibc() to wrap clone3() natively to make use of this new concept. -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2020-08-11 10:24 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-11 10:24 mztyvop at 0pointer dot net [this message] 2020-08-12 13:35 ` [Bug libc/26371] " christian.brauner at ubuntu dot com 2020-08-25 12:39 ` fweimer at redhat dot com 2020-08-25 12:46 ` christian.brauner at ubuntu dot com 2020-08-25 14:57 ` mztyvop at 0pointer dot net 2020-08-25 15:07 ` mztyvop at 0pointer dot net 2020-08-25 15:12 ` mztyvop at 0pointer dot net 2020-09-21 11:38 ` fweimer at redhat dot com 2020-09-21 12:37 ` mztyvop at 0pointer dot net 2020-09-22 9:45 ` fweimer at redhat dot com 2021-06-29 22:40 ` crrodriguez at opensuse dot org 2023-06-01 12:53 ` bluca at debian dot org 2023-06-01 13:24 ` bluca at debian dot org 2023-06-01 18:46 ` carlos at redhat dot com 2023-06-02 0:58 ` sam at gentoo dot org 2023-06-26 11:48 ` bluca at debian dot org 2023-07-03 18:52 ` adhemerval.zanella at linaro dot org 2023-07-03 19:32 ` bluca at debian dot org 2023-09-05 16:11 ` adhemerval.zanella at linaro dot org 2023-09-05 16:20 ` bluca at debian dot org 2024-02-06 10:59 ` bluca at debian dot org 2024-02-06 12:38 ` adhemerval.zanella at linaro dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-26371-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).