From: Coly Li <coyli@suse.de>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] use VM_READ/WRITE/EXEC to set vm_page_prot
Date: Mon, 03 Sep 2007 01:38:25 +0800 [thread overview]
Message-ID: <46DAF511.6030406@suse.de> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1900 bytes --]
When setup vm_page_prot, some code use 0x7 instead of (VM_READ|VM_WRITE|VM_EXEC). It does works
well, but it will be better if we use the VM_READ/WRITE/EXEC MACRO :-)
This patch uses (VM_READ|VM_WRITE|VM_EXEC) to replace 0x7 in vm_page_prot setup.
Signed-Off-By: Coly Li <coyli@suse.de>
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index c14abef..864a9f3 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -130,7 +130,8 @@ ia64_init_addr_space (void)
vma->vm_mm = current->mm;
vma->vm_start = current->thread.rbs_bot & PAGE_MASK;
vma->vm_end = vma->vm_start + PAGE_SIZE;
- vma->vm_page_prot = protection_map[VM_DATA_DEFAULT_FLAGS & 0x7];
+ vma->vm_page_prot = protection_map[VM_DATA_DEFAULT_FLAGS &
+ (VM_READ|VM_WRITE|VM_EXEC)];
vma->vm_flags = VM_DATA_DEFAULT_FLAGS|VM_GROWSUP|VM_ACCOUNT;
down_write(¤t->mm->mmap_sem);
if (insert_vm_struct(current->mm, vma)) {
diff --git a/fs/exec.c b/fs/exec.c
index c21a8cc..cca277f 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -261,7 +261,8 @@ static int __bprm_mm_init(struct linux_binprm *bprm)
vma->vm_start = vma->vm_end - PAGE_SIZE;
vma->vm_flags = VM_STACK_FLAGS;
- vma->vm_page_prot = protection_map[vma->vm_flags & 0x7];
+ vma->vm_page_prot = protection_map[vma->vm_flags &
+ (VM_READ|VM_WRITE|VM_EXEC)];
err = insert_vm_struct(mm, vma);
if (err) {
up_write(&mm->mmap_sem);
diff --git a/mm/mmap.c b/mm/mmap.c
index 0d40e66..18d33f2 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2210,7 +2210,8 @@ int install_special_mapping(struct mm_struct *mm,
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;
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
next reply other threads:[~2007-09-02 17:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-02 17:38 Coly Li [this message]
2007-09-21 17:30 ` [PATCH] use VM_READ/WRITE/EXEC to set vm_page_prot Hugh Dickins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46DAF511.6030406@suse.de \
--to=coyli@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.