Re: [RFC][PATCH v2] procfs: Always expose /proc/<pid>/map_files/ and make it readable

From: Cyrill Gorcunov
Date: Tue Jan 27 2015 - 01:47:01 EST


On Mon, Jan 26, 2015 at 03:43:46PM -0800, Andrew Morton wrote:
> >
> > Looks good to me, thanks! Though I would really appreciate if someone
> > from security camp take a look as well.
>
> hm, who's that. Kees comes to mind.

yup, I managed to forget CC him.

>
> And reviewers' task would be a heck of a lot easier if they knew what
> /proc/pid/map_files actually does. This:
>
> akpm3:/usr/src/25> grep -r map_files Documentation
> akpm3:/usr/src/25>
>
> does not help.

Sigh. Imagine, for some reason I though we've the docs for that
entry, probably i though that way because of many fdinfo snippets
i've putted into /proc docs. my bad, sorry. I'll try to prepare
docs today.

> The 640708a2cff7f81 changelog says:
>
> : This one behaves similarly to the /proc/<pid>/fd/ one - it contains
> : symlinks one for each mapping with file, the name of a symlink is
> : "vma->vm_start-vma->vm_end", the target is the file. Opening a symlink
> : results in a file that point exactly to the same inode as them vma's one.
> :
> : For example the ls -l of some arbitrary /proc/<pid>/map_files/
> :
> : | lr-x------ 1 root root 64 Aug 26 06:40 7f8f80403000-7f8f80404000 -> /lib64/libc-2.5.so
> : | lr-x------ 1 root root 64 Aug 26 06:40 7f8f8061e000-7f8f80620000 -> /lib64/libselinux.so.1
> : | lr-x------ 1 root root 64 Aug 26 06:40 7f8f80826000-7f8f80827000 -> /lib64/libacl.so.1.1.0
> : | lr-x------ 1 root root 64 Aug 26 06:40 7f8f80a2f000-7f8f80a30000 -> /lib64/librt-2.5.so
> : | lr-x------ 1 root root 64 Aug 26 06:40 7f8f80a30000-7f8f80a4c000 -> /lib64/ld-2.5.so
>
> afacit this info is also available in /proc/pid/maps, so things
> shouldn't get worse if the /proc/pid/map_files permissions are at least
> as restrictive as the /proc/pid/maps permissions. Is that the case?
> (Please add to changelog).
>
> There's one other problem here: we're assuming that the map_files
> implementation doesn't have bugs. If it does have bugs then relaxing
> permissions like this will create new vulnerabilities. And the
> map_files implementation is surprisingly complex. Is it bug-free?

I didn't find any bugs in map-files (and we use it for long time already)
so I think it is safe.
--
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/