-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
When calling NamedPipeServerStream RunAsClient on Unix, it calls Interop.Sys.SetEUid(peerID)
, which calls the POSIX command seteuid
.
According to the man pages for setreuid and nptl, whenever seteuid
is called, it changes the user for all threads in the process in order to be POSIX compliant.
NPTL and process credential changes
At the Linux kernel level, credentials (user and group IDs) are a
per-thread attribute. However, POSIX requires that all of the POSIX
threads in a process have the same credentials. To accommodate this
requirement, the NPTL implementation wraps all of the system calls
that change process credentials with functions that, in addition to
invoking the underlying system call, arrange for all other threads in
the process to also change their credentials.
Wrapper functions employing this technique are provided for
setgid(2), setuid(2), setegid(2), seteuid(2), setregid(2),
setreuid(2), setresgid(2), setresuid(2), and setgroups(2).
I have a repro of this issue here: https://github.com/eerhardt/NamedPipeRunAsClient/