[libc-commits] [libc] [libc] Add <unistd.h> functions for user/group ID management. (PR #220087)
Pavel Labath via libc-commits
libc-commits at lists.llvm.org
Mon Oct 19 03:37:32 PDT 2026
labath wrote:
Hm... I believe the setter functions introduced in this PR are only correct for single-threaded applications. Since the linux kernel stores user credentials on a per-thread basis (and POSIX says this is a process-wide property), implementing these functions correctly requires a broadcast to all threads. For this we need to:
- teach the threading machinery to keep a track of all threads
- reserve a signal and not block it for user requests (and figure out which internal requests ought to block it)
- actually implement the broadcast
This isn't a huge amount of code, but it needs to be done with a steady hand as it deals both with threads and signals simultaneously.
The current implementation is implementation is problematic from a security perspective as a (multithreaded) application could think it has dropped privileges, but in reality it has only done that for one of its threads. I think we ought to at least downgrade these to experimental entrypoints until we can implement them correctly.
https://github.com/llvm/llvm-project/pull/220087
More information about the libc-commits
mailing list