fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / x86_64 / ia32 / ia32_aout.c
index 4fecd67..423e9a5 100644 (file)
 #undef WARN_OLD
 #undef CORE_DUMP /* probably broken */
 
-extern int ia32_setup_arg_pages(struct linux_binprm *bprm,
-                               unsigned long stack_top, int exec_stack);
-
 static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
 static int load_aout_library(struct file*);
 
-#if CORE_DUMP
+#ifdef CORE_DUMP
 static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file);
 
 /*
@@ -104,7 +101,7 @@ static struct linux_binfmt aout_format = {
        .module         = THIS_MODULE,
        .load_binary    = load_aout_binary,
        .load_shlib     = load_aout_library,
-#if CORE_DUMP
+#ifdef CORE_DUMP
        .core_dump      = aout_core_dump,
 #endif
        .min_coredump   = PAGE_SIZE
@@ -121,7 +118,7 @@ static void set_brk(unsigned long start, unsigned long end)
        up_write(&current->mm->mmap_sem);
 }
 
-#if CORE_DUMP
+#ifdef CORE_DUMP
 /*
  * These are the only things you should do on a core-file: use only these
  * macros to write out all the necessary info.
@@ -183,9 +180,9 @@ static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file)
 
 /* make sure we actually have a data and stack area to dump */
        set_fs(USER_DS);
-       if (verify_area(VERIFY_READ, (void *) (unsigned long)START_DATA(dump), dump.u_dsize << PAGE_SHIFT))
+       if (!access_ok(VERIFY_READ, (void *) (unsigned long)START_DATA(dump), dump.u_dsize << PAGE_SHIFT))
                dump.u_dsize = 0;
-       if (verify_area(VERIFY_READ, (void *) (unsigned long)START_STACK(dump), dump.u_ssize << PAGE_SHIFT))
+       if (!access_ok(VERIFY_READ, (void *) (unsigned long)START_STACK(dump), dump.u_ssize << PAGE_SHIFT))
                dump.u_ssize = 0;
 
        set_fs(KERNEL_DS);
@@ -245,7 +242,7 @@ static u32 __user *create_aout_tables(char __user *p, struct linux_binprm *bprm)
                        get_user(c,p++);
                } while (c);
        }
-       put_user(NULL,argv);
+       put_user(0, argv);
        current->mm->arg_end = current->mm->env_start = (unsigned long) p;
        while (envc-->0) {
                char c;
@@ -254,7 +251,7 @@ static u32 __user *create_aout_tables(char __user *p, struct linux_binprm *bprm)
                        get_user(c,p++);
                } while (c);
        }
-       put_user(NULL,envp);
+       put_user(0, envp);
        current->mm->env_end = (unsigned long) p;
        return sp;
 }
@@ -276,7 +273,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
        if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC &&
             N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) ||
            N_TRSIZE(ex) || N_DRSIZE(ex) ||
-           i_size_read(bprm->file->f_dentry->d_inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
+           i_size_read(bprm->file->f_path.dentry->d_inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
                return -ENOEXEC;
        }
 
@@ -313,8 +310,8 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
        current->mm->brk = ex.a_bss +
                (current->mm->start_brk = N_BSSADDR(ex));
        current->mm->free_area_cache = TASK_UNMAPPED_BASE;
+       current->mm->cached_hole_size = 0;
 
-       vx_rsspages_sub(current->mm, current->mm->rss);
        current->mm->mmap = NULL;
        compute_creds(bprm);
        current->flags &= ~PF_FORKNOEXEC;
@@ -337,7 +334,8 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                        return error;
                }
 
-               error = bprm->file->f_op->read(bprm->file, (char *)text_addr,
+               error = bprm->file->f_op->read(bprm->file,
+                        (char __user *)text_addr,
                          ex.a_text+ex.a_data, &pos);
                if ((signed long)error < 0) {
                        send_sig(SIGKILL, current, 0);
@@ -360,7 +358,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                {
                        printk(KERN_WARNING 
                               "fd_offset is not page aligned. Please convert program: %s\n",
-                              bprm->file->f_dentry->d_name.name);
+                              bprm->file->f_path.dentry->d_name.name);
                        error_time = jiffies;
                }
 #endif
@@ -370,7 +368,8 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                        down_write(&current->mm->mmap_sem);
                        do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
                        up_write(&current->mm->mmap_sem);
-                       bprm->file->f_op->read(bprm->file,(char *)N_TXTADDR(ex),
+                       bprm->file->f_op->read(bprm->file,
+                                       (char __user *)N_TXTADDR(ex),
                                        ex.a_text+ex.a_data, &pos);
                        flush_icache_range((unsigned long) N_TXTADDR(ex),
                                           (unsigned long) N_TXTADDR(ex) +
@@ -425,12 +424,6 @@ beyond_if:
        (regs)->cs = __USER32_CS;
        (regs)->ss = __USER32_DS;
        set_fs(USER_DS);
-       if (unlikely(current->ptrace & PT_PTRACED)) {
-               if (current->ptrace & PT_TRACE_EXEC)
-                       ptrace_notify ((PTRACE_EVENT_EXEC << 8) | SIGTRAP);
-               else
-                       send_sig(SIGTRAP, current, 0);
-       }
        return 0;
 }
 
@@ -442,7 +435,7 @@ static int load_aout_library(struct file *file)
        int retval;
        struct exec ex;
 
-       inode = file->f_dentry->d_inode;
+       inode = file->f_path.dentry->d_inode;
 
        retval = -ENOEXEC;
        error = kernel_read(file, 0, (char *) &ex, sizeof(ex));
@@ -473,7 +466,7 @@ static int load_aout_library(struct file *file)
                {
                        printk(KERN_WARNING 
                               "N_TXTOFF is not page aligned. Please convert library: %s\n",
-                              file->f_dentry->d_name.name);
+                              file->f_path.dentry->d_name.name);
                        error_time = jiffies;
                }
 #endif
@@ -481,7 +474,7 @@ static int load_aout_library(struct file *file)
                do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
                up_write(&current->mm->mmap_sem);
                
-               file->f_op->read(file, (char *)start_addr,
+               file->f_op->read(file, (char __user *)start_addr,
                        ex.a_text + ex.a_data, &pos);
                flush_icache_range((unsigned long) start_addr,
                                   (unsigned long) start_addr + ex.a_text + ex.a_data);