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 <isaacmanjarres@google.com>
Change-Id: I8578efdd13fd668f44fc0c6a0fe39257da26397e
This commit is contained in:
Isaac J. Manjarres authored and Nolen Johnson committed 2026-03-16 03:27:33 +00:00
1 parent 5684dd9b88
commit 3f2b8324ea
1 file changed
+10
+10
View File
@@ -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 = {