From: Nadav Har'El <n...@scylladb.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

signal: remove "nested signals" protection

This reverts commit 4af3677117a5bb2f4660d750fa4eddc6ef44e7f2 which
aborted on a "nested signal" (handling a signal handler while inside
a signal handler).

Nested signals were never strictly impossible, but even more importantly,
if a signal handler is exited with a longjmp or siglongjmp, our test code
would think it is still inside the handler, and the next signal handler
called by thi thread will abort on a supposedly "nested signal".

Perhaps this test can be redeemed if siglongjmp() would also clear the
signal_nesting flag, but it's easier just to remove this test.

Signed-off-by: Nadav Har'El <n...@scylladb.com>
Message-Id: <20170110013215.25950-1-...@scylladb.com>

---
diff --git a/arch/x64/signal.cc b/arch/x64/signal.cc
--- a/arch/x64/signal.cc
+++ b/arch/x64/signal.cc
@@ -43,24 +43,16 @@ void build_signal_frame(exception_frame* ef,

 }

-static unsigned __thread signal_nesting;
-
 extern "C"
 void call_signal_handler(arch::signal_frame* frame)
 {
-    if (signal_nesting) {
-        // Note: nested signals are legal, but rarely used, so they usually
-        // indicate trouble
-        abort("nested signals");
-    }
// The user's signal handler might use the FPU, so save its current state. // FIXME: this fpu saving is not necessary if the callers already save the
     // FPU state. Currently, only divide_error() is missing FPU saving, and
     // callers (such as page_fault()) already save it. If we fix
     // divide_error(), we can probably get rid of the fpu saving here.
     sched::fpu_lock fpu;
     SCOPE_LOCK(fpu);
-    ++signal_nesting;
     if (frame->sa.sa_flags & SA_SIGINFO) {
         ucontext_t uc = {};
         auto& regs = uc.uc_mcontext.gregs;
@@ -103,7 +95,6 @@ void call_signal_handler(arch::signal_frame* frame)
     } else {
         frame->sa.sa_handler(frame->si.si_signo);
     }
-    --signal_nesting;
 }


--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to