Re: [patch 6/6] vfs: mountinfo: only show mounts under tasks root

From: Al Viro
Date: Wed Mar 19 2008 - 17:20:08 EST


On Thu, Mar 13, 2008 at 10:26:47PM +0100, Miklos Szeredi wrote:
> From: Miklos Szeredi <mszeredi@xxxxxxx>
>
> 1. Only show reachable mounts in /proc/<pid>/mountinfo, this makes
> mountpoints unambiguous for chrooted processes.
>
> 2. Instead of showing mountpoints relative to the current root, always
> show them relative to the queried task's root.
>
> This means, that a particular mountinfo file will always have the same
> contents, regardless of which process is reading the file. Which is a
> lot more consistent, than the current behavior of /proc/<pid>/mounts.
>
> Addressed comments from Jan Blunck and Ram Pai.

> return retval;
>
> global_root:
> + if (only_reachable)
> + return ERR_PTR(-EINVAL);

Humm... Might make sense to update *root in case we hit that place and
do the rest in callers, instead of playing with extra arguments...
Hell knows, I'd try to massage in that direction and see if anything
clean shows up.

> static int show_mountinfo(struct seq_file *m, void *v)
> {
> + struct proc_mounts *p = m->private;
> + size_t count_save = m->count;

*UGH*. Do you really need that? Frankly, in that case I'd rather
separate the check from __d_path(); unwinds like that are Not Nice(tm).

> + if (seq_path_root(m, &mnt_path, &p->root, " \t\n\\") == -EINVAL) {
> + /* path is outside root */
> + m->count = count_save;
--
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/