Skip to content

NamedPipeServerStream RunAsClient changes other thread's euid #24654

@eerhardt

Description

@eerhardt

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/

@ianhays @stephentoub

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.IObacklog-cleanup-candidateAn inactive issue that has been marked for automated closure.documentationDocumentation bug or enhancement, does not impact product or test code

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions