1NPTL(7)                    Linux Programmer's Manual                   NPTL(7)
2
3
4

NAME

6       nptl - Native POSIX Threads Library
7

DESCRIPTION

9       NPTL  (Native POSIX Threads Library) is the GNU C library POSIX threads
10       implementation that is used on modern Linux systems.
11
12   NPTL and signals
13       NPTL makes internal use of the first two real-time signals (signal num‐
14       bers  32  and 33).  One of these signals is used to support thread can‐
15       cellation and POSIX timers (see timer_create(2)); the other is used  as
16       part  of  a mechanism that ensures all threads in a process always have
17       the same UIDs and GIDs, as required by POSIX.  These signals cannot  be
18       used in applications.
19
20       To prevent accidental use of these signals in applications, which might
21       interfere with the operation of the NPTL implementation, various  glibc
22       library  functions  and  system  call wrapper functions attempt to hide
23       these signals from applications, as follows:
24
25       *  SIGRTMIN is defined with the value 34 (rather than 32).
26
27       *  The  sigwaitinfo(2),  sigtimedwait(2),  and  sigwait(3)   interfaces
28          silently  ignore  requests to wait for these two signals if they are
29          specified in the signal set argument of these calls.
30
31       *  The sigprocmask(2) and pthread_sigmask(3) interfaces silently ignore
32          attempts to block these two signals.
33
34       *  The  sigaction(2),  pthread_kill(3),  and pthread_sigqueue(3) inter‐
35          faces fail with the error EINVAL (indicating an invalid signal  num‐
36          ber) if these signals are specified.
37
38       *  sigfillset(3)  does  not include these two signals when it creates a
39          full signal set.
40
41   NPTL and process credential changes
42       At the Linux kernel level, credentials (user and group IDs) are a  per-
43       thread  attribute.   However,  POSIX  requires  that  all  of the POSIX
44       threads in a process have the same credentials.   To  accommodate  this
45       requirement, the NPTL implementation wraps all of the system calls that
46       change process credentials with functions that, in addition to invoking
47       the  underlying  system  call,  arrange  for  all  other threads in the
48       process to also change their credentials.
49
50       The implementation of each of these system calls involves the use of  a
51       real-time  signal  that  is sent (using tgkill(2)) to each of the other
52       threads that must change its credentials.  Before  sending  these  sig‐
53       nals,  the  thread  that  is changing credentials saves the new creden‐
54       tial(s) and records the system call being employed in a global  buffer.
55       A  signal  handler  in the receiving thread(s) fetches this information
56       and then uses the same system call to change its credentials.
57
58       Wrapper functions employing this technique are provided for  setgid(2),
59       setuid(2),  setegid(2),  seteuid(2),  setregid(2), setreuid(2), setres‐
60       gid(2), setresuid(2), and setgroups(2).
61

CONFORMING TO

63       For details of the conformance of  NPTL  to  the  POSIX  standard,  see
64       pthreads(7).
65

NOTES

67       POSIX  says  that  any  thread in any process with access to the memory
68       containing a process-shared (PTHREAD_PROCESS_SHARED) mutex can  operate
69       on  that  mutex.   However, on 64-bit x86 systems, the mutex definition
70       for x86-64 is incompatible with the mutex definition for i386,  meaning
71       that 32-bit and 64-bit binaries can't share mutexes on x86-64 systems.
72

SEE ALSO

74       credentials(7), pthreads(7), signal(7), standards(7)
75

COLOPHON

77       This  page  is  part of release 4.16 of the Linux man-pages project.  A
78       description of the project, information about reporting bugs,  and  the
79       latest     version     of     this    page,    can    be    found    at
80       https://www.kernel.org/doc/man-pages/.
81
82
83
84Linux                             2015-08-08                           NPTL(7)
Impressum