* [PATCH] access.2: explain how access() check treats capabilities
@ 2014-09-10 13:01 Denys Vlasenko
[not found] ` <1410354068-6100-1-git-send-email-dvlasenk-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Denys Vlasenko @ 2014-09-10 13:01 UTC (permalink / raw)
To: Michael Kerrisk; +Cc: Denys Vlasenko, linux-man-u79uwXL29TY76Z2rM5mHXA
We have users who are terribly confused why their binaries
with CAP_DAC_OVERRIDE capability see EACCESS from access() calls,
but are able to read the file.
The reason is access() isn't the "can I read/write/execute this file?"
question, it is the "(assuming that I'm a setuid binary,) can *the user
who invoked me* read/write/execute this file?" question.
That's why it uses real UIDs as documented, and why it ignores
capabilities when capability-endored binaries are run by non-root
(this patch adds this information).
To make users more likely to notice this less-known detail,
the patch expands the explanation with rationale for this logic
into a separate paragraph.
Signed-off-by: Denys Vlasenko <dvlasenk-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
CC: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
man2/access.2 | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/man2/access.2 b/man2/access.2
index bfd85cd..73495ad 100644
--- a/man2/access.2
+++ b/man2/access.2
@@ -102,9 +102,22 @@ The check is done using the calling process's
UID and GID, rather than the effective IDs as is done when
actually attempting an operation (e.g.,
.BR open (2))
-on the file.
-This allows set-user-ID programs to
-easily determine the invoking user's authority.
+on the file. Similarly, for root user, the check uses the set of
+permitted capabilities rather than the set of effective
+capabilities; and for non-root user, the check uses an empty set
+of capabilities.
+
+This allows set-user-ID programs and capability-endowed programs
+to easily determine the invoking user's authority. In other words:
+.BR access ()
+does not answer the "can I read/write/execute this file?" question.
+It answers a bit different question: "(assuming I'm a setuid binary,)
+can
+.I the user who invoked me
+read/write/execute this file?",
+with the intent to make it possible for setuid programs to not
+allow malicious users make them read files which users shouldn't be
+able to read.
If the calling process is privileged (i.e., its real UID is zero),
then an
--
1.8.1.4
--
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
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <1410354068-6100-1-git-send-email-dvlasenk-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] access.2: explain how access() check treats capabilities [not found] ` <1410354068-6100-1-git-send-email-dvlasenk-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2015-02-05 10:44 ` Michael Kerrisk (man-pages) [not found] ` <54D3498C.7000904-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Michael Kerrisk (man-pages) @ 2015-02-05 10:44 UTC (permalink / raw) To: Denys Vlasenko Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, linux-man-u79uwXL29TY76Z2rM5mHXA On 09/10/2014 03:01 PM, Denys Vlasenko wrote: > We have users who are terribly confused why their binaries > with CAP_DAC_OVERRIDE capability see EACCESS from access() calls, > but are able to read the file. > > The reason is access() isn't the "can I read/write/execute this file?" > question, it is the "(assuming that I'm a setuid binary,) can *the user > who invoked me* read/write/execute this file?" question. > > That's why it uses real UIDs as documented, and why it ignores > capabilities when capability-endored binaries are run by non-root > (this patch adds this information). > > To make users more likely to notice this less-known detail, > the patch expands the explanation with rationale for this logic > into a separate paragraph. Thanks, Denys. Applied. Cheers, Michael > Signed-off-by: Denys Vlasenko <dvlasenk-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > CC: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > --- > man2/access.2 | 19 ++++++++++++++++--- > 1 file changed, 16 insertions(+), 3 deletions(-) > > diff --git a/man2/access.2 b/man2/access.2 > index bfd85cd..73495ad 100644 > --- a/man2/access.2 > +++ b/man2/access.2 > @@ -102,9 +102,22 @@ The check is done using the calling process's > UID and GID, rather than the effective IDs as is done when > actually attempting an operation (e.g., > .BR open (2)) > -on the file. > -This allows set-user-ID programs to > -easily determine the invoking user's authority. > +on the file. Similarly, for root user, the check uses the set of > +permitted capabilities rather than the set of effective > +capabilities; and for non-root user, the check uses an empty set > +of capabilities. > + > +This allows set-user-ID programs and capability-endowed programs > +to easily determine the invoking user's authority. In other words: > +.BR access () > +does not answer the "can I read/write/execute this file?" question. > +It answers a bit different question: "(assuming I'm a setuid binary,) > +can > +.I the user who invoked me > +read/write/execute this file?", > +with the intent to make it possible for setuid programs to not > +allow malicious users make them read files which users shouldn't be > +able to read. > > If the calling process is privileged (i.e., its real UID is zero), > then an > -- 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <54D3498C.7000904-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] access.2: explain how access() check treats capabilities [not found] ` <54D3498C.7000904-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-02-11 13:34 ` Denys Vlasenko [not found] ` <54DB5A71.6080606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Denys Vlasenko @ 2015-02-11 13:34 UTC (permalink / raw) To: Michael Kerrisk (man-pages); +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA Hi Michael, On 02/05/2015 11:44 AM, Michael Kerrisk (man-pages) wrote: > On 09/10/2014 03:01 PM, Denys Vlasenko wrote: >> We have users who are terribly confused why their binaries >> with CAP_DAC_OVERRIDE capability see EACCESS from access() calls, >> but are able to read the file. >> >> The reason is access() isn't the "can I read/write/execute this file?" >> question, it is the "(assuming that I'm a setuid binary,) can *the user >> who invoked me* read/write/execute this file?" question. >> >> That's why it uses real UIDs as documented, and why it ignores >> capabilities when capability-endored binaries are run by non-root >> (this patch adds this information). >> >> To make users more likely to notice this less-known detail, >> the patch expands the explanation with rationale for this logic >> into a separate paragraph. > > Thanks, Denys. Applied. I don't see it in git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git -- 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <54DB5A71.6080606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] access.2: explain how access() check treats capabilities [not found] ` <54DB5A71.6080606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2015-02-11 13:38 ` Michael Kerrisk (man-pages) 0 siblings, 0 replies; 4+ messages in thread From: Michael Kerrisk (man-pages) @ 2015-02-11 13:38 UTC (permalink / raw) To: Denys Vlasenko Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, linux-man-u79uwXL29TY76Z2rM5mHXA Hi Denys, On 02/11/2015 02:34 PM, Denys Vlasenko wrote: > Hi Michael, > > On 02/05/2015 11:44 AM, Michael Kerrisk (man-pages) wrote: >> On 09/10/2014 03:01 PM, Denys Vlasenko wrote: >>> We have users who are terribly confused why their binaries >>> with CAP_DAC_OVERRIDE capability see EACCESS from access() calls, >>> but are able to read the file. >>> >>> The reason is access() isn't the "can I read/write/execute this file?" >>> question, it is the "(assuming that I'm a setuid binary,) can *the user >>> who invoked me* read/write/execute this file?" question. >>> >>> That's why it uses real UIDs as documented, and why it ignores >>> capabilities when capability-endored binaries are run by non-root >>> (this patch adds this information). >>> >>> To make users more likely to notice this less-known detail, >>> the patch expands the explanation with rationale for this logic >>> into a separate paragraph. >> >> Thanks, Denys. Applied. > > I don't see it in git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git Currently, I have it in a local branch. You'll get a mail when it's released. Thanks, 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-02-11 13:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-10 13:01 [PATCH] access.2: explain how access() check treats capabilities Denys Vlasenko
[not found] ` <1410354068-6100-1-git-send-email-dvlasenk-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-05 10:44 ` Michael Kerrisk (man-pages)
[not found] ` <54D3498C.7000904-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-11 13:34 ` Denys Vlasenko
[not found] ` <54DB5A71.6080606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-11 13:38 ` Michael Kerrisk (man-pages)
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).