From 405930725be58f8dd7b522583fb51fb0af14f0f2 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Sun, 22 Mar 2015 09:42:46 +0100 Subject: [PATCH] getgroups.2: Add discussion of NPTL credential-changing mechanism At the kernel level, credentials (UIDs and GIDs) are a per-thread attribute. NPTL uses a signal-based mechanism to ensure that when one thread changes its credentials, all other threads change credentials to the same values. By this means, the NPTL implementation conforms to the POSIX requirement that the threads in a process share credentials. Reported-by: Shawn Landden Signed-off-by: Michael Kerrisk --- man2/getgroups.2 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/man2/getgroups.2 b/man2/getgroups.2 index 15a937c3a..1ef73e967 100644 --- a/man2/getgroups.2 +++ b/man2/getgroups.2 @@ -1,4 +1,5 @@ .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) +.\" and Copyright (C) 2008, 2010, 2015, Michael Kerrisk .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this @@ -187,6 +188,21 @@ supporting 32-bit IDs. The glibc .BR getgroups () wrapper function transparently deals with the variation across kernel versions. +.\" +.SS C library/kernel ABI differences +At the kernel level, user IDs and group IDs are a per-thread attribute. +However, POSIX requires that all threads in a process +share the same credentials. +The NPTL threading implementation handles the POSIX requirements by +providing wrapper functions for +the various system calls that change process UIDs and GIDs. +These wrapper functions (including the one for +.BR setgroups ()) +employ a signal-based technique to ensure +that when one thread changes credentials, +all of the other threads in the process also change their credentials. +For details, see +.BR nptl (7). .SH SEE ALSO .BR getgid (2), .BR setgid (2),