Commit 77f6af77 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

uml: don't try to handle signals on initial process stack

Code running on the initial UML stack can't receive or process signals since
current must be valid when IRQs are handled, and there is no current for this
stack.

So, instead of using UML_LONGJMP and UML_SETJMP, which are careful to save and
restore signal state, and, as a side-effect, handle any deferred signals,
start_idle_thread must use the bare equivalents, which don't do anything with
signals.
Signed-off-by: default avatarJeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 63843c26
...@@ -494,7 +494,15 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf) ...@@ -494,7 +494,15 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM, SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM,
SIGVTALRM, -1); SIGVTALRM, -1);
n = UML_SETJMP(&initial_jmpbuf); /*
* Can't use UML_SETJMP or UML_LONGJMP here because they save
* and restore signals, with the possible side-effect of
* trying to handle any signals which came when they were
* blocked, which can't be done on this stack.
* Signals must be blocked when jumping back here and restored
* after returning to the jumper.
*/
n = setjmp(initial_jmpbuf);
switch(n){ switch(n){
case INIT_JMP_NEW_THREAD: case INIT_JMP_NEW_THREAD:
(*switch_buf)[0].JB_IP = (unsigned long) new_thread_handler; (*switch_buf)[0].JB_IP = (unsigned long) new_thread_handler;
...@@ -504,7 +512,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf) ...@@ -504,7 +512,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
break; break;
case INIT_JMP_CALLBACK: case INIT_JMP_CALLBACK:
(*cb_proc)(cb_arg); (*cb_proc)(cb_arg);
UML_LONGJMP(cb_back, 1); longjmp(*cb_back, 1);
break; break;
case INIT_JMP_HALT: case INIT_JMP_HALT:
kmalloc_ok = 0; kmalloc_ok = 0;
...@@ -515,7 +523,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf) ...@@ -515,7 +523,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
default: default:
panic("Bad sigsetjmp return in start_idle_thread - %d\n", n); panic("Bad sigsetjmp return in start_idle_thread - %d\n", n);
} }
UML_LONGJMP(switch_buf, 1); longjmp(*switch_buf, 1);
} }
void initial_thread_cb_skas(void (*proc)(void *), void *arg) void initial_thread_cb_skas(void (*proc)(void *), void *arg)
......
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