Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1498801pxm; Thu, 24 Feb 2022 04:29:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwf+obMfCi591ZhJv9+Nf+3eYZ+x5n3hC1VCm6v8WOnG0SaJUxdsLB/kkVF8caUh91T4TD5 X-Received: by 2002:a17:906:6b8f:b0:6cd:7984:26fc with SMTP id l15-20020a1709066b8f00b006cd798426fcmr2039210ejr.701.1645705793916; Thu, 24 Feb 2022 04:29:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645705793; cv=none; d=google.com; s=arc-20160816; b=i+uSMcDZ5TnE/0cqqHc7HAJbdasVvl/dW8M47YxeDld5blekEwgNPEoXAKX/8PUdbi VFIHeYN1KuKGvHJk3eyHAXZ/iZknCi5VaMbFu6Dg3pxwXcpTtkwk5L3Rh182cgpB0kKe v++TOJSH1ecj8A3AF0YUfpjQvn9rmZVXztG1tlAvY6hju0gHIteHlE69F8Xb0o6By156 wUHmETdfMg9LZFcPxWN8NvpGuX1LBcL+BvYY4Dw8yrdc9JVoavdutUxXjGU/mUyACh95 bDR103H/9DwZmcvGzYwMJgp9SYKv6Kt6YAaUH6LnsyY1iJLQtHMFZTMXl2L5bAD09kGG bLbQ== 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=8RvNia9Hw9E1ELsaDTDybH4NfpZAf2KyeUgPWqGrwNs=; b=09hPEisO1EpDGsC+RTaBayWuZoeXNx2/DyZCGqiKZhCp87ehFty/CHsWImvBUWghsG Cm4L6eWsjvmtkWr8e1/SIji1RSDo2Htmq9hIJT6W7v/sZSbQ9wgMaN7CR7Mux4PUkjt3 8rkv91YMmRDtHyT+XcIX6HbfdANalwyG4qPmoRDxHlwvv3sd/vb0mfCIPoM6h3gyPfq3 6a+SrIldKn66GriO8NkNL3AXzdQ5GDDzleldBGplJ2yNA4jMQtduoCiZkZNhUxSJTvg7 0rSelk3R5xK4ziN2xfD1BIzqUcMnMNapiz0Yfzri7BFTMt5h53rin4dEBUqncpXiwS9i 96Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=BdQjU3Tf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1si1475128ede.169.2022.02.24.04.29.30; Thu, 24 Feb 2022 04:29:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=BdQjU3Tf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230399AbiBXJLU (ORCPT + 99 others); Thu, 24 Feb 2022 04:11:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232707AbiBXJLL (ORCPT ); Thu, 24 Feb 2022 04:11:11 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAA9E1A02B5 for ; Thu, 24 Feb 2022 01:10:26 -0800 (PST) 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=8RvNia9Hw9E1ELsaDTDybH4NfpZAf2KyeUgPWqGrwNs=; b=BdQjU3TfxuEPwkn4tLPda20a8o +crCScUbqkGkQur4UWDLX20ob2jysVHJAS4toyI8tYpOLa6R+mMSDtXzIxgpJb2edPo1Ln0Mn+bsg yVRDCA39MOyANyUMTSGZD9mdRf8FSYHdJTHih2217/MWJfXecYuQ+pQDSwlTUC5fP+kDOolnyJQxY kUuQqLewa+02iynmP/C+3KaKRFXGz7PYjBE9x6yD3TUgkfUgwfZpAGqf+/KRCDrdSjfHG5PG8njrC /61wFNKhL+e9bLX8eavLjIOdK4FlW+S6gk+v/r1xncurasNeT8r5gCgSBu2tQJk2WxnQFb3JgzW8k 2jYpwz8g==; 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.94.2 #2 (Red Hat Linux)) id 1nNA8b-004cPW-Ei; Thu, 24 Feb 2022 09:10:13 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 4418C300470; Thu, 24 Feb 2022 10:10:12 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 215EB2C7EA795; Thu, 24 Feb 2022 10:10:12 +0100 (CET) Date: Thu, 24 Feb 2022 10:10:12 +0100 From: Peter Zijlstra To: Joao Moreira Cc: x86@kernel.org, hjl.tools@gmail.com, jpoimboe@redhat.com, andrew.cooper3@citrix.com, linux-kernel@vger.kernel.org, ndesaulniers@google.com, keescook@chromium.org, samitolvanen@google.com, mark.rutland@arm.com, alyssa.milburn@intel.com Subject: Re: [PATCH 24/29] x86/text-patching: Make text_gen_insn() IBT aware Message-ID: References: <20220218164902.008644515@infradead.org> <20220218171409.990016403@infradead.org> <5c77889ca6b988b0dff65136264bd1fb@overdrivepizza.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5c77889ca6b988b0dff65136264bd1fb@overdrivepizza.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 23, 2022 at 05:18:04PM -0800, Joao Moreira wrote: > > +#ifdef CONFIG_X86_IBT > > + if (is_endbr(dest)) > > + dest += 4; > > +#endif > > Hi, FWIIW I saw this snippet trigger a bug in the jump_label infra where the > target displacement would not fit in a JMP8 operand. Bah, I was afraid of seening that :/ > For these cases perhaps we can verify if the displacement fits the operand > and, if not, simply ignore and lose the decode cycle which may not be a huge > problem and remains semantically correct. Seems more sensible than padding > jump tables with nops. In the meantime I'll investigate clang's behavior and > if it is really a bug, I'll work on a patch. Urgh, trouble is, we're going to be re-writing a bunch of ENDBR to be UD1 0x0(%eax),%eax, and you really don't want to try and execute those.