Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5763722imw; Wed, 20 Jul 2022 12:02:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uzyl/OPCmY9zgdTapAgofVriSSKChyUBAoFMR+ALxkvfiQLzMvZa03e2zGGJ1adimCGI7D X-Received: by 2002:a05:6402:5418:b0:435:5a48:daa9 with SMTP id ev24-20020a056402541800b004355a48daa9mr53000413edb.304.1658343750201; Wed, 20 Jul 2022 12:02:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658343750; cv=none; d=google.com; s=arc-20160816; b=M3iBkKV6t8CdXDLW5SfI7o0COvvDXugZBcX0xXUrtphDjM04JjsKMMP/o4QcP8Fegs FNvmjEiumPWQUJrPlDdgkEGvfn4hMuLs2KwEDUd0R6YhtLPf6K0cAc0m9CoL8goj41bx ahVDr13AwGYs9xawzfWSPpnyldKNZoWmPbdWwC6JQNj9qOYPB42L0ub4+z5um01fUAPB ylikhxJvl8CaYBq1a5674dRY+MIHwM5F9Wv5J1myYVi3F9vNVQ+0tp81+qrB0sbAGUvu XcstkkpJ7Msvul3ny1x3nmwSVzL8uoudab54CO45N4cJvMmCrG0Jyfu8tGKDSGzcGpsI Kdsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AbSYYz+xofSKkd5p4f8z6hp6elD6pZXuPLrhueoMzGU=; b=s/h0RLaeYhfzzBeoX30UqsmGMF8+HrOJmi7+RfglKXcqJI0sl6UKrAS22A/Y2r4PGQ irhAiKOgnNRuYA1oEJbr3kkr8h6utjeEWsOJ3fXHcaf8r+QymLD7sFukIJSJ0OT9Veur pP/Q+6qe2Qhl6CIw+T9ZZDYOIPEYJ0c5hhxw3SbZnZl904L8Yd7oWe7CPzkDjT6kopw+ V3f45ieX78bLz6+6gSEyd5yo05/fwCTxyFgXsYxF3wMtV5X9wUlcBVdGI0KK0AIlertw xrdG7X0zSeHmj9ggaoqauk1SpJz70FN4sOPz3actbUlHl49AJSnSM5wteRi0mff2b/Lv xKzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=eSbZVkC2; 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 bc3-20020a056402204300b0043ac75eea64si21494563edb.532.2022.07.20.12.01.57; Wed, 20 Jul 2022 12:02:30 -0700 (PDT) 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=@linux-foundation.org header.s=google header.b=eSbZVkC2; 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 S230011AbiGTSoP (ORCPT + 99 others); Wed, 20 Jul 2022 14:44:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231320AbiGTSoC (ORCPT ); Wed, 20 Jul 2022 14:44:02 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8419C6FA23 for ; Wed, 20 Jul 2022 11:44:00 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id z22so11923395edd.6 for ; Wed, 20 Jul 2022 11:44:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AbSYYz+xofSKkd5p4f8z6hp6elD6pZXuPLrhueoMzGU=; b=eSbZVkC2Qst7FUwMpK57N8vIZ1zsHyvs2ve3BykOCe6whnXPKiuQPOUVpomR59Vxpq R6/EDujxB5tszpUHKyMyxK+wavy19Vm+g3/TqA3NvJFyOxRTaXBF4Ted3Yfu85MFtFcN 2sn/yAFKrF6kGdpg226Un6v/2a/Qc5xGkpd7A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AbSYYz+xofSKkd5p4f8z6hp6elD6pZXuPLrhueoMzGU=; b=xtZjxMTHwrDBX4V0iH9sh6X4/ROKUpDdi7rp6Qk8fXT0VcdTjVfED8Nsng6YWiyclU bXuvgzb772ophRyXPxj1oSK+nzAHysmR2FtZZSeOPPrA36luMfKnWdhgsYpp/tq2iXH8 3+2VbBnLztGSRSmcFNjOJGPyYD96pTavhoRjG+Wyal2v0dPWc4BjcXq9D+bQ1yImJuPX tMGJI383KksfbHknZgg47KrkD2aGPniwCujIDG99cKMd2Ak8lBZTzkTtUMxE6K/Ecuqq Hd04DopvcHKIGuvbsLr1kwRt+GarNKxVhSRdkjN6+9BGvXTI2BhgXLMiJwMzsasOa3xu o8sw== X-Gm-Message-State: AJIora8hcFAe1fxakNJKVrSIutJIUEjT0Mv8vjHTcVKv5xGujub5myBJ 9T4HxlCneTdi9GDoKg//ygrDVHgstWl5zKfCR/w= X-Received: by 2002:a05:6402:3301:b0:43a:9ad4:633 with SMTP id e1-20020a056402330100b0043a9ad40633mr54704350eda.261.1658342638852; Wed, 20 Jul 2022 11:43:58 -0700 (PDT) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com. [209.85.128.47]) by smtp.gmail.com with ESMTPSA id gv21-20020a1709072bd500b00706242d297fsm8170882ejc.212.2022.07.20.11.43.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Jul 2022 11:43:55 -0700 (PDT) Received: by mail-wm1-f47.google.com with SMTP id i132-20020a1c3b8a000000b003a2fa488efdso1912954wma.4 for ; Wed, 20 Jul 2022 11:43:54 -0700 (PDT) X-Received: by 2002:a05:600c:2211:b0:3a3:2149:88e1 with SMTP id z17-20020a05600c221100b003a3214988e1mr5119603wml.8.1658342633852; Wed, 20 Jul 2022 11:43:53 -0700 (PDT) MIME-Version: 1.0 References: <20220716230344.239749011@linutronix.de> <20220720125736.48164a14@gandalf.local.home> <20220720135016.3178ffc6@gandalf.local.home> <20220720143147.4d8a2f8d@gandalf.local.home> In-Reply-To: <20220720143147.4d8a2f8d@gandalf.local.home> From: Linus Torvalds Date: Wed, 20 Jul 2022 11:43:37 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch 00/38] x86/retbleed: Call depth tracking mitigation To: Steven Rostedt Cc: Peter Zijlstra , Thomas Gleixner , LKML , "the arch/x86 maintainers" , Tim Chen , Josh Poimboeuf , Andrew Cooper , Pawan Gupta , Johannes Wikner , Alyssa Milburn , Jann Horn , "H.J. Lu" , Joao Moreira , Joseph Nuzman , Juergen Gross , Masami Hiramatsu , Alexei Starovoitov , Daniel Borkmann Content-Type: multipart/mixed; boundary="0000000000009ba6a405e440fbd1" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 --0000000000009ba6a405e440fbd1 Content-Type: text/plain; charset="UTF-8" On Wed, Jul 20, 2022 at 11:31 AM Steven Rostedt wrote: > > Thus, is there a way to keep this file from being entered into the > return_sites section? I think the whole concept is broken. Testing known-broken code on the expectation that "this won't work anyway, so we can jump off to code that is broken" is not acceptable. *If* the test were to fail, it would start executing random code that hasn't been relocated or fixed up properly. So I think the whole concept is broken. It relies on the compiler generating code that can work in a read-only data section, and it's not clear that that is even physically possible (ie the data section might be far enough away from a code section that any relocation just fundamentally cannot happen). I think it worked purely by mistake, because the code was simple enough that it didn't need any relocation at all before. But even without RETHUNK, that was never guaranteed, because any random tracing or debug code or whatever could have made even that empty function have code in it that just fundamentally wouldn't work in a non-text section. So honestly, I think that test should be removed as a "we used this, it happened to work almost by mistake, but it doesn't work any more and it is unfixably broken". Maybe somebody can come up with an entirely different way to do that test that isn't so broken, but if so, I think it's going to be using some other machinery (eg bpf and explicitly marking it read-only and non-executable), and removing this broken model is the right thing regardless. So unless somebody has some one-liner workaround, I really suspect the fix is to remove all this. The amount of hackery to make it work in the first place is kind of disgusting anyway. Since this was a WARN_ONCE(), can you make sure that with this case removed, nothing else triggers? Linus --0000000000009ba6a405e440fbd1 Content-Type: text/x-patch; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l5tyd4vd0 IGRyaXZlcnMvbWlzYy9sa2R0bS9NYWtlZmlsZSB8IDExIC0tLS0tLS0tLS0tCiBkcml2ZXJzL21p c2MvbGtkdG0vbGtkdG0uaCAgfCAgMyAtLS0KIGRyaXZlcnMvbWlzYy9sa2R0bS9wZXJtcy5jICB8 ICA3IC0tLS0tLS0KIGRyaXZlcnMvbWlzYy9sa2R0bS9yb2RhdGEuYyB8IDExIC0tLS0tLS0tLS0t CiA0IGZpbGVzIGNoYW5nZWQsIDMyIGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL2RyaXZlcnMv bWlzYy9sa2R0bS9NYWtlZmlsZSBiL2RyaXZlcnMvbWlzYy9sa2R0bS9NYWtlZmlsZQppbmRleCAy ZTBhYTc0YWMxODUuLjRmMTA1OWYwY2FlOSAxMDA2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