From: Alan Cox Date: Sun, 30 Oct 2016 10:46:09 +0000 (+0000) Subject: signals: Fix signal during exit block bug X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=684f0b02545a54edb963970dba23e77a88ee3964;p=FUZIX.git signals: Fix signal during exit block bug Issue #449 from Bret. Slightly extended from Bret's fix to ensure no further signals also try and get themselves delivered. --- diff --git a/Kernel/process.c b/Kernel/process.c index c46cdf7c..34799ddc 100644 --- a/Kernel/process.c +++ b/Kernel/process.c @@ -497,10 +497,15 @@ rescan: /* Other things may have happened */ goto rescan; } + + /* The signal is being handled, so clear it even if + we are exiting (otherwise we'll loop in + chksigs) */ + udata.u_ptab->p_pending &= ~m; + if ((m & clear) || udata.u_ptab->p_pid == 1) { /* SIGCONT is subtle - we woke the process to handle the signal so ignoring here works fine */ - udata.u_ptab->p_pending &= ~m; // unset the bit continue; } #ifdef DEBUG @@ -633,6 +638,11 @@ void doexit(uint16_t val) irq = di(); + /* We are exiting, hold all signals (they will never be + delivered). If we don't do this we might take a signal + while exiting which would be ... unfortunate */ + udata.u_ptab->p_held = 0xFFFFFFFFUL; + /* Discard our memory before we blow away and reuse the memory */ pagemap_free(udata.u_ptab);