LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/5] proc: make /proc/*/cmdline go through LSM
Date: Wed, 21 Feb 2018 21:28:41 +0200	[thread overview]
Message-ID: <CAHp75VdaxkMn2UxURSB4fWep=iv4CRAkmEtdKBp1HKyxtW2tTg@mail.gmail.com> (raw)
In-Reply-To: <20180221192339.GA28548@avx2>

On Wed, Feb 21, 2018 at 9:23 PM, Alexey Dobriyan <adobriyan@gmail.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

  parent reply	other threads:[~2018-02-21 19:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 19:23 Alexey Dobriyan
2018-02-21 19:26 ` [PATCH 2/5] proc: more "unsigned int" in /proc/*/cmdline Alexey Dobriyan
2018-02-21 19:27   ` [PATCH 3/5] proc: somewhat simpler code for /proc/*/cmdline Alexey Dobriyan
2018-02-21 19:30     ` [PATCH 4/5] proc: simpler iterations " Alexey Dobriyan
2018-02-21 19:33       ` [PATCH 5/5] proc: deduplicate /proc/*/cmdline implementation Alexey Dobriyan
2018-04-20  0:15       ` [PATCH 4/5] proc: simpler iterations for /proc/*/cmdline Andrew Morton
2018-04-20 19:46         ` Alexey Dobriyan
2018-02-21 19:28 ` Andy Shevchenko [this message]
2018-02-21 19:39   ` [PATCH 1/5] proc: make /proc/*/cmdline go through LSM Alexey Dobriyan
2018-02-21 20:06 ` Andrew Morton
2018-02-23 19:43   ` [PATCH v2 " Alexey Dobriyan
2018-04-20  0:02 ` [PATCH " Andrew Morton
2018-04-20 19:25   ` Alexey Dobriyan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHp75VdaxkMn2UxURSB4fWep=iv4CRAkmEtdKBp1HKyxtW2tTg@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 1/5] proc: make /proc/*/cmdline go through LSM' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).