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.

Bug: 111903542
Change-Id: I0bf57ac5a90dba66e5c2c32beff70bcf9d26db6b
Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
This commit is contained in:
Isaac J. Manjarres
2025-01-28 14:59:07 -08:00
parent cdceb5104f
commit 60334ce1a7

View File

@@ -89,6 +89,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)
@@ -4506,6 +4510,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 = {