Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Oct 2015 00:50:26 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r288969 - in stable: 10/sys/kern 9/sys/kern
Message-ID:  <201510070050.t970oQxV003127@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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/10/sys/kern/subr_syscall.c
Directory Properties:
  stable/10/   (props changed)

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

Modified: stable/10/sys/kern/subr_syscall.c
==============================================================================
--- stable/10/sys/kern/subr_syscall.c	Wed Oct  7 00:43:05 2015	(r288968)
+++ stable/10/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))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510070050.t970oQxV003127>