linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Shakeel Butt <shakeel.butt@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Suren Baghdasaryan <surenb@google.com>,
	linux-api@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Minchan Kim <minchan@kernel.org>
Subject: Re: [PATCH 1/2] mm/madvise: introduce PR_MADV_SELF flag to process_madvise()
Date: Tue, 24 Sep 2024 08:49:06 +0100	[thread overview]
Message-ID: <c024c20d-17d0-4b20-9f81-f9934d4f151f@lucifer.local> (raw)
In-Reply-To: <337e4359-37e0-4ed7-894d-6c88b3498a42@app.fastmail.com>

On Mon, Sep 23, 2024 at 09:49:43PM GMT, Arnd Bergmann wrote:
> On Mon, Sep 23, 2024, at 19:34, Lorenzo Stoakes wrote:
> > On Mon, Sep 23, 2024 at 11:56:06AM GMT, Shakeel Butt wrote:
> >
> > +	/* Require PTRACE_MODE_READ to avoid leaking ASLR metadata. */
> > +	mm = mm_access(task, PTRACE_MODE_READ_FSCREDS);
> > +	if (IS_ERR_OR_NULL(mm)) {
> > +		ret = IS_ERR(mm) ? PTR_ERR(mm) : -ESRCH;
> > +		goto release_task;
> > +	}
>
> Any chance we can fix mm_access() to not be able to return
> a NULL pointer and an error pointer?  IS_ERR_OR_NULL() is
> usually an indication of a confusing API, and this is
> clearly one of them, given that only one of the
> callers actually wants the NULL value instead of -ESRCH.
>
>     Arnd

Agreed, this should be fixed. I think it'd be a bit out of the scope of
this series so will send something separately for this.

  reply	other threads:[~2024-09-24  7:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23 16:03 [PATCH 0/2] unrestrict process_madvise() for current process Lorenzo Stoakes
2024-09-23 16:03 ` [PATCH 1/2] mm/madvise: introduce PR_MADV_SELF flag to process_madvise() Lorenzo Stoakes
2024-09-23 18:56   ` Shakeel Butt
2024-09-23 19:34     ` Lorenzo Stoakes
2024-09-23 21:49       ` Arnd Bergmann
2024-09-24  7:49         ` Lorenzo Stoakes [this message]
2024-09-23 21:20   ` kernel test robot
2024-09-23 21:30   ` kernel test robot
2024-09-24  3:15   ` kernel test robot
2024-09-24  8:47     ` Lorenzo Stoakes
2024-09-23 16:03 ` [PATCH 2/2] selftests/mm: add test for process_madvise PR_MADV_SELF flag use Lorenzo Stoakes

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=c024c20d-17d0-4b20-9f81-f9934d4f151f@lucifer.local \
    --to=lorenzo.stoakes@oracle.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).