public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] man/man5/proc_pid.5: Clarify which user namespace affects permissions
@ 2026-03-16 14:07 Vivian Wang
  2026-03-18  0:51 ` Alejandro Colomar
  0 siblings, 1 reply; 2+ messages in thread
From: Vivian Wang @ 2026-03-16 14:07 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: linux-man, Michael Kerrisk

A more careful reading of fs/proc/base.c (since v4.11, as of v7.0-rc1)
reveals that it is not task->cred->user_ns that is checked, but
task->mm->user_ns, which is set during execve(2) (and copied over in
fork(2) and so on) [1], and is the correct user namespace to check for
ptrace-related purposes. Clarify the relevant text.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bfedb589252c01fa505ac9f6f2a3d5d68d707ef4

Fixes: ae636827 ("proc.5: Fix description of /proc/PID/* ownership to account for user namespaces")
Signed-off-by: Vivian Wang <dramforever@live.com>
---
 man/man5/proc_pid.5 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/man/man5/proc_pid.5 b/man/man5/proc_pid.5
index eac97fa1d..2fe35bd09 100644
--- a/man/man5/proc_pid.5
+++ b/man/man5/proc_pid.5
@@ -30,7 +30,9 @@ Before Linux 4.11,
 meant the "global" root user ID and group ID
 (i.e., UID 0 and GID 0 in the initial user namespace).
 Since Linux 4.11,
-if the process is in a noninitial user namespace that has a
+if when the last time the process called
+.BR execve (2),
+it was in a noninitial user namespace that has a
 valid mapping for user (group) ID 0 inside the namespace, then
 the user (group) ownership of the files under
 .IR /proc/ pid
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] man/man5/proc_pid.5: Clarify which user namespace affects permissions
  2026-03-16 14:07 [PATCH] man/man5/proc_pid.5: Clarify which user namespace affects permissions Vivian Wang
@ 2026-03-18  0:51 ` Alejandro Colomar
  0 siblings, 0 replies; 2+ messages in thread
From: Alejandro Colomar @ 2026-03-18  0:51 UTC (permalink / raw)
  To: Vivian Wang; +Cc: linux-man, Michael Kerrisk

[-- Attachment #1: Type: text/plain, Size: 1570 bytes --]

Hi Vivian,

On 2026-03-16T22:07:52+0800, Vivian Wang wrote:
> A more careful reading of fs/proc/base.c (since v4.11, as of v7.0-rc1)
> reveals that it is not task->cred->user_ns that is checked, but
> task->mm->user_ns, which is set during execve(2) (and copied over in
> fork(2) and so on) [1], and is the correct user namespace to check for
> ptrace-related purposes. Clarify the relevant text.
> 
> [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bfedb589252c01fa505ac9f6f2a3d5d68d707ef4
> 
> Fixes: ae636827 ("proc.5: Fix description of /proc/PID/* ownership to account for user namespaces")
> Signed-off-by: Vivian Wang <dramforever@live.com>

Thanks!  I've applied the patch.


Have a lovely night!
Alex

> ---
>  man/man5/proc_pid.5 | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/man/man5/proc_pid.5 b/man/man5/proc_pid.5
> index eac97fa1d..2fe35bd09 100644
> --- a/man/man5/proc_pid.5
> +++ b/man/man5/proc_pid.5
> @@ -30,7 +30,9 @@ Before Linux 4.11,
>  meant the "global" root user ID and group ID
>  (i.e., UID 0 and GID 0 in the initial user namespace).
>  Since Linux 4.11,
> -if the process is in a noninitial user namespace that has a
> +if when the last time the process called
> +.BR execve (2),
> +it was in a noninitial user namespace that has a
>  valid mapping for user (group) ID 0 inside the namespace, then
>  the user (group) ownership of the files under
>  .IR /proc/ pid
> -- 
> 2.53.0
> 
> 

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-18  0:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-16 14:07 [PATCH] man/man5/proc_pid.5: Clarify which user namespace affects permissions Vivian Wang
2026-03-18  0:51 ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox