From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Usama Arif <usama.arif@linux.dev>, Alban Crequy <alban.crequy@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Christian Brauner <brauner@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Alban Crequy <albancrequy@microsoft.com>,
Peter Xu <peterx@redhat.com>, Willy Tarreau <w@1wt.eu>,
linux-kselftest@vger.kernel.org, shuah@kernel.org
Subject: Re: [PATCH v2 1/2] mm/process_vm_access: pidfd and nowait support for process_vm_readv/writev
Date: Thu, 23 Apr 2026 14:52:26 +0200 [thread overview]
Message-ID: <62d88cde-efc0-48cb-be8d-813eda810343@kernel.org> (raw)
In-Reply-To: <20260409142256.131676-1-usama.arif@linux.dev>
>>
>> /* Get process information */
>> - task = find_get_task_by_vpid(pid);
>> + if (flags & PROCESS_VM_PIDFD)
>> + task = pidfd_get_task(pid, &f_flags);
>> + else
>> + task = find_get_task_by_vpid(pid);
>> +
>> if (!task) {
>> rc = -ESRCH;
>> goto free_proc_pages;
>
> pidfd_get_task() returns ERR_PTR() on failure (e.g. ERR_PTR(-EBADF)),
> but the code checks "if (!task)" which only catches NULL. An invalid
> pidfd will cause mm_access() and put_task_struct() to dereference an
> error pointer, crashing the kernel.
Yes. Should we add proper selftests that exercise these code paths?
--
Cheers,
David
next prev parent reply other threads:[~2026-04-23 12:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 14:54 [PATCH v2 0/2] mm/process_vm_access: pidfd and nowait support for process_vm_readv/writev Alban Crequy
2026-04-08 14:54 ` [PATCH v2 1/2] " Alban Crequy
2026-04-09 14:22 ` Usama Arif
2026-04-23 12:52 ` David Hildenbrand (Arm) [this message]
2026-04-23 14:04 ` David Laight
2026-04-23 14:17 ` David Hildenbrand (Arm)
2026-04-08 14:54 ` [PATCH v2 2/2] selftests/mm: add tests for process_vm_readv flags Alban Crequy
2026-04-09 12:38 ` [PATCH v2 0/2] mm/process_vm_access: pidfd and nowait support for process_vm_readv/writev Christian Brauner
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=62d88cde-efc0-48cb-be8d-813eda810343@kernel.org \
--to=david@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=alban.crequy@gmail.com \
--cc=albancrequy@microsoft.com \
--cc=brauner@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=peterx@redhat.com \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=w@1wt.eu \
/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