Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Yoshinori Sato and committed by
Linus Torvalds
8f5bb043 d671a1cb

+3 -3
+3 -3
fs/binfmt_flat.c
··· 520 520 DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n"); 521 521 522 522 down_write(&current->mm->mmap_sem); 523 - textpos = do_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC, 0, 0); 523 + textpos = do_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC, MAP_SHARED, 0); 524 524 up_write(&current->mm->mmap_sem); 525 525 if (!textpos || textpos >= (unsigned long) -4096) { 526 526 if (!textpos) ··· 532 532 down_write(&current->mm->mmap_sem); 533 533 realdatastart = do_mmap(0, 0, data_len + extra + 534 534 MAX_SHARED_LIBS * sizeof(unsigned long), 535 - PROT_READ|PROT_WRITE|PROT_EXEC, 0, 0); 535 + PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); 536 536 up_write(&current->mm->mmap_sem); 537 537 538 538 if (realdatastart == 0 || realdatastart >= (unsigned long)-4096) { ··· 574 574 down_write(&current->mm->mmap_sem); 575 575 textpos = do_mmap(0, 0, text_len + data_len + extra + 576 576 MAX_SHARED_LIBS * sizeof(unsigned long), 577 - PROT_READ | PROT_EXEC | PROT_WRITE, 0, 0); 577 + PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); 578 578 up_write(&current->mm->mmap_sem); 579 579 if (!textpos || textpos >= (unsigned long) -4096) { 580 580 if (!textpos)