Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3983632rdg; Wed, 18 Oct 2023 11:15:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGixKb2uDNccdAg29qncJ2OvsEjPhfv2KqK03Uo7Ku+/YBMTLXnCxaouoxKDTDHB6/oV17s X-Received: by 2002:a17:903:2285:b0:1bf:193a:70b6 with SMTP id b5-20020a170903228500b001bf193a70b6mr201745plh.5.1697652899736; Wed, 18 Oct 2023 11:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697652899; cv=none; d=google.com; s=arc-20160816; b=NRt54vkRu4s/PuBH4dHPLx/L3zKk23qn8kY3sdSK2rTqvMSAlgZOr22HaCeDZpiXwk +/8r4ScIfFRYYGHhyD54e80bMb0bM8zsFB/+u5IRKu634pgKsqgAaKAD1K6t0lKUfe9a Zwp45qeIVp0jNX2/HKy/MzMoIk/HHWXrX3DSqlistbxIJgjeQbN0mGOKFLiVXsElQZSw Dl+qoEZjn8HADF4WM1ojlpYWGhtSRc03cdhwNoNoeheCOd1f+9XG04YBRNL3yyM3W9Or uSPUIKWjnVeT2dpXM7Wqmfmb72rWVDFAFZ1aM69W9nFui1sV+xYsk05SP3fxl6U+OfGd BRPw== 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=2+5hK6Qeebd6LJeeVSkqTIQHbGGbbjdzLQ60sGHd1Uw=; fh=ryNl978v0qTqD2R+xUvvqKb6xbCiYXTSd64Ar2Y696I=; b=1DUNgzCukhEmh3IYZH4AZxVp5JQ7ZBc6P9vlHacu5jbeFr3XwOFoF33dBHHcVDwRz6 CPHRp8laGh9GX1+TBvJ+HCnxaFsKhOwS6Rg0llMA8rD/OO9ehvmZTr5rxd8pNzrkT9Sb ZU5ZLxTTRRwoHiJcFDduD0AXDslQrcjf8D6HdIDCwJUgxMCBGADtQ5o6+WGzgG+R/A6Y 8ndHePOAuC2FrN3z441yrccjAPQcKFFBE1/pyR8yH0K/bhcV3AZedyzXtbTqb6SaOEdu QRuadOXh+basf7ZJQT+/H00khF2v0gW29Q6eZS+Sq2b7FLVbAUwJNCttm2ogJZw0vP6a BS0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="EeyBt/4h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id p12-20020a170902bd0c00b001bbca0a8393si396164pls.56.2023.10.18.11.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 11:14:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="EeyBt/4h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E01368221120; Wed, 18 Oct 2023 11:14:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232067AbjJRSOg (ORCPT + 99 others); Wed, 18 Oct 2023 14:14:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231307AbjJRSOf (ORCPT ); Wed, 18 Oct 2023 14:14:35 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13E8398; Wed, 18 Oct 2023 11:14:34 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6025FC433C7; Wed, 18 Oct 2023 18:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697652873; bh=ZYef+7UVk//Io/17K/jvCLvU3OYncakab+PQGBwHhaw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EeyBt/4h5mvBRKhFoyLn4i25lnqkHlWvPB1KWMicFTd7b+h9Q7WZdcZYjcdBq3gny JBvdK5NS825xnzH+OYWoLnunyL3RFf1mSpKPGkZJNjvVczK7XPTN2ThcnVLY2MPe82 fNGWmY696eszTJk+v11QEEVNbNzeg+gWZDZcefHVdNU6xYAbpsVcyDdrHrWUTZTap/ s36aQRdUS1rexmuTSA6AanGkupg9CHAc1EIpqmSmJvYMuFlsUBeh0uTn9Inl65riSN efvwNIedAsiE2jfqsRnEf63j2sKE6EjFssmNdDHdQJiwjLyPQVL8XJl6p3cmJdPXMe +EHNgDWqBDkyQ== Date: Wed, 18 Oct 2023 11:14:31 -0700 From: Josh Poimboeuf To: Borislav Petkov Cc: Ingo Molnar , linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org, David Kaplan , "Peter Zijlstra (Intel)" , x86@kernel.org, David Howells Subject: Re: [tip: x86/bugs] x86/retpoline: Ensure default return thunk isn't used at runtime Message-ID: <20231018181431.skre6i6vzrxsprck@treble> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231018175531.GEZTAcE2p92U1AuVp1@fat_crate.local> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 morse.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 (morse.vger.email [0.0.0.0]); Wed, 18 Oct 2023 11:14:57 -0700 (PDT) On Wed, Oct 18, 2023 at 07:55:31PM +0200, Borislav Petkov wrote: > On Wed, Oct 18, 2023 at 08:54:33AM -0700, Josh Poimboeuf wrote: > > On Wed, Oct 18, 2023 at 05:12:45PM +0200, Borislav Petkov wrote: > > > On Wed, Oct 18, 2023 at 03:38:56PM +0200, Ingo Molnar wrote: > > > > If then WARN_ONCE(). > > > > > > WARN_ONCE() is not enough considering that if this fires, it means we're > > > not really properly protected against one of those RET-speculation > > > things. > > > > > > It needs to be warning constantly but then still allow booting. I.e, > > > a ratelimited warn of sorts but I don't think we have that... yet. > > > > I'm not sure a rate-limited WARN() would be a good thing. Either the > > user is regularly checking dmesg (most likely in some automated fashion) > > or they're not. If the latter, a rate-limited WARN() would wrap dmesg > > pretty quickly. > > Well, freezing the box without any mention about why it happens is not > viable either. So for lack of a better solution, overflowing dmesg is > all we could do. Why not just WARN_ONCE() then? > And, on a related note, I'm thinking I should revert: > > e92626af3234 ("x86/retpoline: Remove .text..__x86.return_thunk section") > > after all because I'm debugging another similar issue reported by > dhowells. > > And I can reproduce it on linux-next with his config and gcc-13. The > splat looks like this below - and mind you, that's in a VM. On baremetal > you get to see only the first warning and output stops. > > And that happens because for whatever reason apply_returns() can't find > that last jmp __x86_return_thunk for %r15 and it barfs. > > When I revert e92626af3234, it is fixed. It fixes dhowells' box too. > > Which means, IMHO, objtool is missing to add a return return call site > at the end of that __x86_indirect_thunk_r15. > > And considering how close we are to the merge window, I'd let that > .text..__x86.return_thunk section exist so that objtool can find the > return sites more reliably that what we currently have. > > We can always do e92626af3234 later, when it has seen more testing. Ok. A revert is fine for now, but either way we do need to get to the bottom of why objtool is messing up. Can you share the config? -- Josh