[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250807165455.73656-1-wjl.linux@gmail.com>
Date: Fri, 8 Aug 2025 00:54:55 +0800
From: Jialin Wang <wjl.linux@...il.com>
To: Penglei Jiang <superman.xpt@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Jialin Wang <wjl.linux@...il.com>,
linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: [PATCH] proc: proc_maps_open allow proc_mem_open to return NULL
The commit 65c66047259f ("proc: fix the issue of proc_mem_open returning NULL")
breaks `perf record -g -p PID` when profiling a kernel thread.
The strace of `perf record -g -p $(pgrep kswapd0)` shows:
openat(AT_FDCWD, "/proc/65/task/65/maps", O_RDONLY) = -1 ESRCH (No such process)
This patch partially reverts the commit to fix it.
Fixes: 65c66047259f ("proc: fix the issue of proc_mem_open returning NULL")
Signed-off-by: Jialin Wang <wjl.linux@...il.com>
---
fs/proc/task_mmu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 3d6d8a9f13fc..7a7ce26106ac 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -340,8 +340,8 @@ static int proc_maps_open(struct inode *inode, struct file *file,
priv->inode = inode;
priv->mm = proc_mem_open(inode, PTRACE_MODE_READ);
- if (IS_ERR_OR_NULL(priv->mm)) {
- int err = priv->mm ? PTR_ERR(priv->mm) : -ESRCH;
+ if (IS_ERR(priv->mm)) {
+ int err = PTR_ERR(priv->mm);
seq_release_private(inode, file);
return err;
--
2.50.0
Powered by blists - more mailing lists