From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Hengyu Liang <hengyul@cs.unc.edu>,
akpm@linux-foundation.org, linux-mm@kvack.org
Cc: liam@infradead.org, ljs@kernel.org, vbabka@kernel.org,
jannh@google.com, pfalcato@suse.de, usama.anjum@arm.com,
avagin@gmail.com, mirq-linux@rere.qmqm.pl, arnd@arndb.de,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] fs/proc/task_mmu: return -ENOTTY for unknown pagemap ioctls
Date: Sun, 25 Oct 2026 11:56:58 +0100 [thread overview]
Message-ID: <78127b64-d4ba-4e72-87fd-28e26f989de9@kernel.org> (raw)
In-Reply-To: <20261023181300.3366487-1-hengyul@cs.unc.edu>
On 10/23/26 20:13, Hengyu Liang wrote:
> Commit 52526ca7fdb9 ("fs/proc/task_mmu: implement IOCTL to get and
> optionally clear info about PTEs") made do_pagemap_cmd() the ioctl
> handler of /proc/<pid>/pagemap.
>
> However, do_pagemap_cmd() returns -EINVAL for every command other than
> PAGEMAP_SCAN. Before that commit, pagemap had no ioctl handler, and
> the VFS returned -ENOTTY for these commands. As of now, they fail with
> EINVAL, so tcgetattr() and isatty() on pagemap report EINVAL instead
> of ENOTTY.
>
> The issue can be reproduced with a simple C program:
>
> #include <fcntl.h>
> #include <stdio.h>
> #include <termios.h>
>
> int main(void)
> {
> struct termios t;
> int fd = open("/proc/self/pagemap", O_RDONLY);
>
> if (tcgetattr(fd, &t) < 0)
> perror("tcgetattr");
> return 0;
> }
>
> Before that commit, the result is:
>
> tcgetattr: Inappropriate ioctl for device
>
> After that commit, the result is:
>
> tcgetattr: Invalid argument
>
> This patch will return -ENOIOCTLCMD for unknown commands, as
> procfs_procmap_ioctl() in the same file does, so that the VFS turns it
> into -ENOTTY.
>
> Fixes: 52526ca7fdb9 ("fs/proc/task_mmu: implement IOCTL to get and optionally clear info about PTEs")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hengyu Liang <hengyul@cs.unc.edu>
> ---
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
prev parent reply other threads:[~2026-10-25 11:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 18:13 [PATCH] fs/proc/task_mmu: return -ENOTTY for unknown pagemap ioctls Hengyu Liang
2026-10-23 18:24 ` Andrew Morton
2026-10-25 10:56 ` David Hildenbrand (Arm) [this message]
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=78127b64-d4ba-4e72-87fd-28e26f989de9@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=avagin@gmail.com \
--cc=hengyul@cs.unc.edu \
--cc=jannh@google.com \
--cc=liam@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mirq-linux@rere.qmqm.pl \
--cc=pfalcato@suse.de \
--cc=stable@vger.kernel.org \
--cc=usama.anjum@arm.com \
--cc=vbabka@kernel.org \
/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