__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.
Allowing negative offsets on /proc/<pid>/environ can turn it to act like
/proc/<pid>/mem. A negative offset will pass the
fs/read_write.c:lseek_execute() and the environ_read() checks and will
point to another VMA.
Fix this by moving the 'force FMODE_UNSIGNED_OFFSET flag' to mem_open()
to allow negative offsets only on /proc/<pid>/mem.
You must be able to ptrace the target to open /proc/<pid>/environ ,so
this is not a security issue, but we should not be able to abuse it.
Signed-off-by: Djalal Harouni <firstname.lastname@example.org>
New kernels include mm->env_start in /proc/<pid>/stat
To dump .text area: lseek() to 0x00400000 - mm->env_start
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to email@example.com
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/