Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1403071ybk; Thu, 14 May 2020 08:09:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlkmujSY8S3R8JJbLQLvY4wNy9ixMKHVT2BlMnrvjZhQ7zQ/M2PzTn7z7YxhUGgYf9Y9Fr X-Received: by 2002:a50:9a25:: with SMTP id o34mr4531021edb.10.1589468967304; Thu, 14 May 2020 08:09:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589468967; cv=none; d=google.com; s=arc-20160816; b=rzPf4DPjvT3KPQ0kj9Ewj3TiLmiLeV73tZtfUcaeZutzUoBkaA5CiPfrECuj4r0qS2 pkUYXVUQoMf7dEB1x7bk6cvGzPxmbqUnL/Hxfaf0bImdC5kB3DaTDWi0n/Cp+pJ5c3mG p20r1xIl64wrkxT8k5FyXLvwo8JJLKkyVahmuKeSn1fhH3jWSUXAnfrG1LXYYhToK31u jAmueMTAlnVCCnH95gx505wUULVkeujzBvONuPWnW9t5jLGADvYa73K7qw5NiHW1lAgU ayHnK/Zs579XK6eKsvYL6zGadiErX6PZ7GU9F1YWeCaNztJxV5ZlD0rSRv8speHKSJTa DG8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=quu32ZKziD6ZjQlpAEDQy5dYXaW4hE9moTtWQSzgib0=; b=IcCQlvx4vrLPdgVjJXHbpN44fP/WsOdcdcZAA/yucLGypbCc+0ZzXkWt+lGhXxC8dj jONzDY6ijKmObTxJ3qBuQT/Tq4HucQn4BPcAO/PDsA4+fvs8V6w1KnhNJgyZ0WaBsSQk VzBsIZkYcjd7N4e81iCh4WKG0VvKgtRNitPxGU33mwVrWM/btAiGUvJlEiuLVGyF0r3n 0pgVqN93kN7e1z8xKcrfnU460vebzFkPQ8X/TsOre6KizzpVxQbRq85acTz4/8/G70w7 rbUItrV1MNu2aCliKn0ETQQAyv/RpNDKvPIFLoEg/Wn3VjrepbkVOUGxw3eSzke0D7jk /4ow== ARC-Authentication-Results: i=1; mx.google.com; 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 n23si2061064eju.98.2020.05.14.08.09.04; Thu, 14 May 2020 08:09:27 -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; 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 S1726179AbgENPGi (ORCPT + 99 others); Thu, 14 May 2020 11:06:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727891AbgENPGh (ORCPT ); Thu, 14 May 2020 11:06:37 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10648C061A0C for ; Thu, 14 May 2020 08:06:37 -0700 (PDT) Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jZFR1-0001aM-NT; Thu, 14 May 2020 17:06:07 +0200 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id F1E031004CE; Thu, 14 May 2020 17:06:06 +0200 (CEST) From: Thomas Gleixner To: Peter Zijlstra Cc: Andy Lutomirski , LKML , X86 ML , "Paul E. McKenney" , Alexandre Chartre , Frederic Weisbecker , Paolo Bonzini , Sean Christopherson , Masami Hiramatsu , Petr Mladek , Steven Rostedt , Joel Fernandes , Boris Ostrovsky , Juergen Gross , Brian Gerst , Mathieu Desnoyers , Josh Poimboeuf , Will Deacon Subject: Re: [patch V4 part 4 02/24] x86/int3: Avoid atomic instrumentation In-Reply-To: <20200514131530.GQ2957@hirez.programming.kicks-ass.net> References: <20200505134926.578885807@linutronix.de> <20200505135313.517429268@linutronix.de> <20200514093257.GT2978@hirez.programming.kicks-ass.net> <87h7wiznl7.fsf@nanos.tec.linutronix.de> <20200514131530.GQ2957@hirez.programming.kicks-ass.net> Date: Thu, 14 May 2020 17:06:06 +0200 Message-ID: <878shuzhcx.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra writes: > On Thu, May 14, 2020 at 02:51:32PM +0200, Thomas Gleixner wrote: >> Peter Zijlstra writes: >> > On Wed, May 13, 2020 at 09:57:52PM -0700, Andy Lutomirski wrote: >> >> On Tue, May 5, 2020 at 7:15 AM Thomas Gleixner wrote: >> >> > >> >> > From: Peter Zijlstra >> >> > >> >> > Use arch_atomic_*() and READ_ONCE_NOCHECK() to ensure nothing untoward >> >> > creeps in and ruins things. >> >> > >> >> > That is; this is the INT3 text poke handler, strictly limit the code >> >> > that runs in it, lest it inadvertenly hits yet another INT3. >> >> >> >> >> >> Acked-by: Andy Lutomirski >> >> >> >> Does objtool catch this error? >> > >> > It does not. I'll put it on the (endless) todo list.. >> >> Well, at least it detects when that code calls out into something which >> is not in the non-instrumentable section. > > True, but the more specific problem is that noinstr code can use > jump_label/static_call just fine. > > So a more specific test is validating none of that happens in the INT3 > handler before poke_int3_handler(). Which is what I think Andy was > after. Indeed. Forgot about that one. Hmm, alternatives and jumplabel patch locations in entry.text and noinstr.text can be valid at least during early boot where we know that we don't run those code pathes... Thanks, tglx