Skip to contentSkip to conversation

coroutine: Fix setup of sigaltstack coroutines

PATCH Applied Jan Kiszka 3 participants 3 messages May 9, 2012 – May 10, 2012

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 coroutine: Fix setup of sigaltstack coroutines

Use pthread_kill instead of process-wide kill to invoke the signal handler used for stack switching. This may fix spurious lock-ups with this backend, easily triggerable by extending the time window between kill and sigsuspend.

---
 coroutine-sigaltstack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
coroutine-sigaltstack.c +1 -1
index 7ff2d33..b2e316c 100644
@@ -226,7 +226,7 @@ static Coroutine *coroutine_new(void)
      * called.
      */
     coTS->tr_called = 0;
-    kill(getpid(), SIGUSR2);
+    pthread_kill(pthread_self(), SIGUSR2);
     sigfillset(&sigs);
     sigdelset(&sigs, SIGUSR2);
     while (!coTS->tr_called) {
Signature · 1 line
1.7.3.4
Reviewed-by on v1 1/1
#1 lore raw

Il 09/05/2012 19:23, Jan Kiszka ha scritto:

Quoted 15 lines

Use pthread_kill instead of process-wide kill to invoke the signal handler used for stack switching. This may fix spurious lock-ups with this backend, easily triggerable by extending the time window between kill and sigsuspend.

---
 coroutine-sigaltstack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
coroutine-sigaltstack.c +0 -0
index 7ff2d33..b2e316c 100644

coroutine-sigaltstack.c static Coroutine *coroutine_new(void) · line 232

Quoted 8 lines
coroutine-sigaltstack.c +1 -1
@@ -226,7 +226,7 @@ static Coroutine *coroutine_new(void)
      * called.
      */
     coTS->tr_called = 0;
-    kill(getpid(), SIGUSR2);
+    pthread_kill(pthread_self(), SIGUSR2);
     sigfillset(&sigs);
     sigdelset(&sigs, SIGUSR2);
     while (!coTS->tr_called) {
Applied
#2 lore raw

Am 10.05.2012 09:29, schrieb Paolo Bonzini:

Quoted 11 lines

Il 09/05/2012 19:23, Jan Kiszka ha scritto:

Quoted 10 lines

Use pthread_kill instead of process-wide kill to invoke the signal handler used for stack switching. This may fix spurious lock-ups with this backend, easily triggerable by extending the time window between kill and sigsuspend.

---
 coroutine-sigaltstack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 15 lines

coroutine-sigaltstack.c static Coroutine *coroutine_new(void) · line 232

Quoted 13 lines
coroutine-sigaltstack.c +1 -1
index 7ff2d33..b2e316c 100644
@@ -226,7 +226,7 @@ static Coroutine *coroutine_new(void)
      * called.
      */
     coTS->tr_called = 0;
-    kill(getpid(), SIGUSR2);
+    pthread_kill(pthread_self(), SIGUSR2);
     sigfillset(&sigs);
     sigdelset(&sigs, SIGUSR2);
     while (!coTS->tr_called) {

Thanks, applied to the block branch for 1.1.

Kevin