Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp181829rdb; Thu, 19 Oct 2023 00:44:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHcu8L7TABWGaUsu+0uUF7j0zaUTAljjI8l+F6cXnWEU7QMm81YFqKMmNDHjpWBlrncJb+U X-Received: by 2002:a05:6830:601:b0:6bf:21d3:2de5 with SMTP id w1-20020a056830060100b006bf21d32de5mr1590778oti.17.1697701452705; Thu, 19 Oct 2023 00:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697701452; cv=none; d=google.com; s=arc-20160816; b=x9EiiOqKA0Co8DmUnZToT56tLa09KUcgmNsSGI6KhrL5M4dYtlOOS5kTPU81CsnSHL hHDfvuXYCmhe14Fe/KH0eO8qFU5VsBQ7VfvTQz/R7D1GBHhoVLsbSDomvBFcOu7yW1ZU 628TBTTwaNswPdiJ6JHC8FzpvCHNiWViBFZowN5Ub5ytjgRXyxkejJ6Hq3WykRVaSMAw ElLnVaCmuZfYFdeErqxCdiyCZ7uGnU4GESJRLOmUC0EZQyZ453/91xoDsXay5auk0eR0 WB6Su4noKmBMEztxNxj0ELI9Zobsy+m+b0huPsoqKwq+S+r7E++whZE1yhMOqpE2t4b/ 724g== 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=9mnHWCvj7nBYGABXmxzYKP27v8fhXB//VHIMzUSyq88=; fh=2ncW5nlpGSYhNbleGdaJ1YhbVWVhMD1xEP4VKgFfSDM=; b=hb5Z+cJ9LMIIdRacLveFLUzYevnCt2+6ZdbDcBXSu5wT4t6Cc8EWMLzuQrn2FGH50K WNzAXJLPFg0L0BAC4FBDTKCMkDt67NH3t0FVOEvHw1cTh8UEnbNprnASRX61BN4t9b4B JD2kMLlhp1+0wWG1YqX2uooh7BLqPS3IkvT/0SrmTh8se6DptFvjy0qASooXfVG50KH/ 9gylP9+7ORhs/vl0l9tfvlxb00Kyxs0/v7CxhkeyesQhYFjMOGZD5T9mo1IM+cd6nYrj jw3y5syP0xO0dyFQ/PpsrZENt5EyjLIrC5aZ9OXZYZ5VUMq6l8eNBZeuVxMdT/Kpo/Gv 22eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=H6QUdqDn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id cj11-20020a056a00298b00b0069d1639f09esi5359109pfb.190.2023.10.19.00.44.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 00:44:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=H6QUdqDn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 300B3822AE64; Thu, 19 Oct 2023 00:44:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232869AbjJSHoB (ORCPT + 99 others); Thu, 19 Oct 2023 03:44:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231948AbjJSHn7 (ORCPT ); Thu, 19 Oct 2023 03:43:59 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92C28B6; Thu, 19 Oct 2023 00:43:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=9mnHWCvj7nBYGABXmxzYKP27v8fhXB//VHIMzUSyq88=; b=H6QUdqDnlPSm/VF5tTCY9c5+9q cfJ/qQqVVzgQgYWw5CHwBWWlp+NLpSDdXbUdBEQxfLNfzrMkfPRc70ta90AND5CLwgcGNIcYJEP5P mn2oLwxct5c2miFqwQXnyemT3OvSoHYVoE1mRL2LvNG8CniQY9LA7YZy2yIqGfr6PDh29i/YBxQbj 86r18rLJbioQBkhgdku4SVuIp/Td90YhLYLdEh0fvWVDjHW6wfFxTLKfAH4sHmYncpWadayzmG/Ba 95wtue8RgD0XfcuLKOqUtsFRhnY/19ZNbB2idcbnSPrj1YEKOTDonoQr/UUZAVaiUKuDbhDef6B3S te8ogUZA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qtNh0-009gqh-2m; Thu, 19 Oct 2023 07:43:43 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 8693D300392; Thu, 19 Oct 2023 09:43:42 +0200 (CEST) Date: Thu, 19 Oct 2023 09:43:42 +0200 From: Peter Zijlstra To: Borislav Petkov Cc: Josh Poimboeuf , Ingo Molnar , linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org, David Kaplan , x86@kernel.org, David Howells Subject: Re: [tip: x86/bugs] x86/retpoline: Ensure default return thunk isn't used at runtime Message-ID: <20231019074342.GL33217@noisy.programming.kicks-ass.net> References: <20231012141031.GHZSf+V1NjjUJTc9a9@fat_crate.local> <169713303534.3135.10558074245117750218.tip-bot2@tip-bot2> <20231018132352.GBZS/caGJ8Wk9kmTbg@fat_crate.local> <20231018151245.GCZS/17QhDGe7q6K+w@fat_crate.local> <20231018155433.z4auwckr5s27wnig@treble> <20231018175531.GEZTAcE2p92U1AuVp1@fat_crate.local> <20231018203747.GJZTBCG7mv5HL4w6CC@fat_crate.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231018203747.GJZTBCG7mv5HL4w6CC@fat_crate.local> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 19 Oct 2023 00:44:10 -0700 (PDT) On Wed, Oct 18, 2023 at 10:37:47PM +0200, Borislav Petkov wrote: > And here's the fix: > > diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c > index 73be3931e4f0..50d64f5226f4 100644 > --- a/arch/x86/kernel/alternative.c > +++ b/arch/x86/kernel/alternative.c > @@ -748,14 +748,20 @@ void __init_or_module noinline apply_returns(s32 *start, s32 *end) > continue; > > op = insn.opcode.bytes[0]; > - if (op == JMP32_INSN_OPCODE) > + if (op == JMP32_INSN_OPCODE || op == JMP8_INSN_OPCODE) > dest = addr + insn.length + insn.immediate.value; > > > I'd still prefer the revert, though, that close to the MW. We can work > at those things later, at leisure. Yet another fall-out from removing the section... When in it's own section the compiler must emit long form jump because it doesn't know where the target is. Now, not so much. Anyway, yes, that seems trivial enough as a fix.