Re: [PATCH v2 2/2] proc: do not allow negative offsets on /proc//environ

2012-07-25 Thread Oleg Nesterov
On 07/24, Djalal Harouni wrote: > > static int mem_open(struct inode *inode, struct file *file) > { > - return __mem_open(inode, file, PTRACE_MODE_ATTACH); > + int ret = __mem_open(inode, file, PTRACE_MODE_ATTACH); > + > + /* OK to pass negative loff_t, we can catch out-of-range */ >

[PATCH v2 2/2] proc: do not allow negative offsets on /proc//environ

2012-07-24 Thread Djalal Harouni
__mem_open() which is called by both /proc//environ and /proc//mem ->open() handlers will allow the use of negative offsets. /proc//mem has negative offsets but not /proc//environ. Clean this by moving the 'force FMODE_UNSIGNED_OFFSET flag' to mem_open() to allow negative offsets only on