]> www.infradead.org Git - users/jedix/linux-maple.git/commit
proc: clean up and fix /proc/<pid>/mem handling
authorMaxim Uvarov <maxim.uvarov@oracle.com>
Mon, 23 Jan 2012 20:08:00 +0000 (12:08 -0800)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Mon, 23 Jan 2012 20:08:00 +0000 (12:08 -0800)
commit59672becba6754ffbb97d7b015399655930fc2e7
treecdcb8e23d3cbd9d3c7b0ec8490fa4001a3c4c01d
parent098d4187aec034865d75e742e4848edb6cad68d8
proc: clean up and fix /proc/<pid>/mem handling

Orabug: 13618927
CVE-2012-0056
Jüri Aedla reported that the /proc/<pid>/mem handling really isn't very
robust, and it also doesn't match the permission checking of any of the
other related files.

This changes it to do the permission checks at open time, and instead of
tracking the process, it tracks the VM at the time of the open.  That
simplifies the code a lot, but does mean that if you hold the file
descriptor open over an execve(), you'll continue to read from the _old_
VM.

That is different from our previous behavior, but much simpler.  If
somebody actually finds a load where this matters, we'll need to revert
this commit.

I suspect that nobody will ever notice - because the process mapping
addresses will also have changed as part of the execve.  So you cannot
actually usefully access the fd across a VM change simply because all
the offsets for IO would have changed too.

Reported-by: Jüri Aedla <asd@ut.ee>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Conflicts:

fs/proc/base.c

Signed-off-by: Maxim Uvarov <maxim.uvarov@oracle.com>
fs/proc/base.c