From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: [PATCH 12/13] ptrace/x86: flush_ptrace_hw_breakpoint() shoule clear the virtual debug registers Date: Mon, 13 May 2013 17:17:40 +0200 Message-ID: <20130513151740.GA6300@redhat.com> References: <20130513151631.GA6215@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mx1.redhat.com ([209.132.183.28]:35897 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751697Ab3EMP1B (ORCPT ); Mon, 13 May 2013 11:27:01 -0400 Content-Disposition: inline In-Reply-To: <20130513151631.GA6215@redhat.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Andrew Morton Cc: Benjamin Herrenschmidt , Frederic Weisbecker , Ingo Molnar , Jan Kratochvil , Michael Neuling , Paul Mackerras , Paul Mundt , Prasad , Russell King , Will Deacon , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org flush_ptrace_hw_breakpoint() destroys the counters set by ptrace, but "leaks" ->debugreg6 and ->ptrace_dr7. The problem is minor, but still it doesn't look right and flush_thread() did this until 66cb5917. Now that PTRACE_DETACH does flush_ too this makes even more sense. Signed-off-by: Oleg Nesterov --- arch/x86/kernel/hw_breakpoint.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c index 02f0763..f66ff16 100644 --- a/arch/x86/kernel/hw_breakpoint.c +++ b/arch/x86/kernel/hw_breakpoint.c @@ -393,6 +393,9 @@ void flush_ptrace_hw_breakpoint(struct task_struct *tsk) unregister_hw_breakpoint(t->ptrace_bps[i]); t->ptrace_bps[i] = NULL; } + + t->debugreg6 = 0; + t->ptrace_dr7 = 0; } void hw_breakpoint_restore(void) -- 1.5.5.1