Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp559238rwb; Fri, 23 Sep 2022 00:23:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YsrTYVyEbPfh2HFNhXRik/GFqXnp69PIfqolF8w3Z/grOO5JoSFwm1/UwsyfLFkviZjeu X-Received: by 2002:a17:90a:c258:b0:202:b93b:cb89 with SMTP id d24-20020a17090ac25800b00202b93bcb89mr19199726pjx.126.1663917837649; Fri, 23 Sep 2022 00:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663917837; cv=none; d=google.com; s=arc-20160816; b=izglTtQbEsrfnlaHCR8oqthh6wgBoOWagiGDVzQ1PNHs7KYBS0r1jZQyfyPuP49Xe/ 7Mg3ViNyP6knsxHtHBkpuGEGa1cmLk++5J/Yuyp0w1xvyEnrNgeB+l5hz69xwGHtyf90 N7gvYpINnbSV9BsHXWMjn5ROstX5v8HdM9Yu7XgrwoCVFfBjFANVLF7NHaa02DkcE0Av Zv5/LyiHCr7w5VnGxCETvvCERPRmYlomgEz3pLq3sr3uz4mHrEnKRsOemmURAAy5a/AU bL7KTKrGWI947YCn98Cel+PUCuXnfDd4xOOFrHLdu2ROZhGTXUMfoL2PQk+LVPrTkVUK MkXw== 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=o0uHXUsXUhn2jPpNOYhKHOJ7uxQ/113gO2HUCwNQKTA=; b=1KHZZMx0YEYPYDEPOnj/6uKF059rKzhDJubx/Z9hg2mrfN2szyvIeduHvUNyuNBb8d rFwOsXLPcMpiL2mFGE9MGsQL63nVQhGM0l1DZN7Nmg10SbDz8SEmHlcP3rwqOmyqMYV4 ICYlfe+5OGDzZ4ZjaOvjxIWoXsS0v7k3BXcqdNiz0kAANaLJ9UjQmfKAYGQZwK4TQWTH MvVuhcUB+iupBv82glVq3V6inBnPymu2ALTaJ25cWmwDZZu5/92CzARf1V0iKoTR3S09 wl2XOLKn2hMcy1A8jSSjlBmK8szjCuQluyr9h6OOE0uW3+Y57up2urYWFunnl477jrUa b/EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=QXR7MPGY; 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 w2-20020a056a0014c200b00536ee0f5ab4si9486382pfu.73.2022.09.23.00.23.44; Fri, 23 Sep 2022 00:23:57 -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=@infradead.org header.s=desiato.20200630 header.b=QXR7MPGY; 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 S230083AbiIWHAh (ORCPT + 99 others); Fri, 23 Sep 2022 03:00:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbiIWHAf (ORCPT ); Fri, 23 Sep 2022 03:00:35 -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 5933F11D0D6; Fri, 23 Sep 2022 00:00:33 -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=o0uHXUsXUhn2jPpNOYhKHOJ7uxQ/113gO2HUCwNQKTA=; b=QXR7MPGYFu5vr5ygV25QiYtD/t NeXXniZZ6l1HVJ10qsWJnkAxn/1HL/vs1y57vKDtzbx4vzVEHnKsl+sDLkILL5GVRnHB1MKMWp3ub d6K8WlLYq2S0qUDv7NeMHpmRv0sDelO47gW90RufMbgwj4Kwg9R5FWHUpo5R7DCI//q2nZ/nyjLVB fxF9788n7NYendBMWpjF2QX2rlS75YqPxGSXVGbYewKJZ1rJA0F7FfxrTW6bkK4m/ACgmIcHTX9M7 TggugOPFwcypkAy+rz6IZrbElHgOwxrp9GbdEoUAl+qyZdDYBvO1AXQac/M5eqgHmrEs8Tsv3fTGV uLe0j+SA==; 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.94.2 #2 (Red Hat Linux)) id 1obcfC-00F9p4-Ij; Fri, 23 Sep 2022 06:59:54 +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 3A948300074; Fri, 23 Sep 2022 08:59:53 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 1E7B52BBA9799; Fri, 23 Sep 2022 08:59:53 +0200 (CEST) Date: Fri, 23 Sep 2022 08:59:53 +0200 From: Peter Zijlstra To: Ard Biesheuvel Cc: Dave Hansen , linux-kernel@vger.kernel.org, Guenter Roeck , Darren Hart , Andy Shevchenko , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, linux-efi@vger.kernel.org, "H. Peter Anvin" Subject: Re: [PATCH] x86/mm+efi: Avoid creating W+X mappings Message-ID: References: <08906193-246b-c874-8bac-1d98d2313ac4@roeck-us.net> <20220922193157.1673623-1-dave.hansen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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 Fri, Sep 23, 2022 at 12:08:57AM +0200, Ard Biesheuvel wrote: > On Thu, 22 Sept 2022 at 21:32, Dave Hansen wrote: > > > > From: Peter Zijlstra > > > > I'm planning on sticking this in x86/mm so that it goes upstream > > along with the W+X detection code. > > > > -- > > > > A recent x86/mm change warns and refuses to create W+X mappings. > > > > The 32-bit EFI code tries to create such a mapping and trips over > > the new W+X refusal. > > > > Make the EFI_RUNTIME_SERVICES_CODE mapping read-only to fix it. > > > > This is not safe. EFI_RUNTIME_SERVICES_CODE covers both .text and > .data sections of the EFI runtime PE/COFF executables in memory, so > you are essentially making .data and .bss read-only. (Whether those > executables actually modify their .data and .bss at runtime is a > different matter, but the point is that it used to be possible) > > More recent firmwares may provide a 'memory attributes table' > separately which describes the individual sections, but older 32-bit > firmwares are not even built with 4k section alignment, so code and > data may share a single page. Note that we haven't wired up this > memory attributes table on i386 at the moment, and I seriously doubt > that 32-bit firmware in the field exposes it. > > Can we just turn off this feature for 32-bit? Goodie; some seriously security minded people who did that EFI turd :/ Let's just heap it on the pile of 32bit sucks and should not be considered a security target anymore and indeed kill this feature.