summaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2023-12-14 07:44:38 +0100
committerChristian Brauner <brauner@kernel.org>2023-12-21 13:17:54 +0100
commit3efdc78fdc21ab82694707eb234ab93f28d13ba8 (patch)
treec8d8474c4044416931c05db19283882fe6544e9c /fs/proc
parenteventfd: Remove usage of the deprecated ida_simple_xx() API (diff)
downloadlinux-3efdc78fdc21ab82694707eb234ab93f28d13ba8.tar.xz
linux-3efdc78fdc21ab82694707eb234ab93f28d13ba8.zip
fs/proc: show correct device and inode numbers in /proc/pid/maps
/proc/pid/maps shows device and inode numbers of vma->vm_file-s. Here is an issue. If a mapped file is on a stackable file system (e.g., overlayfs), vma->vm_file is a backing file whose f_inode is on the underlying filesystem. To show correct numbers, we need to get a user file and shows its numbers. The same trick is used to show file paths in /proc/pid/maps. Cc: Alexander Mikhalitsyn <alexander@mihalicyn.com> Suggested-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Andrei Vagin <avagin@google.com> Link: https://lore.kernel.org/r/20231214064439.1023011-1-avagin@google.com Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/task_mmu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index ef2eb12906da..5de0f70e52ff 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -273,7 +273,8 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
const char *name = NULL;
if (file) {
- struct inode *inode = file_inode(vma->vm_file);
+ const struct inode *inode = file_user_inode(vma->vm_file);
+
dev = inode->i_sb->s_dev;
ino = inode->i_ino;
pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;