svn commit: r288969 - in stable: 10/sys/kern 9/sys/kern

John Baldwin jhb at FreeBSD.org
Wed Oct 7 00:50:27 UTC 2015


Author: jhb
Date: Wed Oct  7 00:50:26 2015
New Revision: 288969
URL: https://svnweb.freebsd.org/changeset/base/288969

Log:
  MFC 287870:
  Always clear TDB_USERWR before fetching system call arguments.  The
  TDB_USERWR flag may still be set after a debugger detaches from a
  process via PT_DETACH.  Previously the flag would never be cleared
  forcing a double fetch of the system call arguments for each system
  call.  Note that the flag cannot be cleared at PT_DETACH time in case
  one of the threads in the process is currently stopped in
  syscallenter() and the debugger has modified the arguments for that
  pending system call before detaching.

Modified:
  stable/9/sys/kern/subr_syscall.c
Directory Properties:
  stable/9/sys/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sys/kern/subr_syscall.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/9/sys/kern/subr_syscall.c
==============================================================================
--- stable/9/sys/kern/subr_syscall.c	Wed Oct  7 00:43:05 2015	(r288968)
+++ stable/9/sys/kern/subr_syscall.c	Wed Oct  7 00:50:26 2015	(r288969)
@@ -64,14 +64,14 @@ syscallenter(struct thread *td, struct s
 	td->td_pticks = 0;
 	if (td->td_ucred != p->p_ucred)
 		cred_update_thread(td);
-	if (p->p_flag & P_TRACED) {
-		traced = 1;
+	traced = (p->p_flag & P_TRACED) != 0;
+	if (traced || td->td_dbgflags & TDB_USERWR) {
 		PROC_LOCK(p);
 		td->td_dbgflags &= ~TDB_USERWR;
-		td->td_dbgflags |= TDB_SCE;
+		if (traced)
+			td->td_dbgflags |= TDB_SCE;
 		PROC_UNLOCK(p);
-	} else
-		traced = 0;
+	}
 	error = (p->p_sysent->sv_fetch_syscall_args)(td, sa);
 #ifdef KTRACE
 	if (KTRPOINT(td, KTR_SYSCALL))


More information about the svn-src-stable-9 mailing list