Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp933457imu; Wed, 28 Nov 2018 01:47:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/VVdbIqqDkLkl5vdwUDuu7RF+xJG+mRjvO33uuWTucLWFV88eaU9ldUrEdWpSGF2e0T6pwj X-Received: by 2002:a65:5088:: with SMTP id r8mr31853303pgp.15.1543398442144; Wed, 28 Nov 2018 01:47:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543398442; cv=none; d=google.com; s=arc-20160816; b=Vz8ykIF/yrXmLPppZOUax9HYAt0p+DsgHMEVRpfsZ/DpqFw5+Aswoz5SDQO78jvj7Z G9C6wcbmCt4vFNrcHYuUDHy+dld/5cS7F/J3D2BAG+WX60U4yNdnACgtYYuVtsFhPYAJ 4roByGAJvQOKgBhuKKnlfCH8oXESKXO/HwAliNoYb3SrLUmJBGiCAyGH6u8j4D1ks1KC E7pg8Bh9DrOjvxvzDs0JbTrum71Ptmqv3lQ2BepuPGNACvHeyuBy9n6mJXChs4piXnSE XSyqE5jIyuP4GsGgbivFAqwYMRAgymN4PT03rGH1OUhnu9rM3j/cPMtj14sXC/UpMohc f6gg== 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-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=5D5rXhpvuU6x3w2ExQS+ovJ8qi9a8Io3JS9B1pCkQmY=; b=n8/HoU2IApJCpa3ku/d9xokTcGpD2HCWh4TJM65ebNFk8FwTX+FjQlKuqhYuNnkaP1 1yNPxYxs/YECdRmWp1H4X8c4OcChaiSDRKFEDcoHAxn5Hp5AGM7PrkFZhoRqlRUXiNgO bulFO/UW5eD9Qq/UWZNVGi3/A53zM+Mn7Dw60vC7hLg4NtL0m1elXFWzU50q1FPK5hfF gV3dhcBLrJPVoV7YKaXlFG74ua1P/0aJMQMKXvs5CQR3ndjj63eSyxZecQ4O9+pDZNqq WWPMhwx4426mMhCqelD/qGhd0IBuCyNHRFP7VUXs24HdnvOgyFPh3SYkUZPGkzdOojZM zzxw== 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 j184-v6si7514076pfb.149.2018.11.28.01.47.07; Wed, 28 Nov 2018 01:47:22 -0800 (PST) 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 S1727778AbeK1UrZ (ORCPT + 99 others); Wed, 28 Nov 2018 15:47:25 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:11736 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727382AbeK1UrZ (ORCPT ); Wed, 28 Nov 2018 15:47:25 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 434bQ42WL3z9vBmK; Wed, 28 Nov 2018 10:46:20 +0100 (CET) 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 OFTozA-0L65h; Wed, 28 Nov 2018 10:46:20 +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 434bQ41q5Dz9vBmJ; Wed, 28 Nov 2018 10:46:20 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 316298B85D; Wed, 28 Nov 2018 10:46:21 +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 Be2a1pSxcfe1; Wed, 28 Nov 2018 10:46:21 +0100 (CET) Received: from PO15451 (po15451.idsi0.si.c-s.fr [172.25.231.2]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 04ECB8B853; Wed, 28 Nov 2018 10:46:21 +0100 (CET) Subject: Re: [RFC PATCH v2 07/11] powerpc/mm/radix: Use KUEP API for Radix MMU To: Russell Currey , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <76d777b36e54e7b8d4c196405decc712fc5eaf45.1543356926.git.christophe.leroy@c-s.fr> <312a6ca863fb46569b705d0dc5f5e38dfcd64889.1543356926.git.christophe.leroy@c-s.fr> From: Christophe LEROY Message-ID: Date: Wed, 28 Nov 2018 10:46:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <312a6ca863fb46569b705d0dc5f5e38dfcd64889.1543356926.git.christophe.leroy@c-s.fr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sorry, I forgot to reset the author so the patch appears as coming from yourself. Le 28/11/2018 à 10:27, Russell Currey a écrit : > Execution protection already exists on radix, this just refactors > the radix init to provide the KUEP setup function instead. > > Thus, the only functional change is that it can now be disabled. > > Signed-off-by: Russell Currey > Signed-off-by: Christophe Leroy > --- > arch/powerpc/mm/pgtable-radix.c | 9 ++++++--- > arch/powerpc/platforms/Kconfig.cputype | 1 + > 2 files changed, 7 insertions(+), 3 deletions(-) > > diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c > index 931156069a81..45aa9e501e76 100644 > --- a/arch/powerpc/mm/pgtable-radix.c > +++ b/arch/powerpc/mm/pgtable-radix.c > @@ -535,8 +535,13 @@ static void radix_init_amor(void) > mtspr(SPRN_AMOR, (3ul << 62)); > } > > -static void radix_init_iamr(void) > +void setup_kuep(bool disabled) > { > + if (disabled) > + return; > + > + pr_info("Activating Kernel Userspace Execution Prevention\n"); > + > /* > * Radix always uses key0 of the IAMR to determine if an access is > * allowed. We set bit 0 (IBM bit 1) of key0, to prevent instruction > @@ -605,7 +610,6 @@ void __init radix__early_init_mmu(void) > > memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE); > > - radix_init_iamr(); > radix_init_pgtable(); > /* Switch to the guard PID before turning on MMU */ > radix__switch_mmu_context(NULL, &init_mm); > @@ -627,7 +631,6 @@ void radix__early_init_mmu_secondary(void) > __pa(partition_tb) | (PATB_SIZE_SHIFT - 12)); > radix_init_amor(); > } > - radix_init_iamr(); > > radix__switch_mmu_context(NULL, &init_mm); > if (cpu_has_feature(CPU_FTR_HVMODE)) > diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype > index a20669a9ec13..e6831d0ec159 100644 > --- a/arch/powerpc/platforms/Kconfig.cputype > +++ b/arch/powerpc/platforms/Kconfig.cputype > @@ -334,6 +334,7 @@ config PPC_RADIX_MMU > bool "Radix MMU Support" > depends on PPC_BOOK3S_64 > select ARCH_HAS_GIGANTIC_PAGE if (MEMORY_ISOLATION && COMPACTION) || CMA > + select PPC_HAVE_KUEP > default y > help > Enable support for the Power ISA 3.0 Radix style MMU. Currently this >