Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2312798pxb; Mon, 12 Apr 2021 21:47:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyRIZN2MO4BzCj4dYmJWRXK4NO3CmNiZcNd13PB7ITBW6tSlxZwFVN2UTcCNGkDbp0ok/E X-Received: by 2002:a17:907:3f10:: with SMTP id hq16mr30306058ejc.181.1618289235411; Mon, 12 Apr 2021 21:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618289235; cv=none; d=google.com; s=arc-20160816; b=NoIpMGFw95JSuciEK5P0WKB4zpZjSL3sMoo+rapVOqcwPIvtBE0AyNpCnz+IaP6NWF jmoVDceGk3Il+cJ+v3CXvI88Y9yVof9E+vL5c74I3seNZUMKdHsVUrAP8ibkOESpNN95 bAL6pTyM2lmbeZ6tkBvFUvN9CMZyJLtiANogzjkGbEsq6VlcKbgUgu+msx9rz4MhLRDV Nq0jQeiYKV3Zm/z0klVGN91Fc+BC2R7E6fs17+nX0jUseGCD7b4zZHgi+AkI0V93JfVp 7eCU4os/VgGvS/CLjOOBnMfmuClt7O9bt87YlGfMpFNkcamMXgxOH3gSy3JGUHZM1827 ILkA== 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:subject:cc:to:from:date :dkim-signature; bh=optMq5VsUy9hpP93sIxgyXMVtu5b5NN24HpxtpkpgI4=; b=PgcTpH407Tmg5Fl4gf9IhVes5j8ArI7WSL62RaK4JDr/3UkVdcY80pS+dmwdmVJSfv P9VNFvRQ6NIq2UU8s5jGAFo+qgppr8NlBjv6Bgcpn70by8da/juivGhjAOWmJl1S1zd+ 6I5wlepDkQFjDrSw/uVOctp48rK2bvRadOc8M9hZcbhskwEWRe5Bpp9ZdhZMg/j9avML xOfjQ6Ttgt5bmOzhUboimirLbNPkWzw6rr6CJMJt1n+4xlpGkZ5K/Wx1+p3yRqL+7XYG mArO+nKy8Koo6jckcg+qOkj3hTwVlXoixOkJ11PqGHor8lhrWnckad3tNH9SncsWFvaH NuXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mail.ustc.edu.cn header.s=dkim header.b=JDzN3fsR; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mail.ustc.edu.cn Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nc38si10233580ejc.648.2021.04.12.21.46.52; Mon, 12 Apr 2021 21:47:15 -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; dkim=pass header.i=@mail.ustc.edu.cn header.s=dkim header.b=JDzN3fsR; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mail.ustc.edu.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243404AbhDLQXf (ORCPT + 99 others); Mon, 12 Apr 2021 12:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243288AbhDLQXV (ORCPT ); Mon, 12 Apr 2021 12:23:21 -0400 Received: from ustc.edu.cn (email6.ustc.edu.cn [IPv6:2001:da8:d800::8]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 91C6DC061574 for ; Mon, 12 Apr 2021 09:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ustc.edu.cn; s=dkim; h=Received:Date:From:To:Cc:Subject: Message-ID:In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=optMq5VsUy9hpP93sIxgyXMVtu5b5NN24H pxtpkpgI4=; b=JDzN3fsRumeM35NfpRt0XB7bV4UxN1hzuXDztyi6Y+WLtPodDq +NmmJWIJKShObh7Dgeag7YskcyZo6/0j7H5qovDRgAVktNcyBj/UARTZi3BhIDtV +nC5TJcnXG0Bdx8X9waC0kDkZyFU1wm2eyGOqkg3S6tvEZiXfODSpY6a8= Received: from xhacker (unknown [101.86.20.15]) by newmailweb.ustc.edu.cn (Coremail) with SMTP id LkAmygAXIqy1c3RgxD7LAA--.44336S2; Tue, 13 Apr 2021 00:22:14 +0800 (CST) Date: Tue, 13 Apr 2021 00:17:11 +0800 From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , " =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?=" , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Luke Nelson , Xi Wang , Anup Patel Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 05/10] riscv: Constify sbi_ipi_ops Message-ID: <20210413001711.65a66444@xhacker> In-Reply-To: <20210413001110.7209bae6@xhacker> References: <20210413001110.7209bae6@xhacker> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-CM-TRANSID: LkAmygAXIqy1c3RgxD7LAA--.44336S2 X-Coremail-Antispam: 1UD129KBjvJXoW7KFyxuF4kuF1rWw1xXF1kXwb_yoW8KrW8pw 45urW5CayrGFn2ga43tFWku3y3K3ZrWw1ay3yYka45JF12q3yUAan0qw12vwn8GFyDuFyS vr4rCr4YvF1UAa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvjb7Iv0xC_Zr1lb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjc xK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG 64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JF0_Jw1lYx0Ex4A2jsIE14v26r 1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvEwIxGrwACI402YVCY1x02628vn2kI c2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14 v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_WrylIxkG c2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAFwI 0_Gr1j6F4UJwCI42IY6xAIw20EY4v20xvaj40_Zr0_Wr1UMIIF0xvEx4A2jsIE14v26r1j 6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvjxU2A wIDUUUU X-CM-SenderInfo: xmv2xttqjtqzxdloh3xvwfhvlgxou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jisheng Zhang Constify the sbi_ipi_ops so that it will be placed in the .rodata section. This will cause attempts to modify it to fail when strict page permissions are in place. Signed-off-by: Jisheng Zhang Reviewed-by: Anup Patel --- arch/riscv/include/asm/smp.h | 4 ++-- arch/riscv/kernel/sbi.c | 2 +- arch/riscv/kernel/smp.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/riscv/include/asm/smp.h b/arch/riscv/include/asm/smp.h index df1f7c4cd433..a7d2811f3536 100644 --- a/arch/riscv/include/asm/smp.h +++ b/arch/riscv/include/asm/smp.h @@ -46,7 +46,7 @@ int riscv_hartid_to_cpuid(int hartid); void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out); /* Set custom IPI operations */ -void riscv_set_ipi_ops(struct riscv_ipi_ops *ops); +void riscv_set_ipi_ops(const struct riscv_ipi_ops *ops); /* Clear IPI for current CPU */ void riscv_clear_ipi(void); @@ -92,7 +92,7 @@ static inline void riscv_cpuid_to_hartid_mask(const struct cpumask *in, cpumask_set_cpu(boot_cpu_hartid, out); } -static inline void riscv_set_ipi_ops(struct riscv_ipi_ops *ops) +static inline void riscv_set_ipi_ops(const struct riscv_ipi_ops *ops) { } diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c index 6ebffd579379..7402a417f38e 100644 --- a/arch/riscv/kernel/sbi.c +++ b/arch/riscv/kernel/sbi.c @@ -571,7 +571,7 @@ static void sbi_send_cpumask_ipi(const struct cpumask *target) sbi_send_ipi(cpumask_bits(&hartid_mask)); } -static struct riscv_ipi_ops sbi_ipi_ops = { +static const struct riscv_ipi_ops sbi_ipi_ops = { .ipi_inject = sbi_send_cpumask_ipi }; diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c index 476e2e4bc5c5..366cb87c0e2e 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -87,9 +87,9 @@ static void ipi_stop(void) wait_for_interrupt(); } -static struct riscv_ipi_ops *ipi_ops __ro_after_init; +static const struct riscv_ipi_ops *ipi_ops __ro_after_init; -void riscv_set_ipi_ops(struct riscv_ipi_ops *ops) +void riscv_set_ipi_ops(const struct riscv_ipi_ops *ops) { ipi_ops = ops; } -- 2.31.0