Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp198670pxb; Tue, 19 Oct 2021 00:35:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhmOiorW+atLxVNO3ht2pXV0scEQNqdoFK4qjiG5r1ldy2c0Rtf2aCP+NZ5ih8FNyPawY8 X-Received: by 2002:a17:906:e287:: with SMTP id gg7mr35579859ejb.387.1634628910030; Tue, 19 Oct 2021 00:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634628910; cv=none; d=google.com; s=arc-20160816; b=M+TGRk8PbZ4kdx31d11RH2aNV6kYe6yopIex2f7sV9XspusEbiACfxlclCqpHJRQUM 4pW42OsH9Jv4CeSH+W6hlySM91Brl5RKIzIO/t7iKjGaVn0i0mOrKpb91knlcsY/jZEa 4MGjy272/2sx69WhgpUmkPBQuLRT7JhLP4wwfEdMuSPaM1WrF+3qRIUQ7Rp3ZMEY+NVo LmUI8ve0/cGr5FQYV6V9lWj5bDLLwYMQVt72GxRdOqECnaHyTceJKx7Gl+FfesMN5chb /2s7oJuvJGDGzRHW4UCrGdRO0mR9nufiR1fYnIdku/Hj7rd5czeOzosp4z74iKphM/rz qAww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=PCmIuI1t4v/AgtCVvBVlcrk6xYGeUkQpVdwgldoi/p0=; b=SLb8dBiaGDKiaqUodo5oPMzIKO0rgEaLeQEBQoOK4H7iK5mjh96dAX3+2rvlIEcKzz wikPNpRzcQNk3g/ioGrY1ftttDmhObcx4TnesFV/SoaJDagDUHTgOafsj7hCqYmdjz8P VjmapKtvm28eU/IBaH6v+di8Ey0t/C2kQzERKPe7gi/xkRrc5bolEGAJD+vlg7Bzjedd DZLjMb/uy6/UoiFnvfv5crYLDNxC3CSmgmzowC8VZ3iy2ULsdJ8B+6zSQgre8jv0Zql+ y8QHGoPtDUef3/yaaYAo56+OWV99F6JyvHbMpLDJAqw0xjH7vXD2prd6PWo9lasP/YV5 KgnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r17si176084edd.559.2021.10.19.00.34.46; Tue, 19 Oct 2021 00:35:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234585AbhJSHck (ORCPT + 99 others); Tue, 19 Oct 2021 03:32:40 -0400 Received: from pegase2.c-s.fr ([93.17.235.10]:59985 "EHLO pegase2.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234541AbhJSHch (ORCPT ); Tue, 19 Oct 2021 03:32:37 -0400 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4HYQPM6ZYMz9sSt; Tue, 19 Oct 2021 09:29:59 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wacYp5GZL293; Tue, 19 Oct 2021 09:29:59 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4HYQP71fzvz9sSw; Tue, 19 Oct 2021 09:29:47 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 239388B779; Tue, 19 Oct 2021 09:29:47 +0200 (CEST) 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 VgyzqCcylDg7; Tue, 19 Oct 2021 09:29:47 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.203.71]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 145CC8B776; Tue, 19 Oct 2021 09:29:45 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.16.1/8.16.1) with ESMTPS id 19J7Tbcu3188402 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 09:29:38 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.16.1/8.16.1/Submit) id 19J7TbRZ3188401; Tue, 19 Oct 2021 09:29:37 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v3 01/22] Revert "powerpc: Inline setup_kup()" Date: Tue, 19 Oct 2021 09:29:12 +0200 Message-Id: <7691088fd0994ee3c8db6298dc8c00259e3f6a7f.1634627931.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1634628570; l=2828; s=20211009; h=from:subject:message-id; bh=s6QJ0VbGmgV7jNIuY9ZSoQzmABbVEWriNQDx7Nfivxo=; b=iQgOtTjfsTNVaYcArvp7oZoQmeeIMwxpTbURK2DGnWDD7OaHOlSEVwjALD66YqWxNC79/7YQPJGd nrJ48kd3AcKY1nH3SsAGjfQy4ac3FNpI5BEsZqqzKg5p5jQY1NZs X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit 1791ebd131c46539b024c0f2ebf12b6c88a265b9. setup_kup() was inlined to manage conflict between PPC32 marking setup_{kuap/kuep}() __init and PPC64 not marking them __init. But in fact PPC32 has removed the __init mark for all but 8xx in order to properly handle SMP. In order to make setup_kup() grow a bit, revert the commit mentioned above but remove __init for 8xx as well so that we don't have to mark setup_kup() as __ref. Also switch the order so that KUAP is initialised before KUEP because on the 40x, KUEP will depend on the activation of KUAP. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/kup.h | 8 ++------ arch/powerpc/mm/init-common.c | 6 ++++++ arch/powerpc/mm/nohash/8xx.c | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/include/asm/kup.h b/arch/powerpc/include/asm/kup.h index 1df763002726..8699ca5884b9 100644 --- a/arch/powerpc/include/asm/kup.h +++ b/arch/powerpc/include/asm/kup.h @@ -32,6 +32,8 @@ extern bool disable_kuap; #include +void setup_kup(void); + #ifdef CONFIG_PPC_KUEP void setup_kuep(bool disabled); #else @@ -78,12 +80,6 @@ static inline void restore_user_access(unsigned long flags) { } #endif /* CONFIG_PPC_BOOK3S_64 */ #endif /* CONFIG_PPC_KUAP */ -static __always_inline void setup_kup(void) -{ - setup_kuep(disable_kuep); - setup_kuap(disable_kuap); -} - static __always_inline void allow_read_from_user(const void __user *from, unsigned long size) { barrier_nospec(); diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c index 3a82f89827a5..b4f3437aee38 100644 --- a/arch/powerpc/mm/init-common.c +++ b/arch/powerpc/mm/init-common.c @@ -47,6 +47,12 @@ static int __init parse_nosmap(char *p) } early_param("nosmap", parse_nosmap); +void setup_kup(void) +{ + setup_kuap(disable_kuap); + setup_kuep(disable_kuep); +} + #define CTOR(shift) static void ctor_##shift(void *addr) \ { \ memset(addr, 0, sizeof(void *) << (shift)); \ diff --git a/arch/powerpc/mm/nohash/8xx.c b/arch/powerpc/mm/nohash/8xx.c index 0df9fe29dd56..baa1f8a40af8 100644 --- a/arch/powerpc/mm/nohash/8xx.c +++ b/arch/powerpc/mm/nohash/8xx.c @@ -213,7 +213,7 @@ void __init setup_initial_memory_limit(phys_addr_t first_memblock_base, } #ifdef CONFIG_PPC_KUEP -void __init setup_kuep(bool disabled) +void setup_kuep(bool disabled) { if (disabled) return; @@ -228,7 +228,7 @@ void __init setup_kuep(bool disabled) struct static_key_false disable_kuap_key; EXPORT_SYMBOL(disable_kuap_key); -void __init setup_kuap(bool disabled) +void setup_kuap(bool disabled) { if (disabled) { static_branch_enable(&disable_kuap_key); -- 2.31.1