[CIFS] CIFS should honour umask
[linux-drm-fsl-dcu.git] / fs / binfmt_elf_fdpic.c
index a4d933a51208c5bcbfdd182b2412c3b1d369c140..9d62fbad3d4b4fc121a91323d05ab4809aa78c28 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/personality.h>
 #include <linux/ptrace.h>
 #include <linux/init.h>
-#include <linux/smp_lock.h>
 #include <linux/elf.h>
 #include <linux/elf-fdpic.h>
 #include <linux/elfcore.h>
@@ -179,6 +178,8 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
        int executable_stack;
        int retval, i;
 
+       kdebug("____ LOAD %d ____", current->pid);
+
        memset(&exec_params, 0, sizeof(exec_params));
        memset(&interp_params, 0, sizeof(interp_params));
 
@@ -372,7 +373,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
        down_write(&current->mm->mmap_sem);
        current->mm->start_brk = do_mmap(NULL, 0, stack_size,
                                         PROT_READ | PROT_WRITE | PROT_EXEC,
-                                        MAP_PRIVATE | MAP_ANON | MAP_GROWSDOWN,
+                                        MAP_PRIVATE | MAP_ANONYMOUS | MAP_GROWSDOWN,
                                         0);
 
        if (IS_ERR_VALUE(current->mm->start_brk)) {
@@ -941,8 +942,11 @@ static int elf_fdpic_map_file_constdisp_on_uclinux(
 
                if (mm) {
                        if (phdr->p_flags & PF_X) {
-                               mm->start_code = seg->addr;
-                               mm->end_code = seg->addr + phdr->p_memsz;
+                               if (!mm->start_code) {
+                                       mm->start_code = seg->addr;
+                                       mm->end_code = seg->addr +
+                                               phdr->p_memsz;
+                               }
                        } else if (!mm->start_data) {
                                mm->start_data = seg->addr;
 #ifndef CONFIG_MMU
@@ -1123,8 +1127,10 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
 
                if (mm) {
                        if (phdr->p_flags & PF_X) {
-                               mm->start_code = maddr;
-                               mm->end_code = maddr + phdr->p_memsz;
+                               if (!mm->start_code) {
+                                       mm->start_code = maddr;
+                                       mm->end_code = maddr + phdr->p_memsz;
+                               }
                        } else if (!mm->start_data) {
                                mm->start_data = maddr;
                                mm->end_data = maddr + phdr->p_memsz;
@@ -1473,8 +1479,8 @@ static int elf_fdpic_dump_segments(struct file *file, struct mm_struct *mm,
                                DUMP_SEEK(file->f_pos + PAGE_SIZE);
                        }
                        else if (page == ZERO_PAGE(addr)) {
-                               DUMP_SEEK(file->f_pos + PAGE_SIZE);
                                page_cache_release(page);
+                               DUMP_SEEK(file->f_pos + PAGE_SIZE);
                        }
                        else {
                                void *kaddr;