Commit 8f5bb043 authored by Yoshinori Sato's avatar Yoshinori Sato Committed by Linus Torvalds

[PATCH] binfmt_flat mmap flag fix

Make sure that binfmt_flat passes the correct flags into do_mmap().  nommu's
validate_mmap_request() will simple return -EINVAL if we try and pass it a
flags value of zero.
Signed-off-by: default avatarYoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d671a1cb
...@@ -520,7 +520,7 @@ static int load_flat_file(struct linux_binprm * bprm, ...@@ -520,7 +520,7 @@ static int load_flat_file(struct linux_binprm * bprm,
DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n"); DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n");
down_write(&current->mm->mmap_sem); down_write(&current->mm->mmap_sem);
textpos = do_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC, 0, 0); textpos = do_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC, MAP_SHARED, 0);
up_write(&current->mm->mmap_sem); up_write(&current->mm->mmap_sem);
if (!textpos || textpos >= (unsigned long) -4096) { if (!textpos || textpos >= (unsigned long) -4096) {
if (!textpos) if (!textpos)
...@@ -532,7 +532,7 @@ static int load_flat_file(struct linux_binprm * bprm, ...@@ -532,7 +532,7 @@ static int load_flat_file(struct linux_binprm * bprm,
down_write(&current->mm->mmap_sem); down_write(&current->mm->mmap_sem);
realdatastart = do_mmap(0, 0, data_len + extra + realdatastart = do_mmap(0, 0, data_len + extra +
MAX_SHARED_LIBS * sizeof(unsigned long), MAX_SHARED_LIBS * sizeof(unsigned long),
PROT_READ|PROT_WRITE|PROT_EXEC, 0, 0); PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0);
up_write(&current->mm->mmap_sem); up_write(&current->mm->mmap_sem);
if (realdatastart == 0 || realdatastart >= (unsigned long)-4096) { if (realdatastart == 0 || realdatastart >= (unsigned long)-4096) {
...@@ -574,7 +574,7 @@ static int load_flat_file(struct linux_binprm * bprm, ...@@ -574,7 +574,7 @@ static int load_flat_file(struct linux_binprm * bprm,
down_write(&current->mm->mmap_sem); down_write(&current->mm->mmap_sem);
textpos = do_mmap(0, 0, text_len + data_len + extra + textpos = do_mmap(0, 0, text_len + data_len + extra +
MAX_SHARED_LIBS * sizeof(unsigned long), MAX_SHARED_LIBS * sizeof(unsigned long),
PROT_READ | PROT_EXEC | PROT_WRITE, 0, 0); PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0);
up_write(&current->mm->mmap_sem); up_write(&current->mm->mmap_sem);
if (!textpos || textpos >= (unsigned long) -4096) { if (!textpos || textpos >= (unsigned long) -4096) {
if (!textpos) if (!textpos)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment