patch-2.1.86 linux/fs/binfmt_elf.c

Next file: linux/fs/coda/file.c
Previous file: linux/fs/affs/namei.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.85/linux/fs/binfmt_elf.c linux/fs/binfmt_elf.c
@@ -432,7 +432,6 @@
 	unsigned long elf_entry, interp_load_addr = 0;
 	int status;
 	unsigned long start_code, end_code, end_data;
-	unsigned long elf_stack;
 	char passed_fileno[6];
 
 	ibcs2_interpreter = 0;
@@ -484,7 +483,6 @@
 
 	file = current->files->fd[elf_exec_fileno];
 
-	elf_stack = ~0UL;
 	elf_interpreter = NULL;
 	start_code = ~0UL;
 	end_code = 0;
@@ -620,12 +618,13 @@
 	current->mm->mmap = NULL;
 	elf_entry = (unsigned long) elf_ex.e_entry;
 
+	/* Do this immediately, since STACK_TOP as used in setup_arg_pages
+	   may depend on the personality.  */
+	SET_PERSONALITY(elf_ex, ibcs2_interpreter);
+
 	/* Do this so that we can load the interpreter, if need be.  We will
 	   change some of these later */
 	current->mm->rss = 0;
-#ifdef ELF_FLAGS_INIT
-	ELF_FLAGS_INIT;
-#endif
 	bprm->p = setup_arg_pages(bprm->p, bprm);
 	current->mm->start_stack = bprm->p;
 
@@ -666,11 +665,6 @@
 					(elf_ppnt->p_offset -
 					 ELF_PAGEOFFSET(elf_ppnt->p_vaddr)));
 
-#ifdef LOW_ELF_STACK
-			if (error < elf_stack)
-				elf_stack = error-1;
-#endif
-
 			if (!load_addr_set) {
 				load_addr_set = 1;
 				load_addr = (elf_ppnt->p_vaddr -
@@ -722,8 +716,8 @@
 
 	kfree(elf_phdata);
 
-	if (interpreter_type != INTERPRETER_AOUT) sys_close(elf_exec_fileno);
-	SET_PERSONALITY(ibcs2_interpreter);
+	if (interpreter_type != INTERPRETER_AOUT)
+		sys_close(elf_exec_fileno);
 
 	if (current->exec_domain && current->exec_domain->module)
 		__MOD_DEC_USE_COUNT(current->exec_domain->module);
@@ -738,9 +732,6 @@
 
 #ifndef VM_STACK_FLAGS
 	current->executable = dget(bprm->dentry);
-#endif
-#ifdef LOW_ELF_STACK
-	current->start_stack = bprm->p = elf_stack;
 #endif
 	current->suid = current->euid = current->fsuid = bprm->e_uid;
 	current->sgid = current->egid = current->fsgid = bprm->e_gid;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov