summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_sig.c22
-rw-r--r--sys/kern/subr_trap.c2
-rw-r--r--sys/kern/vfs_export.c1
-rw-r--r--sys/kern/vfs_lookup.c2
4 files changed, 18 insertions, 9 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 7d3634d..e1dbedc 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -2537,16 +2537,22 @@ tdsigcleanup(struct thread *td)
}
-/* Defer the delivery of SIGSTOP for the current thread. */
-void
-sigdeferstop(struct thread *td)
+/*
+ * Defer the delivery of SIGSTOP for the current thread. Returns true
+ * if stops were deferred and false if they were already deferred.
+ */
+int
+sigdeferstop(void)
{
+ struct thread *td;
- KASSERT(!(td->td_flags & TDF_SBDRY),
- ("attempt to set TDF_SBDRY recursively"));
+ td = curthread;
+ if (td->td_flags & TDF_SBDRY)
+ return (0);
thread_lock(td);
td->td_flags |= TDF_SBDRY;
thread_unlock(td);
+ return (1);
}
/*
@@ -2555,11 +2561,11 @@ sigdeferstop(struct thread *td)
* will suspend either via ast() or a subsequent interruptible sleep.
*/
void
-sigallowstop(struct thread *td)
+sigallowstop()
{
+ struct thread *td;
- KASSERT(td->td_flags & TDF_SBDRY,
- ("attempt to clear already-cleared TDF_SBDRY"));
+ td = curthread;
thread_lock(td);
td->td_flags &= ~TDF_SBDRY;
thread_unlock(td);
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index 22cabcb..bd06f20 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -164,6 +164,8 @@ userret(struct thread *td, struct trapframe *frame)
("userret: Returning with with pinned thread"));
KASSERT(td->td_vp_reserv == 0,
("userret: Returning while holding vnode reservation"));
+ KASSERT((td->td_flags & TDF_SBDRY) == 0,
+ ("userret: Returning with stop signals deferred"));
#ifdef VIMAGE
/* Unfortunately td_vnet_lpush needs VNET_DEBUG. */
VNET_ASSERT(curvnet == NULL,
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index 114c23e..6a3f291 100644
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/rwlock.h>
#include <sys/refcount.h>
+#include <sys/signalvar.h>
#include <sys/socket.h>
#include <sys/systm.h>
#include <sys/vnode.h>
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index e5ee4f6..fbde152 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -339,7 +339,7 @@ namei(struct nameidata *ndp)
auio.uio_offset = 0;
auio.uio_rw = UIO_READ;
auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_td = (struct thread *)0;
+ auio.uio_td = td;
auio.uio_resid = MAXPATHLEN;
error = VOP_READLINK(ndp->ni_vp, &auio, cnp->cn_cred);
if (error) {
OpenPOWER on IntegriCloud