Replace use of the legacy vm_flags_t flags with vma_flags_t values in the
SELinux mmap backing file and mprotect LSM hooks.

No functional change intended.

Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]>
Acked-by: Paul Moore <[email protected]>
Reviewed-by: Lance Yang <[email protected]>
---
 security/selinux/hooks.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 9950f89dfaa2..5198a66b624b 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4205,16 +4205,16 @@ static int selinux_mmap_backing_file(struct 
vm_area_struct *vma,
 {
        unsigned long prot = 0;
 
-       /* translate vma->vm_flags perms into PROT perms */
-       if (vma->vm_flags & VM_READ)
+       /* translate VMA flag perms into PROT perms */
+       if (vma_test(vma, VMA_READ_BIT))
                prot |= PROT_READ;
-       if (vma->vm_flags & VM_WRITE)
+       if (vma_test(vma, VMA_WRITE_BIT))
                prot |= PROT_WRITE;
-       if (vma->vm_flags & VM_EXEC)
+       if (vma_test(vma, VMA_EXEC_BIT))
                prot |= PROT_EXEC;
 
        return selinux_mmap_file_common(backing_file, prot,
-                                       vma->vm_flags & VM_SHARED,
+                                       vma_test(vma, VMA_SHARED_BIT),
                                        true);
 }
 
@@ -4228,13 +4228,13 @@ static int selinux_file_mprotect(struct vm_area_struct 
*vma,
        u32 av;
        const struct file *file = vma->vm_file;
        bool backing_file;
-       bool shared = vma->vm_flags & VM_SHARED;
+       bool shared = vma_test(vma, VMA_SHARED_BIT);
 
        /* check if we need to trigger the "backing files are awful" mode */
        backing_file = file && (file->f_mode & FMODE_BACKING);
 
        if (default_noexec &&
-           (prot & PROT_EXEC) && !(vma->vm_flags & VM_EXEC)) {
+           (prot & PROT_EXEC) && !vma_test(vma, VMA_EXEC_BIT)) {
                /*
                 * We don't use the vma_is_initial_heap() helper as it has
                 * a history of problems and is currently broken on systems

-- 
2.56.1


Reply via email to