Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp541303ybi; Sat, 15 Jun 2019 06:27:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/dA0Rs0yNX8kYJSsBLf2aSALoxBPo39d3ux5LkcENPStduzm9yejPRCfQaM1cMQQDc90D X-Received: by 2002:a62:1a8e:: with SMTP id a136mr65511040pfa.22.1560605273580; Sat, 15 Jun 2019 06:27:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560605273; cv=none; d=google.com; s=arc-20160816; b=GCi8I1X6tjDHsFMRFyc7FCIj2AE8xucGHYmJTlCAPi8kzbxEK/lhqXSax6cxCoIDbM HPdg5xQovh31KFzeXuHZQBxl+1hpqTzH/CmgRyY/2F2wscpYea8g/oj1YvtmCbulaIZN HvoI0C7qAdJI0glEdG33JsmddXIIPmo2M+jl4RbhaokxUBFNk2DwDwcpR2XNYhtFbfcl k1L9bRMuVtcGNKJE27yB3FREg1GleRC6q5myZ+YrQirL0r9Xra/dDY/qgf8lBRKf5IB/ 1B7YkLXhapOxvFHxLKGcslVMyqV+1jeLG9L/gcSnakY0e/02AYX5dWfWab79y5yUltPx Iqhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-disposition:mime-version:user-agent:in-reply-to:references :subject:cc:to:from:message-id:date; bh=tN8m88zmRiJEfV6+LbDcHtftbAB6OAYRlibcP7arvQM=; b=D1oMLozGtCMx0/RJcimvGRXb3BBKUIR6OwLCivFR16ejJzV3UUrDk8z0U7HF8MA0pY ylw8anYt2y3x0x2Z0T3R9cl0ZldpQ5ZF/WjCdW95yz1h0mi9TpGAhQcSPPhO2jCXfxlU M+7dKUrNjZt7AkosfaCaWXBJm9JqUBiHgXrF4ARj3wOCl1xFWRw4PprVbBdVWIu/nKBb kLp2Nu8Yukab8A04/wBdIqMo9CqhlJ8fZ1w/TQNgj+jl5X4djOqK/Y4DLWBsLjnnuwiM RIEoiuwEJxzfpX1qAC/15hca8oYsUM6kSSmXiZ67IUfvKTwe9wZAXlBmDXOw5EF7vcUr j3Gg== 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 c123si5280298pfa.171.2019.06.15.06.27.38; Sat, 15 Jun 2019 06:27:53 -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 S1726764AbfFON0D convert rfc822-to-8bit (ORCPT + 99 others); Sat, 15 Jun 2019 09:26:03 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:6615 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbfFON0D (ORCPT ); Sat, 15 Jun 2019 09:26:03 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 45Qysg71slz9v0qB; Sat, 15 Jun 2019 15:25:59 +0200 (CEST) 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 ypMTtY4H2cjl; Sat, 15 Jun 2019 15:25:59 +0200 (CEST) Received: from vm-hermes.si.c-s.fr (vm-hermes.si.c-s.fr [192.168.25.253]) by pegase1.c-s.fr (Postfix) with ESMTP id 45Qysg6612z9v0q9; Sat, 15 Jun 2019 15:25:59 +0200 (CEST) Received: by vm-hermes.si.c-s.fr (Postfix, from userid 33) id 9DA2B3FF; Sat, 15 Jun 2019 15:25:59 +0200 (CEST) Received: from 37.170.137.36 ([37.170.137.36]) by messagerie.si.c-s.fr (Horde Framework) with HTTP; Sat, 15 Jun 2019 15:25:59 +0200 Date: Sat, 15 Jun 2019 15:25:59 +0200 Message-ID: <20190615152559.Horde.0lTFIZALxZ-RI75z94G3jA8@messagerie.si.c-s.fr> From: Christophe Leroy To: Andreas Schwab Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, j.neuschaefer@gmx.net, Michael Ellerman , Paul Mackerras , Benjamin Herrenschmidt Subject: Re: [PATCH] powerpc/mm/32s: only use MMU to mark initmem NX if STRICT_KERNEL_RWX References: <1e412310cc18ea654fb2ce4c935654d8d1069f27.1550775950.git.christophe.leroy@c-s.fr> <8736kb9fry.fsf_-_@igel.home> In-Reply-To: <8736kb9fry.fsf_-_@igel.home> User-Agent: Internet Messaging Program (IMP) H5 (6.2.3) Content-Type: text/plain; charset=UTF-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andreas Schwab a écrit : > If STRICT_KERNEL_RWX is disabled, never use the MMU to mark initmen > nonexecutable. I dont understand, can you elaborate ? This area is mapped with BATs so using change_page_attr() is pointless. Christophe > > 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."