linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Szabolcs Nagy <nsz-4P1ElwuDYu6sTnJN9+BGXg@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	"linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	libc-alpha <libc-alpha-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org>,
	shawn Landden <shawn-01I/ocv1qBBILuwUvNxBeQ@public.gmane.org>
Subject: Re: For review: nptl(7) man page
Date: Fri, 24 Jul 2015 09:56:21 +0200	[thread overview]
Message-ID: <55B1EFA5.9000304@gmail.com> (raw)
In-Reply-To: <20150322195632.GM16260-4P1ElwuDYu6sTnJN9+BGXg@public.gmane.org>

On 03/22/2015 08:56 PM, Szabolcs Nagy wrote:
> * Michael Kerrisk (man-pages) <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> [2015-03-22 15:38:44 +0100]:
>> .\"
>> .TH NPTL 7 2015-03-21 "Linux" "Linux Programmer's Manual"
>> .SH NAME
>> nptl \- Native POSIX Threads Library
>> .SH DESCRIPTION
>> NPTL (Native POSIX Threads Library)
>> is the GNU C library POSIX threads implementation that is used on modern
>> Linux systems.
>> .\"
>> .SS NPTL and signals
>> NPTL makes internal use of the first two real-time signals
>> (signal numbers 32 and 33).
>> One of these signals is used to support thread cancellation and POSIX timers;
>> the other is used as part of a mechanism that ensures all threads in
>> a process always have the same UIDs and GIDs, as required by POSIX.
>> These signals cannot be used in applications.
>>
>> To prevent accidental use of these signals in applications,
>> which might interfere with the operation of the NPTL implementation,
>> various glibc library functions and system call wrapper functions
>> attempt to hide these signals from applications,
>> as follows:
>> .IP * 3
>> .B SIGRTMIN
>> is defined with the value 34 (rather than 32).
>> .IP *
>> The
>> .BR sigwaitinfo (2),
>> .BR sigtimedwait (2),
>> and
>> .BR sigwait (3)
>> interfaces silently ignore requests to wait for these two signals
>> if they are specified in the signal set argument of these calls.
>> .IP *
>> The
>> .BR sigprocmask (2)
>> and
>> .BR pthread_sigmask (3)
>> interfaces silently ignore attempts to block these two signals.
>> .IP *
>> The
>> .BR sigaction (2),
>> .BR pthread_kill (3),
>> and
>> .BR pthread_sigqueue (3)
>> interfaces fail with the error
>> .B EINVAL
>> (indicating an invalid signal number) if these signals are specified.
>> .IP *
>> .BR sigfillset (3)
>> does not include these two signals when it creates a full signal set.
>> .\"
> 
> are these abi details expected to be stable?
> (i'm not against documenting the existing
> implementation just curious if this is supposed
> to hold for all new archs)

I'm not sure, sorry.

> in theory for an application it is enough to know
> that it can only use the signals it can name and
> there might be implementation internal signals
> that cannot be masked (which might need to be taken
> into account when calculating a thread stack size).
> 
>> .SS 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.
>>
>> The implementation of each of these system calls involves the use of 
>> a real-time signal that is sent (using
>> .BR tgkill (2))
>> to each of the other threads that must change change its credentials.
>> Before sending these signals, the thread that is changing credentials
>> saves the new credential(s) and records the system call being employed
>> in a global buffer.
>> A signal handler in the receiving thread(s) fetches this information and
>> then uses the same system call to change its credentials.
>>
> 
> i think the situation described in
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=14749
> 
> might be worth documenting
> 
> vfork is not serialized wrt setxid functions

Do you have any proposed text for this? (In the meantime, I added a FIXME.)

> (but it would be better if the kernel got fixed
> to have a new set of posix setxid syscalls that
> change credentials atomically for the process)

Cheers,

Michael



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-07-24  7:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-22 14:38 For review: nptl(7) man page Michael Kerrisk (man-pages)
     [not found] ` <550ED3F4.1080403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-22 15:51   ` Bert Wesarg
     [not found]     ` <CAKPyHN2VTcP3eOPA-er+iOs0VCRd4ALzuqPY4HJOVOmDH7Arug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-22 19:02       ` Michael Kerrisk (man-pages)
2015-03-22 19:56 ` Szabolcs Nagy
     [not found]   ` <20150322195632.GM16260-4P1ElwuDYu6sTnJN9+BGXg@public.gmane.org>
2015-07-24  7:56     ` Michael Kerrisk (man-pages) [this message]
2015-03-22 21:38 ` Nicholas Miell
     [not found]   ` <550F363B.801-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-07-24  7:57     ` Michael Kerrisk (man-pages)
     [not found]       ` <CAODz2cDq4o85NOzqCDg9cH8eCvqt3Tq5QXKMMJtXbik5h5bL+Q@mail.gmail.com>
     [not found]         ` <CAODz2cDq4o85NOzqCDg9cH8eCvqt3Tq5QXKMMJtXbik5h5bL+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-26 20:24           ` Michael Kerrisk (man-pages)
2015-07-26 20:27             ` Nicholas Miell
     [not found]               ` <CAODz2cAmqVtkoNSwUA5p0_=pcFAdrS3ovohyjwnXMapgEhc4qg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-26 20:29                 ` Michael Kerrisk (man-pages)
     [not found]             ` <55B54215.6070502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-08-03 15:45               ` Torvald Riegel
2015-08-03 20:08                 ` Rich Felker
2015-08-04 15:06                   ` Roland McGrath
     [not found]                     ` <20150804150648.9E9F42C3B01-j1d2VQoJOwwHfwO+Tb3JRVaTQe2KTcn/@public.gmane.org>
2015-08-04 18:50                       ` Nicholas Miell
     [not found]                         ` <3848244D-C3FE-4FD1-B137-AF7AD6252659-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-08-05  9:36                           ` Torvald Riegel
     [not found]                             ` <1438767393.20974.211.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2015-08-05 18:14                               ` Nicholas Miell
     [not found]                                 ` <BCB9D422-563C-4317-B0CB-B14001FE0EA3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-08-05 18:23                                   ` Rich Felker
     [not found]                                     ` <20150805182327.GA14639-C3MtFaGISjmo6RMmaWD+6Sb1p8zYI1N1@public.gmane.org>
2015-08-05 18:59                                       ` Michael Kerrisk (man-pages)
     [not found]                                         ` <55C25D2B.4040905-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-08-05 19:46                                           ` Rich Felker
2015-08-06 10:06                                             ` Michael Kerrisk (man-pages)
     [not found]                                               ` <55C3319A.7020408-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-08-06 13:54                                                 ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B1EFA5.9000304@gmail.com \
    --to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=libc-alpha-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nsz-4P1ElwuDYu6sTnJN9+BGXg@public.gmane.org \
    --cc=shawn-01I/ocv1qBBILuwUvNxBeQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).