Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1370196pxa; Thu, 20 Aug 2020 09:30:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNZ1gKUuGCAw2iyZ9kenDe+sq1pQ4w6soNuv4hZK3/tnBkHCiR6po7utO/yfPulEnk+FwW X-Received: by 2002:a17:906:9399:: with SMTP id l25mr4046372ejx.212.1597941032422; Thu, 20 Aug 2020 09:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597941032; cv=none; d=google.com; s=arc-20160816; b=jHBoDVRW3UbH4au6eVhfHX91bLC1gje1LQt+edVm05phEp/Jnw1mcvyP+SxqYV57zz MyM+je9ySG72LleeTIRVKGu5wmsjuZuXLEO7oqUOpQyyCTCPMOPvk+0GECHmCvEJqrtD 3qtHHl3UO0UMmt0orEQHkULKuzWRLrAHw9F4+5qMGYUK+NH4Q2xgqMPqX0NCi2c8Xbvx Pyrpzqm32TCCYnmLjCyhmTsnYO1BF1yU54P8i7ZB/QlPO3ZbwEmlm1D879O6E9hIOxKV vfqzUnfV4qOrM1uh9/VyLQPAHvV0E/r+r+WJ5JZwVv6qFU/X5+MXtBTSdYYWTICiKtRv qbYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=PMXYWC1oBwWR+/jYMDhjSaG6RLS3jk5SAEdEE7HPQTg=; b=B8E/SYyonM51pXswSs1gUUvg0iUVeJr2V1Pb02r+b8194SQ/6oTxIrFo/hzHW81Ooj 6ewuOckecRHiau5ppGd+7WTEFlQgz2lJRXBBeCIQS6CgJCMnUBkCkYKY08Y3+BJr1CT2 QiDPVibAyJH8dH1Gj/KUycHF/uPpH3aXbhGkJD4NpYs90WbW36T3RZ5QaASKc5rcxBSI d5uW1ve/zQsZmERYigm9ytQhUkCublgVVlDxatt8lICP+/bmjYoRhl1zA/NMvY4QSpv6 JS9tehW3y8rxA01lNfSrrvPPcMnjbCxeisjFfWFVNkIANuc+VSyw7qJ9Oq+PiCcmHP8+ hX7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jUXNHrrc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x69si1560900ede.26.2020.08.20.09.30.08; Thu, 20 Aug 2020 09:30:32 -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=@redhat.com header.s=mimecast20190719 header.b=jUXNHrrc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728551AbgHTPRN (ORCPT + 99 others); Thu, 20 Aug 2020 11:17:13 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:37885 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727839AbgHTPRL (ORCPT ); Thu, 20 Aug 2020 11:17:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597936628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PMXYWC1oBwWR+/jYMDhjSaG6RLS3jk5SAEdEE7HPQTg=; b=jUXNHrrcCyVWcJfD7dKG1QjcSCVwjdVJ4oaCjcn439C1l0nTQ/mEiLVDqRzbgjxJL/Zs54 fCcrkB3QzkT5Xrs92zQaKrtdRvFtHxtTfqgHAOjXiTDksj9JtbBVW06BmClW2yw4LeG9Nh q+FvuPc9K0MeUrF0ctmkIY6CBQ1+Mc4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-IW4Zq59AM_y1UewTYlPvwA-1; Thu, 20 Aug 2020 11:17:07 -0400 X-MC-Unique: IW4Zq59AM_y1UewTYlPvwA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 790641074649; Thu, 20 Aug 2020 15:17:04 +0000 (UTC) Received: from treble (ovpn-117-70.rdu2.redhat.com [10.10.117.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EFED17C0B8; Thu, 20 Aug 2020 15:17:01 +0000 (UTC) Date: Thu, 20 Aug 2020 10:16:59 -0500 From: Josh Poimboeuf To: peterz@infradead.org Cc: Brian Gerst , the arch/x86 maintainers , Linux Kernel Mailing List , Kyle Huey , Alexandre Chartre , Robert O'Callahan , "Paul E. McKenney" , Frederic Weisbecker , Paolo Bonzini , Sean Christopherson , Masami Hiramatsu , Petr Mladek , Steven Rostedt , Joel Fernandes , Boris Ostrovsky , Juergen Gross , Andy Lutomirski Subject: Re: [RFC][PATCH 4/7] x86/debug: Move historical SYSENTER junk into exc_debug_kernel() Message-ID: <20200820151659.b7q7hspe5zsf46eg@treble> References: <20200820103832.486877479@infradead.org> <20200820104905.294802764@infradead.org> <20200820150841.GB1362448@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200820150841.GB1362448@hirez.programming.kicks-ass.net> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 20, 2020 at 05:08:41PM +0200, peterz@infradead.org wrote: > On Thu, Aug 20, 2020 at 10:45:12AM -0400, Brian Gerst wrote: > > On Thu, Aug 20, 2020 at 6:53 AM Peter Zijlstra wrote: > > > > > > > > > Signed-off-by: Peter Zijlstra (Intel) > > > --- > > > arch/x86/kernel/traps.c | 24 ++++++++++++------------ > > > 1 file changed, 12 insertions(+), 12 deletions(-) > > > > > > --- a/arch/x86/kernel/traps.c > > > +++ b/arch/x86/kernel/traps.c > > > @@ -820,18 +820,6 @@ static void handle_debug(struct pt_regs > > > goto out; > > > } > > > > > > - if (WARN_ON_ONCE((dr6 & DR_STEP) && !user_mode(regs))) { > > > - /* > > > - * Historical junk that used to handle SYSENTER single-stepping. > > > - * This should be unreachable now. If we survive for a while > > > - * without anyone hitting this warning, we'll turn this into > > > - * an oops. > > > - */ > > > - tsk->thread.debugreg6 &= ~DR_STEP; > > > - set_tsk_thread_flag(tsk, TIF_SINGLESTEP); > > > - regs->flags &= ~X86_EFLAGS_TF; > > > - } > > > - > > > si_code = get_si_code(tsk->thread.debugreg6); > > > if (tsk->thread.debugreg6 & (DR_STEP | DR_TRAP_BITS) || user_icebp) > > > send_sigtrap(regs, 0, si_code); > > > @@ -874,6 +862,18 @@ static __always_inline void exc_debug_ke > > > if (kprobe_debug_handler(regs)) > > > goto out; > > > > > > + if (WARN_ON_ONCE(dr6 & DR_STEP)) { > > > + /* > > > + * Historical junk that used to handle SYSENTER single-stepping. > > > + * This should be unreachable now. If we survive for a while > > > + * without anyone hitting this warning, we'll turn this into > > > + * an oops. > > > + */ > > > + dr6 &= ~DR_STEP; > > > + set_thread_flag(TIF_SINGLESTEP); > > > + regs->flags &= ~X86_EFLAGS_TF; > > > + } > > > + > > > handle_debug(regs, dr6, false); > > > > > > out: > > > > Can this be removed or changed to a BUG()? The warning has been there > > since 2016 and nobody has apparently complained about it. > > Something like: > > /* > * The kernel doesn't do TF outside of Kprobes, so if we get > * here, something's fishy. > */ > BUG_ON(dr6 & DR_STEP); > > ? What about kernel debuggers like kgdb and qemu gdb? -- Josh