All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] proc.5: ffix
@ 2017-11-05 19:04 Lucas Werkmeister
       [not found] ` <20171105190451.16059-1-mail-rm2KDkFaiJZ2qFAiU50y3BvVK+yQ3ZXh@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Lucas Werkmeister @ 2017-11-05 19:04 UTC (permalink / raw)
  To: Michael Kerrisk; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA, Lucas Werkmeister

---
 man5/proc.5 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man5/proc.5 b/man5/proc.5
index eeba1cfe6..01be63417 100644
--- a/man5/proc.5
+++ b/man5/proc.5
@@ -671,7 +671,7 @@ and
 in
 .IR /proc/self/fd .
 Thus the example command above could be written as:
-.PP
+.IP
 .in +4n
 .EX
 .RB "$" " foobar \-i /dev/stdin \-o /dev/stdout ..."
-- 
2.15.0

--
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

* [PATCH 2/2] proc.5: Clarify permissions in /proc/[pid]/fd/
       [not found] ` <20171105190451.16059-1-mail-rm2KDkFaiJZ2qFAiU50y3BvVK+yQ3ZXh@public.gmane.org>
@ 2017-11-05 19:04   ` Lucas Werkmeister
       [not found]     ` <20171105190451.16059-2-mail-rm2KDkFaiJZ2qFAiU50y3BvVK+yQ3ZXh@public.gmane.org>
  2017-11-06 21:23   ` [PATCH 1/2] proc.5: ffix Michael Kerrisk (man-pages)
  1 sibling, 1 reply; 4+ messages in thread
From: Lucas Werkmeister @ 2017-11-05 19:04 UTC (permalink / raw)
  To: Michael Kerrisk; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA, Lucas Werkmeister

Since the symbolic links for pipes and sockets do not refer to real
files in the file system tree, it can be hard to discover that they
still have mode and ownership information (revealed e.g. by `stat -L`),
so let's point this out in the manpage.

---

I’m not sure if this is too much text spent on a fairly rare problem –
feel free to cut it down (or let me know that I should do so) :)
---
 man5/proc.5 | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/man5/proc.5 b/man5/proc.5
index 01be63417..14beedd11 100644
--- a/man5/proc.5
+++ b/man5/proc.5
@@ -684,6 +684,31 @@ the symbolic links in this directory is governed by a ptrace access mode
 .B PTRACE_MODE_READ_FSCREDS
 check; see
 .BR ptrace (2).
+.IP
+Note that for file descriptors referring to inodes (pipes and sockets, see above),
+those inodes still have permission bits and ownership information
+distinct from those of the
+.I /proc/[pid]/fd
+entry,
+and that the owner may differ from the user and group IDs of the process.
+An unprivileged process may lack permissions to open them, as in this example:
+.IP
+.in +4n
+.EX
+.RB "$" " echo test | sudo -u nobody cat"
+test
+.RB "$" " echo test | sudo -u nobody cat /proc/self/fd/0"
+cat: /proc/self/fd/0: Permission denied
+.EE
+.in
+.IP
+File descriptor 0 refers to the pipe created by the shell
+and owned by that shell's user, which is not
+.IR nobody ,
+so
+.B cat
+does not have permission to create a new file descriptor to read from that inode,
+even though it can still read from its existing file descriptor 0.
 .TP
 .IR /proc/[pid]/fdinfo/ " (since Linux 2.6.22)"
 This is a subdirectory containing one entry for each file which the
-- 
2.15.0

--
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

* Re: [PATCH 1/2] proc.5: ffix
       [not found] ` <20171105190451.16059-1-mail-rm2KDkFaiJZ2qFAiU50y3BvVK+yQ3ZXh@public.gmane.org>
  2017-11-05 19:04   ` [PATCH 2/2] proc.5: Clarify permissions in /proc/[pid]/fd/ Lucas Werkmeister
@ 2017-11-06 21:23   ` Michael Kerrisk (man-pages)
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2017-11-06 21:23 UTC (permalink / raw)
  To: Lucas Werkmeister
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, linux-man-u79uwXL29TY76Z2rM5mHXA

