Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1005367pxf; Thu, 1 Apr 2021 21:14:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSdPmWgOsu3oo5HNIZj8+mRthyYPGRqSCbiT02G+FO9vebKi1it+yQFki/wC75U1/XhDeg X-Received: by 2002:a05:6402:3593:: with SMTP id y19mr13416456edc.317.1617336849135; Thu, 01 Apr 2021 21:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617336849; cv=none; d=google.com; s=arc-20160816; b=bKzupzdXBM00OjHWYHegMy12arcMiIahcmku9WKVHNHjq4KprjI07EOgdKYhCr3sQq 47KLkIyZ3I1gCXLGxhaaCBbt6yV1PDcVzrMD5YvNcq80zeSWa+xNkOi14E7WYjJcB575 eDlFQHk3UYTxDLTKoIJkpetNrbpa7om2C9s6Gb7VHLQL0ksqDkgthdvpmFf7J6K55+CF 8YplJ9PmslqAz8RxdHl+69lCSVvlc/to2UV6zV5pZrVmZF2or3qeYLm3irtp5XDu+JK0 XOU6PFzmPzwTDZBeXMpnNTlitwa0RLFdgTTiNWUKsGbHanByHTTkmKKMJ75qyI0IsFqh nBkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1Ab9mXgnZVMv96jlr6O1hIj0YRsCl0wKzDzAenTSuZc=; b=hWoY7O6gj1Kw0ovgEaP7vD9m7+ihnEsUaF3h3T19/swzQAz0gYBXT2IK+liILTJY3k VFw5ghiOXW39aBdDDCupdhx5Dv4XdRaelhd71xThSJq1ckFVyYmfnbPmzAVhF0IjIu/f 6I9wLyMnbmNXNghqcA3LyqPzZ3JWg3RF3TG0Bfdp7XQIepkWRR2kAXzM90ErMT7aitKM p/CH6F5+zV+W2k3cTzs7Y4tO7Mw2QK/LOxIFPiRWNBhxTew04Dxjy9z6gbCfv+KRof5C 2X228o+323WZgiwER02bZX5g6Jh5Qw/L0DtdaUPaBvQUI+W8tqd8zi1E5KvTHEv5NgU9 HoDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b="xf/w8QzI"; 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 bc2si5587383edb.263.2021.04.01.21.13.45; Thu, 01 Apr 2021 21:14:09 -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=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b="xf/w8QzI"; 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 S229523AbhDBEM4 (ORCPT + 99 others); Fri, 2 Apr 2021 00:12:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbhDBEMz (ORCPT ); Fri, 2 Apr 2021 00:12:55 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 467D3C061788 for ; Thu, 1 Apr 2021 21:12:53 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id x16so3676351wrn.4 for ; Thu, 01 Apr 2021 21:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1Ab9mXgnZVMv96jlr6O1hIj0YRsCl0wKzDzAenTSuZc=; b=xf/w8QzI+ZBwFIoabuDx3ObP6k759O1uCoWKy8RIkcmvbjl+DGebyX85YYxjgYo4sX PaHW64tHXrgYHQBDApeA8ph+hznPztWlLMwAuqexcuiajj5rV0IdISu7vxJlEx7koGkb cmxXFNAz9rVUj/h3eC9Chtfz2c3nvzDmCxjioinaxE8P7iQpnz7fL0B9DCgyeWWYflH7 mTp7kJmwjDBAqoitDCZoxKxQrbvyuWrDiprfRCtkRx9Sga5ojkbpKWXVVgbwg5Nudq3D 5TARSmVvgAdFsa5vtlxP2J5AzOqXeuDc0OKVeaVKw/l+P/4hKIyB4i5N8arf5pBVZPya XjBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1Ab9mXgnZVMv96jlr6O1hIj0YRsCl0wKzDzAenTSuZc=; b=b8ZdFx++8ft8KW/No3qJSUE1v6wjyFIR2lXy7URksNNEGDguF2Al1KhqT4SzOzE2+w YOeNVer0X1nJEyoZedNDH5d3nm0XqZb/E4s3DsCpX3gGuCrak2O1dQm2UYHLY/kAmDFJ 3ekE1WnhDhnHOVYaQz/q6fCgfgGHGiUOY8YxLnqzjHaF0c/Kf31XTpjpckRZCzg0quth eLVYQv1RfGrbgzHiGTIvbgMAqILPifDRg+Eto/Y7Xhp3ymZo750vok4CfLEgFyF6y/xj GCTVM8uIvhP6+v7fgGeF+MNadQejBU7AWSfQJdyoeb3BQDelkRmHylqwCBhLmCHblOLe CMzg== X-Gm-Message-State: AOAM5317dtC6pEyKzmkKx4DRmaVja7TZ7bFIUp7QbMirSrp846ZHsFr8 Mh67VkAKXDRdOlqbVJqEyz5GAJJvqDRuIH4UZQ3Vmg== X-Received: by 2002:adf:9544:: with SMTP id 62mr12956426wrs.128.1617336771963; Thu, 01 Apr 2021 21:12:51 -0700 (PDT) MIME-Version: 1.0 References: <20210401002442.2fe56b88@xhacker> <20210401002651.1da9087e@xhacker> In-Reply-To: <20210401002651.1da9087e@xhacker> From: Anup Patel Date: Fri, 2 Apr 2021 09:42:41 +0530 Message-ID: Subject: Re: [PATCH v2 4/9] riscv: Constify sbi_ipi_ops To: Jisheng Zhang Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Song Liu , Yonghong Song , John Fastabend , KP Singh , Luke Nelson , Xi Wang , linux-riscv , "linux-kernel@vger.kernel.org List" , kasan-dev@googlegroups.com, netdev@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 31, 2021 at 10:02 PM Jisheng Zhang wrote: > > 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 Looks good to me. Reviewed-by: Anup Patel Regards, Anup > --- > 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 cbd94a72eaa7..cb848e80865e 100644 > --- a/arch/riscv/kernel/sbi.c > +++ b/arch/riscv/kernel/sbi.c > @@ -556,7 +556,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 504284d49135..e035124f06dc 100644 > --- a/arch/riscv/kernel/smp.c > +++ b/arch/riscv/kernel/smp.c > @@ -85,9 +85,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 > > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv