proc.5: Correct description of NStgid

The left-most pid namespace in a given procfs' `NStgid` does not
change based on the pid namespace of the reading process. Rather,
each procfs has an associated outer-most namespace, which gets
set when the procfs is mounted:

```
static struct dentry *proc_mount(struct file_system_type *fs_type,
	int flags, const char *dev_name, void *data)
{
	struct pid_namespace *ns;

	if (flags & MS_KERNMOUNT) {
		ns = data;
		data = NULL;
	} else {
		ns = task_active_pid_ns(current);
	}

	return mount_ns(fs_type, flags, data, ns, ns->user_ns, proc_fill_super);
}
```

i.e. either the root namespace for kernel mounts or the namespace
of the mounting process. This ns then gets saved in the fs' super
block and is the basis for most operations. It is this ns that the
left-most value of `NStgid` is relative to, not the reading process.

Reported-by: Robert O'Callahan <robert@ocallahan.org>
Signed-off-by: Keno Fischer <keno@juliacomputing.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Keno Fischer 2018-08-02 20:07:14 -04:00 committed by Michael Kerrisk
parent 04ad932426
commit 0aae409212
1 changed files with 2 additions and 1 deletions

View File

@ -2356,7 +2356,8 @@ Thread group ID (i.e., PID) in each of the PID namespaces of which
.I [pid]
is a member.
The leftmost entry shows the value with respect to the PID namespace
of the reading process,
of the process that mounted this procfs (or the root namespace
if mounted by the kernel),
followed by the value in successively nested inner namespaces.
.\" commit e4bc33245124db69b74a6d853ac76c2976f472d5
(Since Linux 4.1.)