Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1060078pxx; Tue, 27 Oct 2020 07:22:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN4FWHjm9kd65EzIwxuGdN5GO+5j4PiNg/ucSwJFvqr+yuUzfjRaaj3ZgDNqUdX7q/RZ3q X-Received: by 2002:a17:906:1682:: with SMTP id s2mr2655028ejd.138.1603808555202; Tue, 27 Oct 2020 07:22:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603808555; cv=none; d=google.com; s=arc-20160816; b=Sw88mNK/Cmyzpbn1lEc7Zgi4DDUnuFi1fxLSX3fdgB64Z8Rcm7KSGT9SCsYPBS9vb3 d51JhqpIoEd6jqMJVFcMm7UTYvFuMu/8xDLu6/WhlQwXP6Ju3PloriC8YzfvwaDSHVEP d/msnswxuWLNMatHF4Nd0RqlDF6LLkU2mMhI7M0ZbyJWkx9RGNPZnR2hgUOPxAFonAoc jcJW9vJina474MEwqda7wkAKz8aYJA22Jj9T9gQ6LQO/R21ao8UZpMBpDgsc9t9GceVm 8Gb407ut9fjsIEwMnLeHRz4R47sr215pogsSAjAUrrRX8+NB76Xjye/SPqLNCo/ypo1g uM6Q== 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=XQcCXngkhvG5SpWi+kmrjq+Hhq+RSDL5FOHryXsDGRM=; b=Et/+q3YoVIVQ5rFfSRBmQX3Py6txFddLnKERvCBxFHxqTmGln26jj+ar8RX3sfxjzO dWyOig8JZkZ6gW5DgGsKxWzIgmIfu5naMv4XKYFt2WyDY/fnntfPWfsoybPCCcHUcnzo 4Lf7MHmRsKGC+eEJvOFzUDNLPcq4g7aw3q5OlD9m1G5rVqMPTjDM+mdJ+RJ/0K5Axelo KwME+NjvQdb6CYd3fnckyLfz6oiIAq20nCMTef5d9LoG96ACX0WQsX2p7GfJXfY8p4hr pgvLJwNAYORBKYDHavpekF46kDfKtKptkxhuSUvxSFd773mGMxzpQRcRbc2caOPeKs3n K3sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=BtzrIzj6; 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 z9si1023533ejp.638.2020.10.27.07.22.11; Tue, 27 Oct 2020 07:22:35 -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=BtzrIzj6; 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 S2895372AbgJ0JJH (ORCPT + 99 others); Tue, 27 Oct 2020 05:09:07 -0400 Received: from casper.infradead.org ([90.155.50.34]:35278 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408760AbgJ0JJG (ORCPT ); Tue, 27 Oct 2020 05:09:06 -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=XQcCXngkhvG5SpWi+kmrjq+Hhq+RSDL5FOHryXsDGRM=; b=BtzrIzj6HwyZBDTEHNbg3zdDyU JLC06krkKQ4LJZtobhd+/TZUhariuccXrET0dFg4VKRG9V6A1Z00tSI5eyzzwXVWn3PSfwI64V9JI VU4YLYTS9bxwhpD7pTTZJbj6vTphMoY8Six3XpFxxs50egZeQWlF5xBlsBEnxhW6wjWW6I8Nd3O17 xTtHn0ZtnKKzqAIAa2WHaQGrtSLJcx1KEQX5f1jFAYNcTUKFOvsm14QtEgzX6e+81MNRD6jDpOl4Z MZs95OTghCbeHh+cANiPjHMXAjMyAteOzf1kmhsX/RftV8uDKOJLuRt1AmUMCJ/eeKOHrdUMfcKSw E/pcTLAw==; 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 1kXKxo-0004Zb-SK; Tue, 27 Oct 2020 09:08: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 B2B6D301179; Tue, 27 Oct 2020 10:08:14 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A58692141F77E; Tue, 27 Oct 2020 10:08:14 +0100 (CET) Date: Tue, 27 Oct 2020 10:08:14 +0100 From: Peter Zijlstra To: Andy Lutomirski Cc: Kyle Huey , 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 , Josh Poimboeuf , Daniel Thompson Subject: Re: [REGRESSION] x86/debug: After PTRACE_SINGLESTEP DR_STEP is no longer reported in dr6 Message-ID: <20201027090814.GJ2628@hirez.programming.kicks-ass.net> References: <20201026155521.GQ2594@hirez.programming.kicks-ass.net> <20201026160513.GC2651@hirez.programming.kicks-ass.net> <20201026163100.GR2594@hirez.programming.kicks-ass.net> <20201026165519.GD2651@hirez.programming.kicks-ass.net> 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 04:30:32PM -0700, Andy Lutomirski wrote: > Is there any compelling reason not to just drop the condition and do: > > current->thread.virtual_dr6 |= (dr6 & DR_STEP); > > unconditionally? Because why should it? > This DR6 cause, along with ICEBP, have the > regrettable distinctions of being the only causes that a user program > can trigger all on its own without informing the kernel first. This > means that we can't fully separate the concept of "user mode is > single-stepping itself" from "ptrace or something else is causing the > kernel to single step a program." TIF_SINGLESTEP does that. If the kernel is single-stepping userspace it has TIF_SINGLESTEP (and possibly TIF_FORCED_TF) to distinguish these cases. > I bet that, without making this tweak, the virtual_dr6 change will > regress some horrific Wine use case. Then we should make sure the Wine people are aware and test this. Do you know who to poke? If there are regressions, we'll fix them, but I'd prefer to not create a mess just because. This whole #DB thing was a giant trainwreck, we'll obviously have to be bug compatible, but only when people actually notice.