Commit 7420e97c authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] UML fixes

The patch below fixes a few UML-specific bugs not related to the rest of the
kernel
	a bogus error return and some formatting in the fork code
	correct calculation of task.thread.kernel_stack
	remove a bogus panic
	a couple of fixes to allow UML to boot in the presence of exec-shield
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 04fa5a56
...@@ -124,10 +124,14 @@ int start_fork_tramp(void *thread_arg, unsigned long temp_stack, ...@@ -124,10 +124,14 @@ int start_fork_tramp(void *thread_arg, unsigned long temp_stack,
/* Start the process and wait for it to kill itself */ /* Start the process and wait for it to kill itself */
new_pid = clone(outer_tramp, (void *) sp, clone_flags, &arg); new_pid = clone(outer_tramp, (void *) sp, clone_flags, &arg);
if(new_pid < 0) return(-errno); if(new_pid < 0)
return(new_pid);
CATCH_EINTR(err = waitpid(new_pid, &status, 0)); CATCH_EINTR(err = waitpid(new_pid, &status, 0));
if(err < 0) panic("Waiting for outer trampoline failed - errno = %d", if(err < 0)
errno); panic("Waiting for outer trampoline failed - errno = %d",
errno);
if(!WIFSIGNALED(status) || (WTERMSIG(status) != SIGKILL)) if(!WIFSIGNALED(status) || (WTERMSIG(status) != SIGKILL))
panic("outer trampoline didn't exit with SIGKILL, " panic("outer trampoline didn't exit with SIGKILL, "
"status = %d", status); "status = %d", status);
......
...@@ -167,7 +167,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -167,7 +167,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
{ {
p->thread = (struct thread_struct) INIT_THREAD; p->thread = (struct thread_struct) INIT_THREAD;
p->thread.kernel_stack = p->thread.kernel_stack =
(unsigned long) p->thread_info + THREAD_SIZE; (unsigned long) p->thread_info + 2 * PAGE_SIZE;
return(CHOOSE_MODE_PROC(copy_thread_tt, copy_thread_skas, nr, return(CHOOSE_MODE_PROC(copy_thread_tt, copy_thread_skas, nr,
clone_flags, sp, stack_top, p, regs)); clone_flags, sp, stack_top, p, regs));
} }
......
...@@ -54,8 +54,6 @@ int handle_page_fault(unsigned long address, unsigned long ip, ...@@ -54,8 +54,6 @@ int handle_page_fault(unsigned long address, unsigned long ip,
if(is_write && !(vma->vm_flags & VM_WRITE)) if(is_write && !(vma->vm_flags & VM_WRITE))
goto out; goto out;
page = address & PAGE_MASK; page = address & PAGE_MASK;
if(address < (unsigned long) current_thread + 1024 && !is_user)
panic("Kernel stack overflow");
pgd = pgd_offset(mm, page); pgd = pgd_offset(mm, page);
pmd = pmd_offset(pgd, page); pmd = pmd_offset(pgd, page);
do { do {
......
...@@ -18,7 +18,7 @@ void before_mem_tt(unsigned long brk_start) ...@@ -18,7 +18,7 @@ void before_mem_tt(unsigned long brk_start)
if(!jail || debug) if(!jail || debug)
remap_data(UML_ROUND_DOWN(&_stext), UML_ROUND_UP(&_etext), 1); remap_data(UML_ROUND_DOWN(&_stext), UML_ROUND_UP(&_etext), 1);
remap_data(UML_ROUND_DOWN(&_sdata), UML_ROUND_UP(&_edata), 1); remap_data(UML_ROUND_DOWN(&_sdata), UML_ROUND_UP(&_edata), 1);
remap_data(UML_ROUND_DOWN(&__bss_start), UML_ROUND_UP(brk_start), 1); remap_data(UML_ROUND_DOWN(&__bss_start), UML_ROUND_UP(&_end), 1);
} }
#ifdef CONFIG_HOST_2G_2G #ifdef CONFIG_HOST_2G_2G
......
...@@ -412,7 +412,7 @@ static void mprotect_kernel_mem(int w) ...@@ -412,7 +412,7 @@ static void mprotect_kernel_mem(int w)
protect_memory(start, end - start, 1, w, 1, 1); protect_memory(start, end - start, 1, w, 1, 1);
start = (unsigned long) UML_ROUND_DOWN(&__bss_start); start = (unsigned long) UML_ROUND_DOWN(&__bss_start);
end = (unsigned long) UML_ROUND_UP(brk_start); end = (unsigned long) UML_ROUND_UP(&_end);
protect_memory(start, end - start, 1, w, 1, 1); protect_memory(start, end - start, 1, w, 1, 1);
mprotect_kernel_vm(w); mprotect_kernel_vm(w);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment