[PATCH v2 2/2] fs/procfs: improve PROCMAP_QUERY's compat mode handling

From: Andrii Nakryiko
Date: Mon Jul 01 2024 - 13:48:34 EST


Kernel provides compat_ptr_ioctl() wrapper to sanitize pointers for
32-bit processes on 64-bit host architectures. Given procfs_procmap_ioctl()
always expects pointer argument, this is exactly what we need.

This has any effect only on 32-bit processes on s390 architecture.

Suggested-by: Arnd Bergmann <arnd@xxxxxxxx>
Fixes: 3757be498749 ("fs/procfs: implement efficient VMA querying API for /proc/<pid>/maps")
Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
---
fs/proc/task_mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 3f1d0d2f78fe..b7bb4d04e962 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -637,7 +637,7 @@ const struct file_operations proc_pid_maps_operations = {
.llseek = seq_lseek,
.release = proc_map_release,
.unlocked_ioctl = procfs_procmap_ioctl,
- .compat_ioctl = procfs_procmap_ioctl,
+ .compat_ioctl = compat_ptr_ioctl,
};

/*
--
2.43.0