Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 180047
b: refs/heads/master
c: 221af7f
h: refs/heads/master
i:
  180045: 3c4f528
  180043: 0735eac
  180039: 2073222
  180031: 8cc1cab
v: v3
  • Loading branch information
Linus Torvalds committed Jan 29, 2010
1 parent 2e7dc81 commit ea2331c
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 42 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 64a028a6de08545a2c94f302bc7694bf48aee5b5
refs/heads/master: 221af7f87b97431e3ee21ce4b0e77d5411cf1549
2 changes: 1 addition & 1 deletion trunk/arch/sh/kernel/process_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ void exit_thread(void)
void flush_thread(void)
{

/* Called by fs/exec.c (flush_old_exec) to remove traces of a
/* Called by fs/exec.c (setup_new_exec) to remove traces of a
* previously running executable. */
#ifdef CONFIG_SH_FPU
if (last_task_used_math == current) {
Expand Down
10 changes: 6 additions & 4 deletions trunk/arch/x86/ia32/ia32_aout.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,17 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
if (retval)
return retval;

regs->cs = __USER32_CS;
regs->r8 = regs->r9 = regs->r10 = regs->r11 = regs->r12 =
regs->r13 = regs->r14 = regs->r15 = 0;

/* OK, This is the point of no return */
set_personality(PER_LINUX);
set_thread_flag(TIF_IA32);
clear_thread_flag(TIF_ABI_PENDING);

setup_new_exec(bprm);

regs->cs = __USER32_CS;
regs->r8 = regs->r9 = regs->r10 = regs->r11 = regs->r12 =
regs->r13 = regs->r14 = regs->r15 = 0;

current->mm->end_code = ex.a_text +
(current->mm->start_code = N_TXTADDR(ex));
current->mm->end_data = ex.a_data +
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/binfmt_aout.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
#else
set_personality(PER_LINUX);
#endif
setup_new_exec(bprm);

current->mm->end_code = ex.a_text +
(current->mm->start_code = N_TXTADDR(ex));
Expand Down
27 changes: 2 additions & 25 deletions trunk/fs/binfmt_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,27 +662,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
if (elf_interpreter[elf_ppnt->p_filesz - 1] != '\0')
goto out_free_interp;

/*
* The early SET_PERSONALITY here is so that the lookup
* for the interpreter happens in the namespace of the
* to-be-execed image. SET_PERSONALITY can select an
* alternate root.
*
* However, SET_PERSONALITY is NOT allowed to switch
* this task into the new images's memory mapping
* policy - that is, TASK_SIZE must still evaluate to
* that which is appropriate to the execing application.
* This is because exit_mmap() needs to have TASK_SIZE
* evaluate to the size of the old image.
*
* So if (say) a 64-bit application is execing a 32-bit
* application it is the architecture's responsibility
* to defer changing the value of TASK_SIZE until the
* switch really is going to happen - do this in
* flush_thread(). - akpm
*/
SET_PERSONALITY(loc->elf_ex);

interpreter = open_exec(elf_interpreter);
retval = PTR_ERR(interpreter);
if (IS_ERR(interpreter))
Expand Down Expand Up @@ -730,9 +709,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
/* Verify the interpreter has a valid arch */
if (!elf_check_arch(&loc->interp_elf_ex))
goto out_free_dentry;
} else {
/* Executables without an interpreter also need a personality */
SET_PERSONALITY(loc->elf_ex);
}

/* Flush all traces of the currently running executable */
Expand All @@ -752,7 +728,8 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)

if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
current->flags |= PF_RANDOMIZE;
arch_pick_mmap_layout(current->mm);

setup_new_exec(bprm);

/* Do this so that we can load the interpreter, if need be. We will
change some of these later */
Expand Down
3 changes: 3 additions & 0 deletions trunk/fs/binfmt_elf_fdpic.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
set_personality(PER_LINUX_FDPIC);
if (elf_read_implies_exec(&exec_params.hdr, executable_stack))
current->personality |= READ_IMPLIES_EXEC;

setup_new_exec(bprm);

set_binfmt(&elf_fdpic_format);

current->mm->start_code = 0;
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/binfmt_flat.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ static int load_flat_file(struct linux_binprm * bprm,

/* OK, This is the point of no return */
set_personality(PER_LINUX_32BIT);
setup_new_exec(bprm);
}

/*
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/binfmt_som.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs)
/* OK, This is the point of no return */
current->flags &= ~PF_FORKNOEXEC;
current->personality = PER_HPUX;
setup_new_exec(bprm);

/* Set the task size for HP-UX processes such that
* the gateway page is outside the address space.
Expand Down
26 changes: 16 additions & 10 deletions trunk/fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,9 +941,7 @@ void set_task_comm(struct task_struct *tsk, char *buf)

int flush_old_exec(struct linux_binprm * bprm)
{
char * name;
int i, ch, retval;
char tcomm[sizeof(current->comm)];
int retval;

/*
* Make sure we have a private signal table and that
Expand All @@ -963,6 +961,20 @@ int flush_old_exec(struct linux_binprm * bprm)
goto out;

bprm->mm = NULL; /* We're using it now */
return 0;

out:
return retval;
}
EXPORT_SYMBOL(flush_old_exec);

void setup_new_exec(struct linux_binprm * bprm)
{
int i, ch;
char * name;
char tcomm[sizeof(current->comm)];

arch_pick_mmap_layout(current->mm);

/* This is the point of no return */
current->sas_ss_sp = current->sas_ss_size = 0;
Expand Down Expand Up @@ -1019,14 +1031,8 @@ int flush_old_exec(struct linux_binprm * bprm)

flush_signal_handlers(current, 0);
flush_old_files(current->files);

return 0;

out:
return retval;
}

EXPORT_SYMBOL(flush_old_exec);
EXPORT_SYMBOL(setup_new_exec);

/*
* Prepare credentials and lock ->cred_guard_mutex.
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/binfmts.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ extern int prepare_binprm(struct linux_binprm *);
extern int __must_check remove_arg_zero(struct linux_binprm *);
extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
extern int flush_old_exec(struct linux_binprm * bprm);
extern void setup_new_exec(struct linux_binprm * bprm);

extern int suid_dumpable;
#define SUID_DUMP_DISABLE 0 /* No setuid dumping */
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ struct task_struct {
char comm[TASK_COMM_LEN]; /* executable name excluding path
- access with [gs]et_task_comm (which lock
it with task_lock())
- initialized normally by flush_old_exec */
- initialized normally by setup_new_exec */
/* file system info */
int link_count, total_link_count;
#ifdef CONFIG_SYSVIPC
Expand Down

0 comments on commit ea2331c

Please sign in to comment.