On Wed, Feb 21, 2018 at 9:23 PM, Alexey Dobriyan <[email protected]> wrote:
> /proc/*/cmdline is not different from /proc/*/environ as it accesses
> target task's memory (and can access the very same region of memory)
> but it doesn't go through ptrace_may_access() and thus doesn't go through LSM.

> +static int __mem_open(struct inode *inode, struct file *file, unsigned int 
> mode)
> +{
> +       struct mm_struct *mm = proc_mem_open(inode, mode);
> +
> +       if (IS_ERR(mm))
> +               return PTR_ERR(mm);

So, is it possible to have it NULL?..

> +
> +       file->private_data = mm;
> +       return 0;
> +}

> +static int mem_release(struct inode *inode, struct file *file)
> +{
> +       struct mm_struct *mm = file->private_data;

> +       if (mm)

...or I don't get this check.

> +               mmdrop(mm);
> +       return 0;
> +}

-- 
With Best Regards,
Andy Shevchenko

Reply via email to