From b07db605e19d189265d12c5e5aea5f03c7042171 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 8 Sep 2009 19:49:40 -0700 Subject: [PATCH] --- yaml --- r: 157283 b: refs/heads/master c: 752015d1b0683a8c623ebfe4c62893413e9b30d3 h: refs/heads/master i: 157281: 4041410ee18cd874b1c3da17e638afc9f03ddeb3 157279: a754a678cd7f564d64f40f9237598dead81180b2 v: v3 --- [refs] | 2 +- trunk/fs/binfmt_elf.c | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index d645a15da8f1..f09ee68bf5d1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 74fca6a42863ffacaf7ba6f1936a9f228950f657 +refs/heads/master: 752015d1b0683a8c623ebfe4c62893413e9b30d3 diff --git a/trunk/fs/binfmt_elf.c b/trunk/fs/binfmt_elf.c index b7c1603cd4bd..7c1e65d54872 100644 --- a/trunk/fs/binfmt_elf.c +++ b/trunk/fs/binfmt_elf.c @@ -501,22 +501,22 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex, } } - /* - * Now fill out the bss section. First pad the last page up - * to the page boundary, and then perform a mmap to make sure - * that there are zero-mapped pages up to and including the - * last bss page. - */ - if (padzero(elf_bss)) { - error = -EFAULT; - goto out_close; - } + if (last_bss > elf_bss) { + /* + * Now fill out the bss section. First pad the last page up + * to the page boundary, and then perform a mmap to make sure + * that there are zero-mapped pages up to and including the + * last bss page. + */ + if (padzero(elf_bss)) { + error = -EFAULT; + goto out_close; + } - /* What we have mapped so far */ - elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1); + /* What we have mapped so far */ + elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1); - /* Map the last of the bss segment */ - if (last_bss > elf_bss) { + /* Map the last of the bss segment */ down_write(¤t->mm->mmap_sem); error = do_brk(elf_bss, last_bss - elf_bss); up_write(¤t->mm->mmap_sem);