Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp508744ybi; Sat, 15 Jun 2019 05:49:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMInkqBj+au8oGwnOYB6Ki9FxIpv5aX18k+ns+Geu/8w7y71uODlY2AkRObV42aviEOFx7 X-Received: by 2002:a62:cdc8:: with SMTP id o191mr34566260pfg.74.1560602955300; Sat, 15 Jun 2019 05:49:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560602955; cv=none; d=google.com; s=arc-20160816; b=v2UF1oAePobm8IVk7n+ZNq89lYrecUCj7mIeUlGhmXiL9qUdstA4FOhSOfAxmVZbwm uKLl7fzk0lwzZmimsHAZ7sdrnoR12tmgEDAWj7pVJuqyy47x3JD+Kemn2TuRS1lPj1Kv OsMjEobeoECYRu5CXYjd4oMtSmCPwDrWjYQu2RNESrqIyTvQGoUDxbmm4o7xABqBSZ/o 3mV7/tc8r8MLyo/DDml5HLgSUZLSbTyLp5PeqxSQUlfSTg9m0EsFfDegrYhHMzYG3L6k 8gmg7YSlPATX8k9P0MgozBmt4FfrD/CSt5Ey4iNitRs0a1xEJq0IFofXnZn1PsLc9rpi zLLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=OprPIayiTwv8qgrFA/xF8Vl0cDpbJHFDQxfsj6puySI=; b=WuSLEUrFiVxSqtu3EODrDFQc6OuAXXCQzDpOuX+IAGn3AUWt6Emh3izyZ4yEXaaId3 MBxaO3B8NjhExO+Issxq4UVuFLjhVNKr7O6FCnf88p+cXar5Z97ahH8BoiQyji+jU4N1 fxG8pTZRAt29dqZ0IvV/+j9PWZYhqLSRl1d1dsahgxSm8bTGjJA25suTgQsG5984WYh6 EwS85PXywUvewJDFpj8xgc7SF+G2q4XOFlyv/bCMMewBFK0hnvj4zAKA545uffAnNV9z Y2/4DHnI925/vzNWjoo31fz4y2ZlGc+Y3FjyikQUH7vwvJggqhKb7Z6pXkC37E6W2kT5 jcOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n75si4801081pjc.27.2019.06.15.05.49.00; Sat, 15 Jun 2019 05:49:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726719AbfFOMrd (ORCPT + 99 others); Sat, 15 Jun 2019 08:47:33 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:51004 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725943AbfFOMrc (ORCPT ); Sat, 15 Jun 2019 08:47:32 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 45Qy1G5lFZz1rD9d; Sat, 15 Jun 2019 14:47:30 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 45Qy1G52mJz1qqkq; Sat, 15 Jun 2019 14:47:30 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id OuZhr5AH4Xcv; Sat, 15 Jun 2019 14:47:29 +0200 (CEST) X-Auth-Info: lR6vEGEjQp+5pJ18oak+YQGQ7QwRBmFU2NVjtItvVEU28hsAjcy4lojTPelqUle0 Received: from igel.home (ppp-46-244-181-62.dynamic.mnet-online.de [46.244.181.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sat, 15 Jun 2019 14:47:29 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id 0F8512C0C9A; Sat, 15 Jun 2019 14:47:29 +0200 (CEST) From: Andreas Schwab To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , j.neuschaefer@gmx.net, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] powerpc/mm/32s: only use MMU to mark initmem NX if STRICT_KERNEL_RWX References: <1e412310cc18ea654fb2ce4c935654d8d1069f27.1550775950.git.christophe.leroy@c-s.fr> X-Yow: ...It's REAL ROUND.. And it's got a POINTY PART right in the MIDDLE!! The shape is SMOOTH.. ..And COLD.. It feels very COMFORTABLE on my CHEEK.. I'm getting EMOTIONAL.. Date: Sat, 15 Jun 2019 14:47:29 +0200 In-Reply-To: <1e412310cc18ea654fb2ce4c935654d8d1069f27.1550775950.git.christophe.leroy@c-s.fr> (Christophe Leroy's message of "Thu, 21 Feb 2019 19:08:49 +0000 (UTC)") Message-ID: <8736kb9fry.fsf_-_@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If STRICT_KERNEL_RWX is disabled, never use the MMU to mark initmen nonexecutable. Also move a misplaced paren that makes the condition always true. Fixes: 63b2bc619565 ("powerpc/mm/32s: Use BATs for STRICT_KERNEL_RWX") Signed-off-by: Andreas Schwab --- arch/powerpc/mm/pgtable_32.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c index d53188dee18f..3935dc263d65 100644 --- a/arch/powerpc/mm/pgtable_32.c +++ b/arch/powerpc/mm/pgtable_32.c @@ -360,9 +360,11 @@ void mark_initmem_nx(void) unsigned long numpages = PFN_UP((unsigned long)_einittext) - PFN_DOWN((unsigned long)_sinittext); - if (v_block_mapped((unsigned long)_stext) + 1) +#ifdef CONFIG_STRICT_KERNEL_RWX + if (v_block_mapped((unsigned long)_stext + 1)) mmu_mark_initmem_nx(); else +#endif change_page_attr(page, numpages, PAGE_KERNEL); } -- 2.22.0 -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."