Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2084950rdb; Tue, 3 Oct 2023 09:42:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF43ld2udMBOFidakqHaML6M99/aZdERhRgW/wiI7NmqJPsAQ0+mFnqU2MDzOfV40X6zigX X-Received: by 2002:a17:903:22cd:b0:1bf:3c10:1d70 with SMTP id y13-20020a17090322cd00b001bf3c101d70mr202524plg.6.1696351375871; Tue, 03 Oct 2023 09:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696351375; cv=none; d=google.com; s=arc-20160816; b=W7rHBZwCG4cJZlpfTYcb4mnZ2TJZ31QLtSJzx0H5lgXYiB9LtxHUP2Wu9z1RWhnapF e5HmDrhE7mP5CMIOnzUOcyLSvr3MixWV/rcUxvm7eR2U+qqhUT5/WyVBo3wsoUg7b0Ic C5ZPHbSPDzG0KvKxJK9KNJy1jSIXdOx7oMXidH8U8dvBHlUT/kc2OuHOtaNfwfvFq9j7 zdeMZa0XQ0KyVAhvZWa57EXN5TjAIrWUBwa9dcKI9U3sQPXhisTgcw6HSCFGVnfYCvmy akup126BHK+DAtkwvIA8jmR3NoRDrDcv3DvVv58Y2CeH4014xz5wFOMsvjurU/RSVE+M M+sw== 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=xo4hUgm4YsHRQ2qw98bC1dyPM7VgjwYlR7ZQ4WpFcfU=; fh=UAOqQ8oJXS5qgr/Q5XC0BgVxJ8zJjJlaUORTPHEXRe8=; b=av9MGrap3W13AE0LFgUywDQQ/GbHBCWujJXjcasaECnYT6cP9S1ZHJTytJj9U4Gkko hNqbcJJEgBpZHrenKy6ZRL9bLFTHRVtpC2mWRklaUinmOL/wAOU90uPTzqkz1eSfv+u4 nPQ/Eqc2waFiGg+T9XmIf7ELfFxz91kbyvZYcrEs1sO2c/JkTllOuezeS3B9smuyrCJV pCp46sZSKiNsYKqQOAbSiFLC9QYB723Q7ibo8TtZ85q2SVECWxgv8ucGtfp3bszw3UPY FfNbY99odOLPKsTf32sF6urKVgSDH4qMSzEvMpcDcypvCyh6ocWVZ9ggZwr1ralH2KlS axQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=ZD7GKBNq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id i15-20020a17090332cf00b001c752a540cdsi1899986plr.145.2023.10.03.09.42.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 09:42:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=ZD7GKBNq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 5E7BA817ABFD; Tue, 3 Oct 2023 09:42:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231255AbjJCQm0 (ORCPT + 99 others); Tue, 3 Oct 2023 12:42:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231208AbjJCQmX (ORCPT ); Tue, 3 Oct 2023 12:42:23 -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 72F74A1 for ; Tue, 3 Oct 2023 09:42:17 -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=xo4hUgm4YsHRQ2qw98bC1dyPM7VgjwYlR7ZQ4WpFcfU=; b=ZD7GKBNqmNR9dRzDRipFX5SmUQ Obb+7/jSLYYeaZ5NQUkvAjSIa58tfUDM8mNkoHzecAlXrhMzuDNATIShT8tmmf87CbeOGv3Z5ERFH FfBYW1uR3laHK943lq8oxAL7QpTiAGzfr8HoDoJpLy/CpdxoPYWPOk3nZ+9vUra8LN4QrQNiyGcCr DX57TBQDLymr0w75OAE28XQ7D6de8t6sZt7NQjX4SJ2KStFFXVCWaTZIi1Q66rntRRiNyGIezdxtE f74uOthTkUqdtyCVMGK98coES4jboe7WZojklJjOKiHiTkILiW7c/bEBN1bKDhcm7POi6gaG0rbWM FGMO1YGw==; 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 1qniT6-00A0bR-38; Tue, 03 Oct 2023 16:41:58 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 1A9FA300348; Tue, 3 Oct 2023 18:41:58 +0200 (CEST) Date: Tue, 3 Oct 2023 18:41:57 +0200 From: Peter Zijlstra To: Sumit Garg Cc: Linus Torvalds , Linux Kernel Mailing List , Mimi Zohar , Jarkko Sakkinen , James Bottomley , Hyeonggon Yoo <42.hyeyoo@gmail.com>, David Kaplan , Borislav Petkov , Ingo Molnar , x86@kernel.org Subject: Re: Linux 6.6-rc3 (DEBUG_VIRTUAL is unhappy on x86) Message-ID: <20231003164157.GH1539@noisy.programming.kicks-ass.net> References: <5427bc3d-1e14-781a-53a2-f702774715f4@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5427bc3d-1e14-781a-53a2-f702774715f4@linaro.org> X-Spam-Status: No, score=-0.9 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 03 Oct 2023 09:42:53 -0700 (PDT) On Tue, Oct 03, 2023 at 05:36:27PM +0530, Sumit Garg wrote: > Hi Linus, > > On 10/2/23 02:18, Linus Torvalds wrote: > > On Sun, 1 Oct 2023 at 07:17, Hyeonggon Yoo <42.hyeyoo@gmail.com> wrote: > > > > > Peter Zijlstra (1): > > > > > x86,static_call: Fix static-call vs return-thunk > > > > Hello, the commit above caused a crash on x86 kernel with > > > > CONFIG_DEBUG_VIRTUAL=y. > > > OK, I looked into this a little bit, and it turns out that the problematic > > > address here is from cleanup_trusted() in > > > security/keys/trusted-keys/trusted_core.c. > > > (and it's builtin due to CONFIG_TRUSTED_KEYS=y) > > > > > > The function is marked as __exit, so it does not fall within the > > > 'core kernel text address range,' which is between _stext and _etext > > > (or between _sinittext and _einittext). and thus __text_poke() thinks that > > > it's vmalloc/module area. > > > > > > I think __text_poke() should be taught that functions marked as __exit > > > also belong to kernel code just like __init. > > I think your patch is fine (well, whitespace-damaged, but conceptually good). > > > > But I also wonder about that > > > > static_call_cond(trusted_key_exit)(); > > > > in cleanup_trusted(). It seems all kinds of pointless to use static > > calls for something that is done *once*. That's not an optimization, > > that's honestly just _stupid_. It costs more to do the rewriting that > > it does to just do the one dynamic indirect call. > > That's true, there isn't any real performance benefit here. It is something > which I mentioned when I was asked to incorporate it here [1]. However, on > the flip side I think there are security benefits here. We wouldn't like any > indirect branch speculation attack to leak the trusted key material contents > here. 1) retpolines; 2) if you can unload modules, you've got bigger problems.