From 3f2b8324ead8f23ef2ca1e9aecd1866d7dcbb001 Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Fri, 30 Jan 2026 14:52:50 +0800 Subject: [PATCH] BACKPORT: ANDROID: mm: shmem: Use memfd-ashmem-shim ioctl handler Allow the memfd-ashmem-shim ioctl handler to run for any shmem file, so that memfds can handle ashmem ioctl commands. While this allows ashmem ioctl commands to be invoked on more than just memfds, this should be fine, since the ioctl commands don't expose any additional functionality than what is already achievable via other system calls. Signed-off-by: Isaac J. Manjarres Change-Id: I8578efdd13fd668f44fc0c6a0fe39257da26397e --- mm/shmem.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mm/shmem.c b/mm/shmem.c index 3ba0a2aa919c..404902da5959 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -85,6 +85,10 @@ static struct vfsmount *shm_mnt; #include "internal.h" +#ifdef CONFIG_MEMFD_ASHMEM_SHIM +#include "memfd-ashmem-shim.h" +#endif + #define BLOCKS_PER_PAGE (PAGE_SIZE/512) #define VM_ACCT(size) (PAGE_ALIGN(size) >> PAGE_SHIFT) @@ -3787,6 +3791,12 @@ static const struct file_operations shmem_file_operations = { .splice_write = iter_file_splice_write, .fallocate = shmem_fallocate, #endif +#ifdef CONFIG_MEMFD_ASHMEM_SHIM + .unlocked_ioctl = memfd_ashmem_shim_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = memfd_ashmem_shim_compat_ioctl, +#endif +#endif }; static const struct inode_operations shmem_inode_operations = {