[PATCH 02/16] mm: use get_personality()

From: WANG Cong
Date: Sat Feb 23 2008 - 03:29:54 EST


Use get_personality() macro instead of explicit reference
for mm/ code.

Signed-off-by: WANG Cong <xiyou.wangcong@xxxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Cc: Christoph Lameter <clameter@xxxxxxx>

---
mm/mmap.c | 2 +-
mm/mprotect.c | 2 +-
mm/nommu.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index a32d28c..42d647f 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -910,7 +910,7 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
* (the exception is when the underlying filesystem is noexec
* mounted, in which case we dont add PROT_EXEC.)
*/
- if ((prot & PROT_READ) && (current->personality & READ_IMPLIES_EXEC))
+ if ((prot & PROT_READ) && (get_personality() & READ_IMPLIES_EXEC))
if (!(file && (file->f_path.mnt->mnt_flags & MNT_NOEXEC)))
prot |= PROT_EXEC;

diff --git a/mm/mprotect.c b/mm/mprotect.c
index 4de5468..620b8db 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -237,7 +237,7 @@ sys_mprotect(unsigned long start, size_t len, unsigned long prot)
/*
* Does the application expect PROT_READ to imply PROT_EXEC:
*/
- if ((prot & PROT_READ) && (current->personality & READ_IMPLIES_EXEC))
+ if ((prot & PROT_READ) && (get_personality() & READ_IMPLIES_EXEC))
prot |= PROT_EXEC;

vm_flags = calc_vm_prot_bits(prot);
diff --git a/mm/nommu.c b/mm/nommu.c
index 5d8ae08..a1c6162 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -665,7 +665,7 @@ static int validate_mmap_request(struct file *file,
}
else if ((prot & PROT_READ) && !(prot & PROT_EXEC)) {
/* handle implication of PROT_EXEC by PROT_READ */
- if (current->personality & READ_IMPLIES_EXEC) {
+ if (get_personality() & READ_IMPLIES_EXEC) {
if (capabilities & BDI_CAP_EXEC_MAP)
prot |= PROT_EXEC;
}
@@ -686,7 +686,7 @@ static int validate_mmap_request(struct file *file,

/* handle PROT_EXEC implication by PROT_READ */
if ((prot & PROT_READ) &&
- (current->personality & READ_IMPLIES_EXEC))
+ (get_personality() & READ_IMPLIES_EXEC))
prot |= PROT_EXEC;
}

--
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/