patch-2.4.19 linux-2.4.19/arch/sparc64/kernel/binfmt_aout32.c

Next file: linux-2.4.19/arch/sparc64/kernel/binfmt_elf32.c
Previous file: linux-2.4.19/arch/sparc64/kernel/Makefile
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/arch/sparc64/kernel/binfmt_aout32.c linux-2.4.19/arch/sparc64/kernel/binfmt_aout32.c
@@ -201,6 +201,7 @@
 	unsigned long error;
 	unsigned long fd_offset;
 	unsigned long rlim;
+	unsigned char orig_thr_flags;
 	int retval;
 
 	ex = *((struct exec *) bprm->buf);		/* exec-header */
@@ -305,8 +306,14 @@
 
 	set_brk(current->mm->start_brk, current->mm->brk);
 
+	/* Make sure STACK_TOP returns the right thing.  */
+	orig_thr_flags = current->thread.flags;
+	current->thread.flags |= SPARC_FLAG_32BIT;
+
 	retval = setup_arg_pages(bprm);
 	if (retval < 0) { 
+		current->thread.flags = orig_thr_flags;
+
 		/* Someone check-me: is this error path enough? */ 
 		send_sig(SIGKILL, current, 0); 
 		return retval;
@@ -314,7 +321,7 @@
 
 	current->mm->start_stack =
 		(unsigned long) create_aout32_tables((char *)bprm->p, bprm);
-	if (!(current->thread.flags & SPARC_FLAG_32BIT)) {
+	if (!(orig_thr_flags & SPARC_FLAG_32BIT)) {
 		unsigned long pgd_cache;
 
 		pgd_cache = ((unsigned long)current->mm->pgd[0])<<11UL;
@@ -323,7 +330,6 @@
 				     : /* no outputs */
 				     : "r" (pgd_cache),
 				       "r" (TSB_REG), "i" (ASI_DMMU));
-		current->thread.flags |= SPARC_FLAG_32BIT;
 	}
 	start_thread32(regs, ex.a_entry, current->mm->start_stack);
 	if (current->ptrace & PT_PTRACED)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)