[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdaxkMn2UxURSB4fWep=iv4CRAkmEtdKBp1HKyxtW2tTg@mail.gmail.com>
Date: Wed, 21 Feb 2018 21:28:41 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/5] proc: make /proc/*/cmdline go through LSM
On Wed, Feb 21, 2018 at 9:23 PM, Alexey Dobriyan <adobriyan@...il.com> 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
Powered by blists - more mailing lists