Commit 92515da7 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] uml: fix segfault on exit with CONFIG_GCOV

We need to disable signals on exit in all cases, not just when rebooting.
Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0894e27e
...@@ -87,7 +87,7 @@ int main(int argc, char **argv, char **envp) ...@@ -87,7 +87,7 @@ int main(int argc, char **argv, char **envp)
{ {
char **new_argv; char **new_argv;
sigset_t mask; sigset_t mask;
int ret, i; int ret, i, err;
/* Enable all signals except SIGIO - in some environments, we can /* Enable all signals except SIGIO - in some environments, we can
* enter with some signals blocked * enter with some signals blocked
...@@ -160,11 +160,11 @@ int main(int argc, char **argv, char **envp) ...@@ -160,11 +160,11 @@ int main(int argc, char **argv, char **envp)
*/ */
change_sig(SIGPROF, 0); change_sig(SIGPROF, 0);
/* Reboot */ /* This signal stuff used to be in the reboot case. However,
if(ret){ * sometimes a SIGVTALRM can come in when we're halting (reproducably
int err; * when writing out gcov information, presumably because that takes
* some time) and cause a segfault.
printf("\n"); */
/* stop timers and set SIG*ALRM to be ignored */ /* stop timers and set SIG*ALRM to be ignored */
disable_timer(); disable_timer();
...@@ -172,8 +172,7 @@ int main(int argc, char **argv, char **envp) ...@@ -172,8 +172,7 @@ int main(int argc, char **argv, char **envp)
/* disable SIGIO for the fds and set SIGIO to be ignored */ /* disable SIGIO for the fds and set SIGIO to be ignored */
err = deactivate_all_fds(); err = deactivate_all_fds();
if(err) if(err)
printf("deactivate_all_fds failed, errno = %d\n", printf("deactivate_all_fds failed, errno = %d\n", -err);
-err);
/* Let any pending signals fire now. This ensures /* Let any pending signals fire now. This ensures
* that they won't be delivered after the exec, when * that they won't be delivered after the exec, when
...@@ -181,6 +180,9 @@ int main(int argc, char **argv, char **envp) ...@@ -181,6 +180,9 @@ int main(int argc, char **argv, char **envp)
*/ */
unblock_signals(); unblock_signals();
/* Reboot */
if(ret){
printf("\n");
execvp(new_argv[0], new_argv); execvp(new_argv[0], new_argv);
perror("Failed to exec kernel"); perror("Failed to exec kernel");
ret = 1; ret = 1;
......
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