Skip to contentSkip to conversation

Use VM_ flags in protection_map rather than magic value

PATCH In review Matt Helsley 2 participants 2 messages Nov 6, 2007 – Nov 7, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use VM_ flags in protection_map rather than magic value

Replace the magic value with a mask of flags that produce the same value. This is consistent with the other uses of protection_map[].

---
 mm/mmap.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mm/mmap.c +2 -1
Index: linux-2.6.23/mm/mmap.c
===================================================================
@@ -2245,11 +2245,12 @@ int install_special_mapping(struct mm_st
 	vma->vm_mm = mm;
 	vma->vm_start = addr;
 	vma->vm_end = addr + len;
 
 	vma->vm_flags = vm_flags | mm->def_flags;
-	vma->vm_page_prot = protection_map[vma->vm_flags & 7];
+	vma->vm_page_prot = protection_map[vma->vm_flags &
+						(VM_READ|VM_WRITE|VM_EXEC)];
 
 	vma->vm_ops = &special_mapping_vmops;
 	vma->vm_private_data = pages;
 
 	if (unlikely(insert_vm_struct(mm, vma))) {

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 4 lines · Matt Helsley

Replace the magic value with a mask of flags that produce the same value. This is consistent with the other uses of protection_map[].

Thanks, but this comes just a little too late: see 2.6.24-rc1 or -rc2. Hugh

Quoted 12 lines
---
 mm/mmap.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.23/mm/mmap.c
===================================================================

mm/mmap.c +0 -0
@@ -2245,11 +2245,12 @@ int install_special_mapping(struct mm_st
 	vma->vm_mm = mm;
 	vma->vm_start = addr;
 	vma->vm_end = addr + len;

mm/mmap.c int install_special_mapping(struct mm_st · line 2256

Quoted 10 lines
mm/mmap.c +2 -1
 
 	vma->vm_flags = vm_flags | mm->def_flags;
-	vma->vm_page_prot = protection_map[vma->vm_flags & 7];
+	vma->vm_page_prot = protection_map[vma->vm_flags &
+						(VM_READ|VM_WRITE|VM_EXEC)];
 
 	vma->vm_ops = &special_mapping_vmops;
 	vma->vm_private_data = pages;
 
 	if (unlikely(insert_vm_struct(mm, vma))) {

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>