mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-06 13:09:50 +00:00
The assertion re-added in r302614 was triggered when stopping signal
is delivered to vforked child. Issue is that we avoid stopping such children in issignal() to not block parents. But executed AST, which ignored stops, leaves the child with the signal pending but no AST pending. On first exec after vfork(), call signotify() to handle pending reenabled signals. Adjust the assert to not check vfork children until exec. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
This commit is contained in:
parent
809a9d1353
commit
77d6809483
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=302999
@ -760,6 +760,8 @@ do_execve(td, args, mac_p)
|
||||
if (p->p_flag & P_PPWAIT) {
|
||||
p->p_flag &= ~(P_PPWAIT | P_PPTRACE);
|
||||
cv_broadcast(&p->p_pwait);
|
||||
/* STOPs are no longer ignored, arrange for AST */
|
||||
signotify(td);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -107,15 +107,20 @@ userret(struct thread *td, struct trapframe *frame)
|
||||
* multi-threaded processes, where signal distribution might
|
||||
* change due to other threads changing sigmask, the check is
|
||||
* racy and cannot be performed reliably.
|
||||
* If current process is vfork child, indicated by P_PPWAIT, then
|
||||
* issignal() ignores stops, so we block the check to avoid
|
||||
* classifying pending signals.
|
||||
*/
|
||||
if (p->p_numthreads == 1) {
|
||||
PROC_LOCK(p);
|
||||
thread_lock(td);
|
||||
KASSERT(!SIGPENDING(td) ||
|
||||
(td->td_flags & (TDF_NEEDSIGCHK | TDF_ASTPENDING)) ==
|
||||
(TDF_NEEDSIGCHK | TDF_ASTPENDING),
|
||||
("failed to set signal flags for ast p %p td %p fl %x",
|
||||
p, td, td->td_flags));
|
||||
if ((p->p_flag & P_PPWAIT) == 0) {
|
||||
KASSERT(!SIGPENDING(td) || (td->td_flags &
|
||||
(TDF_NEEDSIGCHK | TDF_ASTPENDING)) ==
|
||||
(TDF_NEEDSIGCHK | TDF_ASTPENDING),
|
||||
("failed to set signal flags for ast p %p "
|
||||
"td %p fl %x", p, td, td->td_flags));
|
||||
}
|
||||
thread_unlock(td);
|
||||
PROC_UNLOCK(p);
|
||||
}
|
||||
@ -281,12 +286,15 @@ ast(struct trapframe *framep)
|
||||
* td_flags, since signal might have been delivered
|
||||
* after we cleared td_flags above. This is one of
|
||||
* the reason for looping check for AST condition.
|
||||
* See comment in userret() about P_PPWAIT.
|
||||
*/
|
||||
KASSERT(!SIGPENDING(td) ||
|
||||
(td->td_flags & (TDF_NEEDSIGCHK | TDF_ASTPENDING)) ==
|
||||
(TDF_NEEDSIGCHK | TDF_ASTPENDING),
|
||||
("failed2 to set signal flags for ast p %p td %p fl %x %x",
|
||||
p, td, flags, td->td_flags));
|
||||
if ((p->p_flag & P_PPWAIT) == 0) {
|
||||
KASSERT(!SIGPENDING(td) || (td->td_flags &
|
||||
(TDF_NEEDSIGCHK | TDF_ASTPENDING)) ==
|
||||
(TDF_NEEDSIGCHK | TDF_ASTPENDING),
|
||||
("failed2 to set signal flags for ast p %p td %p "
|
||||
"fl %x %x", p, td, flags, td->td_flags));
|
||||
}
|
||||
thread_unlock(td);
|
||||
PROC_UNLOCK(p);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user