From patchwork Tue Oct 25 20:07:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 10968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1196275wru; Tue, 25 Oct 2022 13:13:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72HTdeAh58cafyc8aUfQ9dFveQUyK7e3FcYMfw8SbvhPGWZS1fkSvHhF0JqfHhiAH7/8ud X-Received: by 2002:a17:90a:4b02:b0:212:f63f:6deb with SMTP id g2-20020a17090a4b0200b00212f63f6debmr18542625pjh.241.1666728798839; Tue, 25 Oct 2022 13:13:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666728798; cv=none; d=google.com; s=arc-20160816; b=vms70ccw/GXYiXR4R59nLnfBUwMcE+gOL5t+1nf7XI6DuNusbIuq682Ffs2kSrgNB2 JsS6vzJJTmEk0PJwNM3FHkZoh89khIfHsYkclxqSyw7SfiRR59wrp8FJNbJ6q1sRGnPJ bFUR12OFuefZQkcP5Uccm2+0b8MYehx/oDJeVQUDvkPNijgx77+ecEyxOv45rXrLvKV6 /tVLUGUyIskSSzcSnszrL0upyGvdX8KbakZ7qVsc3mTeZ/vw18Bl0naRtWzgdNBV+PeT 3S45ql//ulweYSCzhrflA8N79hXgBQwDyAAoK5JKTDvhgSGQl4dTrTkp1IeOuWh1ez13 tOkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=GQNMbODNLjgV6RJ0RGaO6u1ANw+MYd4DzgUTsmQMz8s=; b=AqTKIh0LpUi4axSlXatg5affURAU67yCGflfeVA9Woya0brVzKZYh6d3rQSZz0+KGb +Cm8+fwaq9l979ZxPvqLshehqPfITgREbVebTDnlX6V9htlPvxob5wGt6JQy6D5gCHKc FvEYWVAg4aQs9iIXg53K0zxi6W9Eq4aCI5miHswSQFzt6aKX4zxGT9Wo5woxhVFdZBvT vdIRDv+mSpmfo/vXrpHli7UoEe2x+a8hlDoAfSFYeZoJe8HLSMfITcmnXjavP9fQDKsn 5vm6FwtMdL7ZRW5iakGH0hOHdeG14Ges4HAuYV1wpaKv51l1X2LW7HP8+Ss0ggJDZJlM J4rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tqi8rwcE; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nv8-20020a17090b1b4800b0020d3424d919si16366684pjb.97.2022.10.25.13.12.44; Tue, 25 Oct 2022 13:13:18 -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=casper.20170209 header.b=tqi8rwcE; 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 S231964AbiJYULq (ORCPT + 99 others); Tue, 25 Oct 2022 16:11:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231429AbiJYULj (ORCPT ); Tue, 25 Oct 2022 16:11:39 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86F8A7A526 for ; Tue, 25 Oct 2022 13:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=GQNMbODNLjgV6RJ0RGaO6u1ANw+MYd4DzgUTsmQMz8s=; b=tqi8rwcEyiK/lR7ccOEZObJwlg f6M0lfg4SINlmLYHQ179fgI9rnETIlOsHXQ/KEfxI1lqKrlvBYZkceL1bYoTeYndxrWRIQ+SMpqyd hlyrYdkx25pKDVpdz7dXhd/x8BsLqvMj4IkciQYunLQVFLpETxPFaB4cyYnZWubl611BWxh9t2mPW 1M2zCQmC9SNK8Rqih6OjY3d46m6Uv58sj/3feY1nJ/yynLV7MPty9Bx2tcUc1sQ6mJ+EhZQB0Bg1p e8C0wbIZJeUmlY8YuB9V2CB5xusmSK/3C8HKvIyLm5cFUb4IDQKR7wVJTK6LmtR5I9+TUf0++cylJ jpv4vLLw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1onQGm-00GWF9-Ud; Tue, 25 Oct 2022 20:11:29 +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)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 1020A300474; Tue, 25 Oct 2022 22:11:23 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 9E7722C4502EA; Tue, 25 Oct 2022 22:11:22 +0200 (CEST) Message-ID: <20221025201058.011279208@infradead.org> User-Agent: quilt/0.66 Date: Tue, 25 Oct 2022 22:07:01 +0200 From: Peter Zijlstra To: torvalds@linux-foundation.org, rostedt@goodmis.org, dave.hansen@intel.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, x86@kernel.org, keescook@chromium.org, seanjc@google.com Subject: [PATCH 5/5] x86/mm: Do verify W^X at boot up References: <20221025200656.951281799@infradead.org> MIME-Version: 1.0 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,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747691816882138030?= X-GMAIL-MSGID: =?utf-8?q?1747691816882138030?= Straight up revert of commit: a970174d7a10 ("x86/mm: Do not verify W^X at boot up") now that the root cause has been fixed. Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/mm/pat/set_memory.c | 4 ---- 1 file changed, 4 deletions(-) --- a/arch/x86/mm/pat/set_memory.c +++ b/arch/x86/mm/pat/set_memory.c @@ -587,10 +587,6 @@ static inline pgprot_t verify_rwx(pgprot { unsigned long end; - /* Kernel text is rw at boot up */ - if (system_state == SYSTEM_BOOTING) - return new; - /* * 32-bit has some unfixable W+X issues, like EFI code * and writeable data being in the same page. Disable