The patch titled Subject: mm-add-an-f_seal_future_write-seal-to-memfd-fix-2 has been removed from the -mm tree. Its filename was mm-add-an-f_seal_future_write-seal-to-memfd-fix-2.patch This patch was dropped because it was folded into mm-add-an-f_seal_future_write-seal-to-memfd.patch ------------------------------------------------------ From: "Joel Fernandes (Google)" <joel@xxxxxxxxxxxxxxxxx> Subject: mm-add-an-f_seal_future_write-seal-to-memfd-fix-2 v4 Link: http://lkml.kernel.org/r/20181122230906.GA198127@xxxxxxxxxx Signed-off-by: Joel Fernandes (Google) <joel@xxxxxxxxxxxxxxxxx> Suggested-by: Andy Lutomirski <luto@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/shmem.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) --- a/mm/shmem.c~mm-add-an-f_seal_future_write-seal-to-memfd-fix-2 +++ a/mm/shmem.c @@ -2127,20 +2127,22 @@ static int shmem_mmap(struct file *file, { struct shmem_inode_info *info = SHMEM_I(file_inode(file)); - /* - * New PROT_READ and MAP_SHARED mmaps are not allowed when "future - * write" seal active. - */ - if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_WRITE) && - (info->seals & F_SEAL_FUTURE_WRITE)) - return -EPERM; - /* - * Since the F_SEAL_FUTURE_WRITE seals allow for a MAP_SHARED read-only - * mapping, take care to not allow mprotect to revert protections. - */ - if (info->seals & F_SEAL_FUTURE_WRITE) + if (info->seals & F_SEAL_FUTURE_WRITE) { + /* + * New PROT_WRITE and MAP_SHARED mmaps are not allowed when + * "future write" seal active. + */ + if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_WRITE)) + return -EPERM; + + /* + * Since the F_SEAL_FUTURE_WRITE seals allow for a MAP_SHARED + * read-only mapping, take care to not allow mprotect to revert + * protections. + */ vma->vm_flags &= ~(VM_MAYWRITE); + } file_accessed(file); vma->vm_ops = &shmem_vm_ops; _ Patches currently in -mm which might be from joel@xxxxxxxxxxxxxxxxx are mm-add-an-f_seal_future_write-seal-to-memfd.patch selftests-memfd-add-tests-for-f_seal_future_write-seal.patch selftests-memfd-add-tests-for-f_seal_future_write-seal-fix.patch