Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp2837400pjo; Mon, 16 Mar 2020 05:38:51 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtM8RXO3Ys0V6MWmS/diGxJQA3dFKXajpg7yA2dtAzGLgJTW2vwtiXIod/89Cd6/ocWjdCh X-Received: by 2002:aca:af8a:: with SMTP id y132mr3641200oie.126.1584362331013; Mon, 16 Mar 2020 05:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584362331; cv=none; d=google.com; s=arc-20160816; b=CG8xYcXGWey/b3lhOAZ+aXstTPGpGLSP0TJwxImWu26J+fE9lgTcJwwchoiyzUw1Kc mHJZVZk+KA3WxmonYzGgq576IIN769ZB5Jq2eVUnxkvGU59OYF0HHDtbOiPNLX415t8E j8TtWVb/Ktn3dGfYicdT652ye18icrBprfVLmmOEV13RVnMaL0pQu9dKw59Bhq3b+D9O 2J0V9/LstiYLzdXNEaZgMm3aOKbhAEiW9vPXy0kVnytfl5MIVgigBcGaI9RBHfx0psTJ XNsKhSo5Uo5VxTBZjwVCb2IAJNdPf+O+zzvkiCrqwNEyVEweMShcTJHzbNCA779TViiN qTPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=PIVsfiF3wcHF3xs9ZZAltjFRY8wOK+lSgrguqgqtPGs=; b=opPCln+n+WOKJR0NZnFr3KQl7xnvuCOfiy1vlbwnbozx5F7ncLwlGot1bbGa8rMcvv zh2inUDTgOWfM5ITVuAEepppKS3+D1wDZfr9Ilw+rjUspx9M617MddJWbGx/V0ITtoIG mvETvCjlP8bnWSKxq1xDDiN6AmUlKCTYOgYcCxv7CqiDpzgFNWwf2llR+0n5P8/5ejDi H+4Z4hgJoE4X6e9V84pyR4QXankdulHc/RdfTkDOmN56uhqTvioYyBR5eN3MDkdTdiKY eAKjaQd9OjPLzAhHMgEymE8WqlzAB9GduwfD8zPkgd/kKW7fqsJvm9qhdnMWq2yHZiVh PpqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=ephJKBq9; 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 t140si7709239oif.99.2020.03.16.05.38.36; Mon, 16 Mar 2020 05:38:51 -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; dkim=pass header.i=@c-s.fr header.s=mail header.b=ephJKBq9; 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 S1731175AbgCPMgK (ORCPT + 99 others); Mon, 16 Mar 2020 08:36:10 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:41561 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731116AbgCPMgD (ORCPT ); Mon, 16 Mar 2020 08:36:03 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48gwl16c6sz9v02m; Mon, 16 Mar 2020 13:35:57 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=ephJKBq9; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id Cnx3z3l9dmlp; Mon, 16 Mar 2020 13:35:57 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 48gwl15ZqSz9v02g; Mon, 16 Mar 2020 13:35:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1584362157; bh=PIVsfiF3wcHF3xs9ZZAltjFRY8wOK+lSgrguqgqtPGs=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=ephJKBq93Wcc7e7n2zoC1nmh1hmwUd1OfCJ03KjJ4vu6KJ6AEOq18EqdzNTlUcERg t0SW4PZE2dL8Id2piXxQ7D3uzR0xFJ8T1F1KPgoTTr/qvveKKujaxBCK4SMXm/QrO+ J5JEaIDFmARkVK17v57aoa4toFVUP6q0ri30tD4s= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BA0BF8B7D0; Mon, 16 Mar 2020 13:36:02 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id ilgzDLijeRpA; Mon, 16 Mar 2020 13:36:02 +0100 (CET) Received: from pc16570vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.100]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 853128B7CB; Mon, 16 Mar 2020 13:36:02 +0100 (CET) Received: by pc16570vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 7BB4965595; Mon, 16 Mar 2020 12:36:02 +0000 (UTC) Message-Id: <361549b013da9da5c45e211b7e5bd57d9d3cb703.1584360344.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 17/46] powerpc/mm: Fix conditions to perform MMU specific management by blocks on PPC32. To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 16 Mar 2020 12:36:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Setting init mem to NX shall depend on sinittext being mapped by block, not on stext being mapped by block. Setting text and rodata to RO shall depend on stext being mapped by block, not on sinittext being mapped by block. Fixes: 63b2bc619565 ("powerpc/mm/32s: Use BATs for STRICT_KERNEL_RWX") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy --- arch/powerpc/mm/pgtable_32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c index 9934659cb871..bd0cb6e3573e 100644 --- a/arch/powerpc/mm/pgtable_32.c +++ b/arch/powerpc/mm/pgtable_32.c @@ -185,7 +185,7 @@ 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)) + if (v_block_mapped((unsigned long)_sinittext)) mmu_mark_initmem_nx(); else change_page_attr(page, numpages, PAGE_KERNEL); @@ -197,7 +197,7 @@ void mark_rodata_ro(void) struct page *page; unsigned long numpages; - if (v_block_mapped((unsigned long)_sinittext)) { + if (v_block_mapped((unsigned long)_stext + 1)) { mmu_mark_rodata_ro(); ptdump_check_wx(); return; -- 2.25.0