svn commit: r358856 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Tue Mar 10 20:25:04 UTC 2020


Author: kib
Date: Tue Mar 10 20:25:03 2020
New Revision: 358856
URL: https://svnweb.freebsd.org/changeset/base/358856

Log:
  Fix signal delivery might be on sigfastblock clearing.
  
  When clearing sigfastblock, either by sigfastblock(UNSETPTR) call or
  implicitly on execve(2), kernel must check for pending signals and
  reschedule them if needed.
  
  E.g. on execve, all other threads are terminated, and current thread
  fast block pointer is cleaned.  If any signal was left pending, it can
  now be delivered to the current thread, and we should prepare for
  ast() on return to userspace to notice the signals.
  
  Reported and tested by:	pho
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Tue Mar 10 20:04:38 2020	(r358855)
+++ head/sys/kern/kern_sig.c	Tue Mar 10 20:25:03 2020	(r358856)
@@ -4107,7 +4107,8 @@ sigfastblock_clear(struct thread *td)
 	if ((td->td_pflags & TDP_SIGFASTBLOCK) == 0)
 		return;
 	td->td_sigblock_val = 0;
-	resched = (td->td_pflags & TDP_SIGFASTPENDING) != 0;
+	resched = (td->td_pflags & TDP_SIGFASTPENDING) != 0 ||
+	    SIGPENDING(td);
 	td->td_pflags &= ~(TDP_SIGFASTBLOCK | TDP_SIGFASTPENDING);
 	if (resched) {
 		p = td->td_proc;


More information about the svn-src-all mailing list