On 11/05/2017 08:04 PM, Lucas Werkmeister wrote:
> ---
>  man5/proc.5 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, Lucas. Patch applied.

Cheers,

Michael

> diff --git a/man5/proc.5 b/man5/proc.5
> index eeba1cfe6..01be63417 100644
> --- a/man5/proc.5
> +++ b/man5/proc.5
> @@ -671,7 +671,7 @@ and
>  in
>  .IR /proc/self/fd .
>  Thus the example command above could be written as:
> -.PP
> +.IP
>  .in +4n
>  .EX
>  .RB "$" " foobar \-i /dev/stdin \-o /dev/stdout ..."
> 


-- 
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

* Re: [PATCH 2/2] proc.5: Clarify permissions in /proc/[pid]/fd/
       [not found]     ` <20171105190451.16059-2-mail-rm2KDkFaiJZ2qFAiU50y3BvVK+yQ3ZXh@public.gmane.org>
@ 2017-11-06 21:27       ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2017-11-06 21:27 UTC (permalink / raw)
  To: Lucas Werkmeister
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, linux-man-u79uwXL29TY76Z2rM5mHXA

Hello Lucas,

On 11/05/2017 08:04 PM, Lucas Werkmeister wrote:
> Since the symbolic links for pipes and sockets do not refer to real
> files in the file system tree, it can be hard to discover that they
> still have mode and ownership information (revealed e.g. by `stat -L`),
> so let's point this out in the manpage.
> 
> ---
> 
> I’m not sure if this is too much text spent on a fairly rare problem –
> feel free to cut it down (or let me know that I should do so) :)

Seems okay to me. Patch applied. Thanks for this!

Cheers,

Michael


> ---
>  man5/proc.5 | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/man5/proc.5 b/man5/proc.5
> index 01be63417..14beedd11 100644
> --- a/man5/proc.5
> +++ b/man5/proc.5
> @@ -684,6 +684,31 @@ the symbolic links in this directory is governed by a ptrace access mode
>  .B PTRACE_MODE_READ_FSCREDS
>  check; see
>  .BR ptrace (2).
> +.IP
> +Note that for file descriptors referring to inodes (pipes and sockets, see above),
> +those inodes still have permission bits and ownership information
> +distinct from those of the
> +.I /proc/[pid]/fd
> +entry,
> +and that the owner may differ from the user and group IDs of the process.
> +An unprivileged process may lack permissions to open them, as in this example:
> +.IP
> +.in +4n
> +.EX
> +.RB "$" " echo test | sudo -u nobody cat"
> +test
> +.RB "$" " echo test | sudo -u nobody cat /proc/self/fd/0"
> +cat: /proc/self/fd/0: Permission denied
> +.EE
> +.in
> +.IP
> +File descriptor 0 refers to the pipe created by the shell
> +and owned by that shell's user, which is not
> +.IR nobody ,
> +so
> +.B cat
> +does not have permission to create a new file descriptor to read from that inode,
> +even though it can still read from its existing file descriptor 0.
>  .TP
>  .IR /proc/[pid]/fdinfo/ " (since Linux 2.6.22)"
>  This is a subdirectory containing one entry for each file which the
> 


-- 
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:[~2017-11-06 21:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-05 19:04 [PATCH 1/2] proc.5: ffix Lucas Werkmeister
     [not found] ` <20171105190451.16059-1-mail-rm2KDkFaiJZ2qFAiU50y3BvVK+yQ3ZXh@public.gmane.org>
2017-11-05 19:04   ` [PATCH 2/2] proc.5: Clarify permissions in /proc/[pid]/fd/ Lucas Werkmeister
     [not found]     ` <20171105190451.16059-2-mail-rm2KDkFaiJZ2qFAiU50y3BvVK+yQ3ZXh@public.gmane.org>
2017-11-06 21:27       ` Michael Kerrisk (man-pages)
2017-11-06 21:23   ` [PATCH 1/2] proc.5: ffix Michael Kerrisk (man-pages)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.