proc.5: Rework the description of /proc/PID/mountinfo parent-ID field

After comments from Miklos, and further digging in the kernel
source that showed that chroot() can also result in "hidden"
parent-IDs in mountinfo, I've revised the description of
mountinfo.

In fs/proc_namespace.cs::how_mountinfo() there is:

        /* mountpoints outside of chroot jail will give SEQ_SKIP on this */
        err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
        if (err)
                goto out;

I instrumented the 'if (err)' code path with printk()
to show that there is indeed a record corresponding to the
parent-ID for the process root that is being skipped.

Reported-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-11-20 09:59:43 +01:00
parent 35cf1b9397
commit 2927055043
1 changed files with 18 additions and 9 deletions

View File

@ -1243,16 +1243,25 @@ mount ID: a unique ID for the mount (may be reused after
.BR umount (2)).
.TP
(2)
parent ID: the ID of the parent mount.
For the root mount point,
the ID shown here is a hidden mount ID associated with the mount namespace.
That ID is distinct from any of the IDs shown in
field (1) of the records shown in the
parent ID: the ID of the parent mount
(or of self for the root of this mount namespace's mount tree).
.IP
If the parent mount point lies outside the process's root directory (see
.BR chroot (2)),
the ID shown here won't have a corresponding record in
.I mountinfo
file, and does not appear in field (1) in the
.I mountinfo
file in any other mount namespace.
(In the initial mount namespace, this hidden ID has the value 0.)
whose mount ID (field 1) matches this parent mount ID
(because mount points that lie outside the process's root directory
are not shown in
.IR mountinfo ).
As a special case of this point,
the process's root mount point may have a parent mount
(for the initramfs filesystem) that lies
.\" Miklos Szeredi, Nov 2017: The hidden one is the initramfs, I believe
.\" mtk: In the initial mount namespace, this hidden ID has the value 0
outside the process's root directory,
and an entry for that mount point will not appear in
.IR mountinfo .
.TP
(3)
major:minor: the value of