Re: [PATCH] proc: fix mount -t proc -o AAA

From: Vasiliy Kulikov
Date: Sun Mar 25 2012 - 11:36:49 EST


On Sun, Mar 25, 2012 at 09:24 +0200, Arkadiusz MiÅkiewicz wrote:
> but there is another problem - unmounting it and mounting without options
> causes old option to persist:
>
> # mount none /proc -t proc -o hidepid=2
> # umount /proc
> # mount none /proc -t proc
> # grep "/proc" /proc/mounts
> none /proc proc rw,relatime,hidepid=2 0 0
>
> There should be no hidepid=2 now.

No, that's an expected behaviour.

Procfs is a special filesystem. Mount options are not reset on each
mount(2) as you can mount procfs multiple times at different mount points
(/proc/, /aaa/proc/, etc.). Each time you add mount options they are
applied to _each_ mount point because there is no per-mount point sb, but
there is a per pid_ns superblock: pid_ns itself. All options are stored
at pid_ns.

When you mount it another time without any option nothing should change
at the old mount points. When you umount the last mount point all mount
options are still stored. When you mount it again old options are used
(unless you override them).

Thanks,

--
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/