From owner-svn-src-stable-9@freebsd.org Wed Oct 7 00:50:27 2015 Return-Path: Delivered-To: svn-src-stable-9@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9343E9D0072; Wed, 7 Oct 2015 00:50:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5EF101A7E; Wed, 7 Oct 2015 00:50:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t970oQvi003134; Wed, 7 Oct 2015 00:50:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t970oQms003133; Wed, 7 Oct 2015 00:50:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510070050.t970oQms003133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 7 Oct 2015 00:50:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r288969 - in stable: 10/sys/kern 9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Oct 2015 00:50:27 -0000 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))