On Tue, Oct 29, 2024 at 08:43:04AM -0700, Yang Shi wrote: > > Sorry for chiming in late. This looks problematic IIUC. The patch 5/5 > moved arch_validate_flags() before call_mmap() as the commit log said. > But shmem_file() does this check: > mapping->a_ops == &shmem_aops > > But mapping->a_ops is not initialized until shmem_mmap(), which is > called by call_mmap(). > > So shmem_file() should always return false here. Did I miss something? Well firstly this is tested and works so you did miss something :) Bu shmem_mmap() is not setting mapping->a_ops, it's setting vma->vm_ops. __shmem_get_inode() and shmem_symlink() set mapping->a_ops.