From 6c5d7af15876d2b93e677311018d35f0dd7420db Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Wed, 30 May 2012 13:44:42 +0000 Subject: [PATCH] Assert that TDP_NOFAULTING and TDP_NOSPEEPING thread flags do not leak when thread returns from a syscall to usermode. Tested by: pho MFC after: 1 week --- sys/kern/subr_syscall.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index 5b485959370d..5aee684285b9 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -182,6 +182,12 @@ syscallret(struct thread *td, int error, struct syscall_args *sa __unused) KASSERT(td->td_locks == 0, ("System call %s returning with %d locks held", syscallname(p, sa->code), td->td_locks)); + KASSERT((td->td_pflags & TDP_NOFAULTING) == 0, + ("System call %s returning with pagefaults disabled", + syscallname(p, sa->code))); + KASSERT((td->td_pflags & TDP_NOSLEEPING) == 0, + ("System call %s returning with sleep disabled", + syscallname(p, sa->code))); /* * Handle reschedule and other end-of-syscall issues