50 lines
1.3 KiB
Diff
50 lines
1.3 KiB
Diff
|
--- linux-user/syscall.c
|
||
|
+++ linux-user/syscall.c
|
||
|
@@ -2727,7 +2727,8 @@
|
||
|
case TARGET_NR_capset:
|
||
|
goto unimplemented;
|
||
|
case TARGET_NR_sigaltstack:
|
||
|
- goto unimplemented;
|
||
|
+ ret = 0; /* good enough for most purposes */
|
||
|
+ break;
|
||
|
case TARGET_NR_sendfile:
|
||
|
goto unimplemented;
|
||
|
#ifdef TARGET_NR_getpmsg
|
||
|
--- linux-user/signal.c
|
||
|
+++ linux-user/signal.c
|
||
|
@@ -1014,6 +1021,14 @@
|
||
|
return err;
|
||
|
}
|
||
|
|
||
|
+void* hack_stack;
|
||
|
+
|
||
|
+void hack_handler(int signum)
|
||
|
+{
|
||
|
+ fprintf(stderr,"QEMU: stack overflow, aborting\n");
|
||
|
+ exit(-SIGSEGV);
|
||
|
+}
|
||
|
+
|
||
|
static inline void *
|
||
|
get_sigframe(struct emulated_sigaction *ka, CPUState *regs, int framesize)
|
||
|
{
|
||
|
@@ -1026,6 +1041,19 @@
|
||
|
if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
|
||
|
sp = current->sas_ss_sp + current->sas_ss_size;
|
||
|
#endif
|
||
|
+
|
||
|
+ /* EVIL HACK TIME!
|
||
|
+ This is supposed to prevent endless segfault loops in case of stack
|
||
|
+ overflows that can occur as a result of the dummy sigaltstack()
|
||
|
+ syscall. */
|
||
|
+ struct sigaction oldact;
|
||
|
+ struct sigaction act;
|
||
|
+ memset(&act,0,sizeof(struct sigaction));
|
||
|
+ act.sa_handler=hack_handler;
|
||
|
+ sigaction(SIGSEGV,&act,&oldact);
|
||
|
+ hack_stack = *((void**)((sp-framesize)&~7));
|
||
|
+ sigaction(SIGSEGV,&oldact,&act);
|
||
|
+
|
||
|
/*
|
||
|
* ATPCS B01 mandates 8-byte alignment
|
||
|
*/
|