From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C75FC433B4 for ; Fri, 2 Apr 2021 04:11:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E056F610D2 for ; Fri, 2 Apr 2021 04:11:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229603AbhDBELR (ORCPT ); Fri, 2 Apr 2021 00:11:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229532AbhDBELP (ORCPT ); Fri, 2 Apr 2021 00:11:15 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79988C0613E6 for ; Thu, 1 Apr 2021 21:11:13 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id x7so3657663wrw.10 for ; Thu, 01 Apr 2021 21:11:13 -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=QCaXwDV10dhKrn8kJuleYfg1EWrPXQo+wqW+nmg1Iys=; b=lp64j9zqOiwLGu7j1wSqsGR/RAb8Ee1i3et6xgUDAbzdA+QpDFE0aLgHsL9jsHgzcU RZlOp4S9wDe4lNplN9yjW/sJ3fH1ObNF0VQ9S7YdFL5xGOdwCOkKoPt0FbkQn+K5Pz0d dTlVZQgwFq5tjZparLLk1GmvROKpce86nGGep+MENfReUfxSIsFtKgvP8klfixq25v25 TVfI2VNfMnZgfXqwkiYjEzb1aa4/Yhdx0p5tpqzqLqfgBEivsYLdeTE2J7SnDmxgF03w OQWv38q8F3dGnyreCxXt5+tDHlOeK9bvUI8trp7iVFdlaTfWUpJn7QEoEaQU+g92xU1m +32A== 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=QCaXwDV10dhKrn8kJuleYfg1EWrPXQo+wqW+nmg1Iys=; b=fDXyiPITbou3jCHBongtYmOtMhhNMpmoqDNqVtxfUsmPXLvz9NCqay4ikS0DPJqgVs 5Voz+a+oGewidwoEK2VIM3LwOLQpzhac37/9t9iF+9TobpdbCiwRHvSYxbk32NaToEI+ YGyBE2OKqb3ttFEwpGqMZ5GPR/Faizie2i10SLR2Za/uNmnOy9gq+qRfIqVR/6/c/wPf AyYXG3G5eo6GyTtcNCfhmNjUU6wnexihQjI7b5clz/ntsij/o82EFRgR3foWi66jAXLI MiJo/Y6XZ6vTvnbi22Xzgt+msD9kZNOnMy92fsjEmW6bEnap+DFZRVqCgC9tUD1BFcQl UD3Q== X-Gm-Message-State: AOAM532e0YQyqH7+ZMZyVe2nLaUqlIE7/1tpZWnbNFe92Hp5YrmNXKck gRz20dVS6IPG3/EL/Ea94qfkfhWv/XHLD5WJFjSDDw== X-Google-Smtp-Source: ABdhPJzYA4Ar4sFBPoRR7zZ5FTywncmiqYFdtbksFa6kQzbDtCwCH1G/RDQn8/MwpunRwtnjKys7ykkkxpBe/8z3mns= X-Received: by 2002:a05:6000:c7:: with SMTP id q7mr13166768wrx.356.1617336672119; Thu, 01 Apr 2021 21:11:12 -0700 (PDT) MIME-Version: 1.0 References: <20210401002442.2fe56b88@xhacker> <20210401002621.409624ee@xhacker> In-Reply-To: <20210401002621.409624ee@xhacker> From: Anup Patel Date: Fri, 2 Apr 2021 09:41:00 +0530 Message-ID: Subject: Re: [PATCH v2 3/9] riscv: Constify sys_call_table 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: bpf@vger.kernel.org On Wed, Mar 31, 2021 at 10:01 PM Jisheng Zhang wrote: > > From: Jisheng Zhang > > Constify the sys_call_table so that it will be placed in the .rodata > section. This will cause attempts to modify the table 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/syscall.h | 2 +- > arch/riscv/kernel/syscall_table.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/riscv/include/asm/syscall.h b/arch/riscv/include/asm/syscall.h > index 49350c8bd7b0..b933b1583c9f 100644 > --- a/arch/riscv/include/asm/syscall.h > +++ b/arch/riscv/include/asm/syscall.h > @@ -15,7 +15,7 @@ > #include > > /* The array of function pointers for syscalls. */ > -extern void *sys_call_table[]; > +extern void * const sys_call_table[]; > > /* > * Only the low 32 bits of orig_r0 are meaningful, so we return int. > diff --git a/arch/riscv/kernel/syscall_table.c b/arch/riscv/kernel/syscall_table.c > index f1ead9df96ca..a63c667c27b3 100644 > --- a/arch/riscv/kernel/syscall_table.c > +++ b/arch/riscv/kernel/syscall_table.c > @@ -13,7 +13,7 @@ > #undef __SYSCALL > #define __SYSCALL(nr, call) [nr] = (call), > > -void *sys_call_table[__NR_syscalls] = { > +void * const sys_call_table[__NR_syscalls] = { > [0 ... __NR_syscalls - 1] = sys_ni_syscall, > #include > }; > -- > 2.31.0 > > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv