Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp416506pxx; Mon, 26 Oct 2020 11:23:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8z8BTh2lG5nKmVS/o9jRfY592PDt9jtlJD4mNPqyTB/qmPPPaUKpWcrceRPlbYS5LZzNV X-Received: by 2002:a17:906:14d8:: with SMTP id y24mr16768361ejc.123.1603736637756; Mon, 26 Oct 2020 11:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603736637; cv=none; d=google.com; s=arc-20160816; b=TZETp6Lx5Ztwje07zg9IylfE1Z5KcKOpR78puMs0l5jwog9uda0PKfGRdRWqppAKhS 6GSJZLyytzuXG6fktx6u3REJN/pFcyKz7UdbIiQVR/FEYlwkSivbc4Du+qsjD6jUtuLH mRhc23YdQkNmhTs2B2Lr54aVF7ZU+wdAWTjk84kST+eqBDbAp8cp+3cVob6bB5Fz+PQN xbvcF/OzlAXg24lbTJQASskIXUtwtXXo2dNW/rvR9xig0t3uBCJsfIIh8BbqlA2jJYEP fvOeMyn8hg70FBmw900V21lpHv7aOgXGdGFpOhNCeJNJI95WQfyuXdJbTaGOcMKMaM9d 8S2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FgbbqYAnGRF35zH2OzYSRfHYC7ZQ87tXva+0UcTDb5w=; b=iGwrhZPMxqx79bcq13L8ALUcUqD2DCMpKBZGj/s+NE8dkT6QhgAAdFJh0rNT5x9RSE 4uk/36t8VVVOMr/JW7v3pWJrzYS6WdLj+xJQklYAAqLLlgnIzdpKaNTbclI76EYECVEB jvS5mPtSvOGeswnMXySy50m0uCGwrO5HCrWM4Onn+6KMeesgG7IwVaGPntDQB0q0o9uj bWZa037x6wBC3QgaBPLpC/tbXkoawcLA0A0XU+70Gd54dbzkxVw4IBlfo8SuzAOo2cYx zEOFnPO7FF3oLwGG41aO95btvhVOQcm2bbvDqI47Z/td56lqOVfBNqOVEYRaC0u7GJRP CBiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=MrvSKnSL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lx7si7098606ejb.520.2020.10.26.11.23.35; Mon, 26 Oct 2020 11:23:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=MrvSKnSL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1773773AbgJZP4R (ORCPT + 99 others); Mon, 26 Oct 2020 11:56:17 -0400 Received: from casper.infradead.org ([90.155.50.34]:44154 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1770092AbgJZPzs (ORCPT ); Mon, 26 Oct 2020 11:55:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=FgbbqYAnGRF35zH2OzYSRfHYC7ZQ87tXva+0UcTDb5w=; b=MrvSKnSLtJmHzqtvMqSYWqMul7 0Yue1TcCQOsl0ShSsVMwDfT12FmklmGSDwt5S+rR/DLKKstAo18MgPjTlP4JFw1MBgYjGus5ojIqT XgUFKpsy393uHiochr5Mi+QV74/Du2zhZsTed/nuXO1VTRd7Wcj+fF/5cJQTq5FzKVGWNl81/w3/G g5y9wszVwrshv6c0KoHv+l2GB4aRnJw61ci9NkzJFDXWj92nX6YagARqwJtWrrUL08gdC0DQgk/gh 8x1eLnbHruJ9FVeikM/J1c6MIRW8BaigwdEvy16I80Lq4JxDNWwQ8JluJkH+BhcYGT7PsZF0dHhHN 5vcpQdmQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX4qA-0008QW-RC; Mon, 26 Oct 2020 15:55:23 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 588F43006D0; Mon, 26 Oct 2020 16:55:21 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3E75E20116727; Mon, 26 Oct 2020 16:55:21 +0100 (CET) Date: Mon, 26 Oct 2020 16:55:21 +0100 From: Peter Zijlstra To: Kyle Huey Cc: open list , Thomas Gleixner , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Linus Torvalds , Robert O'Callahan , Alexandre Chartre , "Paul E. McKenney" , Frederic Weisbecker , Paolo Bonzini , Sean Christopherson , Masami Hiramatsu , Petr Mladek , Joel Fernandes , Steven Rostedt , Boris Ostrovsky , Juergen Gross , Brian Gerst , Andy Lutomirski , Josh Poimboeuf , Daniel Thompson Subject: Re: [REGRESSION] x86/debug: After PTRACE_SINGLESTEP DR_STEP is no longer reported in dr6 Message-ID: <20201026155521.GQ2594@hirez.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 26, 2020 at 07:33:08AM -0700, Kyle Huey wrote: > After resuming a ptracee with PTRACE_SINGLESTEP, in the following > ptrace stop retrieving the dr6 value for the tracee gets a value that > does not include DR_STEP (it is in fact always DR6_RESERVED). I > bisected this to the 13cb73490f475f8e7669f9288be0bcfa85399b1f merge. I > did not bisect further. > > I don't see any handling to ever set DR_STEP in virtual_dr6, so I > think this code is just broken. > > Sorry for not testing this when I was CCd on the original patch series :) Urgh, now I have to try and remember how all that worked again ... I suspect it's either one (or both) of the last two: f4956cf83ed1 ("x86/debug: Support negative polarity DR6 bits") d53d9bc0cf78 ("x86/debug: Change thread.debugreg6 to thread.virtual_dr6") Just to clarify, the sequence is something like: - tracer: ptrace(PTRACE_SINGLESTEP) - tracee: #DB, DR6 contains DR_STEP - tracer: ptrace_get_debugreg(6) ? You're right that that would be broken, let me try and figure out what the best way would be 'fix' that. Also, can you confirm that pthread_set_debugreg(6) should not do anything useful?