]> git.baikalelectronics.ru Git - kernel.git/commit
proc: do not allow negative offsets on /proc/<pid>/environ
authorDjalal Harouni <tixxdz@opendz.org>
Mon, 30 Jul 2012 21:42:28 +0000 (14:42 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 31 Jul 2012 00:25:20 +0000 (17:25 -0700)
commite44c995e3853b6390393a6280afa98a5489ffc6b
tree43e2d8031fea729f32f7800936d61fbc59fc7cdd
parent2b7b1e69e1db5cbb0ef0d9a1e70545f46fef1152
proc: do not allow negative offsets on /proc/<pid>/environ

__mem_open() which is called by both /proc/<pid>/environ and
/proc/<pid>/mem ->open() handlers will allow the use of negative offsets.
/proc/<pid>/mem has negative offsets but not /proc/<pid>/environ.

Clean this by moving the 'force FMODE_UNSIGNED_OFFSET flag' to mem_open()
to allow negative offsets only on /proc/<pid>/mem.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Brad Spengler <spender@grsecurity.net>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/base.c