Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4363614pxv; Tue, 29 Jun 2021 05:27:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwU1BLif/SlNLF9TcFPCcmd3t98EFl1lGsOEW4HBLf53PfZmq9McDGuzdy0pZZTZG6QTGDp X-Received: by 2002:a17:907:7708:: with SMTP id kw8mr30739203ejc.111.1624969675018; Tue, 29 Jun 2021 05:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624969675; cv=none; d=google.com; s=arc-20160816; b=vJZJ/UfrcxRANN2YP92YAujegKC8W/FvpXihRKdsU8OxSC9iT+TkDL7CeyGlT1h7t9 5tdMeu9SjZChb7cuy6gVN5L3QFET+CEzRlTc6IKlnkiyfOr4IqNhWEkjFulLJWCar5T+ Xd6Asx+EUPn48xR5doLmCFwNbuRZpCFg/KXoYCPG3XMMwC051VoeOAYEkbUio9Z4nMSa htRKbTkv2D4q2GK5fb6/7zFP1xxhqQs0fTF6ZLdvAzgKzkSBYCZ0qoRnNTlHzOQkisxo SrLh0oGUegRCUmHZo/JjzFef/uqrsjB8MQIC0fWiavk8XFv+erf+B1xJt70vVfpbGZB0 Cn5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:message-id; bh=fzp5pZ6VZxPDNP9lhjbbPsRnS0wx4+03/sfO+Inf/dI=; b=FlQkAXNcw01rPETL3V0j8YqL0aiiWZ9DpqdKbXKwMXFOhLWHWdu1rR8gnF+fX/gGuA yTZhJf8Qv+j7N4RvO6jgEuU1oOjaD3QuP0QV4a4K4UECXE7V6pWDhIhf8bexYHPWSlsZ ZDnPpwYqS7rXSQesgJSb8nrQprGIAZrUgS+ZcGWDhwRzpAiso+Zuho4w15+pkk9+ysbN sxC2GFo7CRofli79pj8MCEmWzFi2pfVJs2t8+0jQ/IJLE/ZllcLwU12CtpErDh54lt7F VbZuqTp9sZI3mbFxtumehfoSw5A8NOyX4gWuSHdOMbcwwgjEBlF22dDf8iMeZ1Wsw4qC 09sw== 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 og18si17300245ejc.277.2021.06.29.05.27.29; Tue, 29 Jun 2021 05:27:55 -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 S233577AbhF2M0v (ORCPT + 99 others); Tue, 29 Jun 2021 08:26:51 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:61443 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233327AbhF2M0u (ORCPT ); Tue, 29 Jun 2021 08:26:50 -0400 Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4GDkDk6Kq4zBB1J; Tue, 29 Jun 2021 14:24:22 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7-UIwH5HNrjf; Tue, 29 Jun 2021 14:24:22 +0200 (CEST) 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 4GDkDk5SgMzB9kb; Tue, 29 Jun 2021 14:24:22 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5DB718B7C4; Tue, 29 Jun 2021 14:24:22 +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 wUsJs3mO_VbF; Tue, 29 Jun 2021 14:24:22 +0200 (CEST) Received: from po9473vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 170B08B7BF; Tue, 29 Jun 2021 14:24:22 +0200 (CEST) Received: by po9473vm.idsi0.si.c-s.fr (Postfix, from userid 0) id BF36166386; Tue, 29 Jun 2021 12:24:21 +0000 (UTC) Message-Id: <8ee05934288994a65743a987acb1558f12c0c8c1.1624969450.git.christophe.leroy@csgroup.eu> From: Christophe Leroy Subject: [PATCH v2] powerpc/4xx: Fix setup_kuep() on SMP To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 29 Jun 2021 12:24:21 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On SMP, setup_kuep() is also called from start_secondary() since commit 86f46f343272 ("powerpc/32s: Initialise KUAP and KUEP in C"). start_secondary() is not an __init function. Remove the __init marker from setup_kuep() and bail out when not caller on the first CPU as the work is already done. Reported-by: kernel test robot Fixes: 10248dcba120 ("powerpc/44x: Implement Kernel Userspace Exec Protection (KUEP)") Fixes: 86f46f343272 ("powerpc/32s: Initialise KUAP and KUEP in C"). Signed-off-by: Christophe Leroy --- v2: Add missing asm/smp.h to avoid build failure without CONFIG_SMP --- arch/powerpc/mm/nohash/44x.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/nohash/44x.c b/arch/powerpc/mm/nohash/44x.c index 7da6d1e9fc9b..e079f26b267e 100644 --- a/arch/powerpc/mm/nohash/44x.c +++ b/arch/powerpc/mm/nohash/44x.c @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -241,8 +242,11 @@ void __init mmu_init_secondary(int cpu) #endif /* CONFIG_SMP */ #ifdef CONFIG_PPC_KUEP -void __init setup_kuep(bool disabled) +void setup_kuep(bool disabled) { + if (smp_processor_id() != boot_cpuid) + return; + if (disabled) patch_instruction_site(&patch__tlb_44x_kuep, ppc_inst(PPC_RAW_NOP())); else -- 2.25.0