Date: Tue, 10 Mar 2020 20:25:03 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358856 - head/sys/kern Message-ID: <202003102025.02AKP39m031011@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003102025.02AKP39m031011>