Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1004216pxf; Thu, 1 Apr 2021 21:11:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIJ1J1fWGfR8PUPdIlR5g4WDXMOMiHVDUiCSb0PUS7qnq/5WkcVVViQESnqZe7eLaQVjqd X-Received: by 2002:a02:8801:: with SMTP id r1mr11373950jai.51.1617336712956; Thu, 01 Apr 2021 21:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617336712; cv=none; d=google.com; s=arc-20160816; b=nIJadDLfkqJKXPNcWaph1XYPlu8hLOTZrWLUBmWfUpZP4Yd3jSzNsXJfIGlU89x2mr F/yKvCL0lDnYFPfwlE+LG5edk9DkqIuyehEEhi4RKnfob0+EJzgZVIOEvzWHsJohA8jz yue1WqmCQOJpsNMcI1YF5p47AgjA5VtA+XNnkrGgI72o1WUd9ZA+BF/oA3WwbRBonZZA z55/lBbessJwVNNgpS78iY/t+K9phzHFRyc66jOhbI4AGdxzVaPchYx8Gw4er5hnGeFp 6US3qKOrtEOvrMAERZJby0jYa3Y5DLGb/N7YUFlAPbTOXgguDVmWoigYxMKTydAov0Fs z7lg== 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=QCaXwDV10dhKrn8kJuleYfg1EWrPXQo+wqW+nmg1Iys=; b=mB4KWDRDogW7uxXgUPYOmNzPMsQs7/oiN7O6bKrmyuhv4Zuu7y/sRawEpEQkleUHez 8Cnrcv8txHNx42ohhd7jzdPOnoh3BQ9xWdYwhbwL2zlUrcC/wwvXnydqBHSQxbo5PnP8 KbCjvUcQqneqTHxSB9AUj8HHHH79vTS+989f3SqxZnj5m/Z0wNTjKats76x9OMREjIgd hBE1hkKv4qHU3yhkrGS/M9DNR522bxV2MmDLPHV/F/mmtrrvznYpp8R5bPzUJ+Vx3dHc FFeUeyeiGDCX5zcyML29PJlOW1kSuFCvYY/Njcrnce9ydMMJ5vP82ojzP/Que0fyfS2i +uBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=lp64j9zq; 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 l3si6616689ilk.88.2021.04.01.21.11.38; Thu, 01 Apr 2021 21:11:52 -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=lp64j9zq; 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 S229714AbhDBELR (ORCPT + 99 others); Fri, 2 Apr 2021 00:11:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbhDBELP (ORCPT ); Fri, 2 Apr 2021 00:11:15 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AD4FC061788 for ; Thu, 1 Apr 2021 21:11:13 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id b9so3665409wrt.8 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=YbrBfkrqLDsg2MS74VsllUg9pFAKAdoUC2p9NgpGEXj9oWyy109ci2VeJO7mJRvXaa 1i1lIlAp7a5VADfHZbFiEltEAx2qBPFXCqWB2ZSi2Eswz1Ygzo1Ua69F8qzu+5OOnqC2 Uz96hQgWPwn10drC5gmq6lKwwPQLqNuDYda4tWonqsVIQp7H9JHm8R54A6uBAwY/Y4fo 9/MDVxzBZb8lXLvWFrm/oselsI33/aztrsAYss817KS5F4/fwLjD5wi655QJtgMMfCH0 NxMxsXrt8C0Ap507zSPepnYefByUDRtZtmxEhGmeH7IEur9tZhvEIroSUXTzrLA6x6sG ZwiQ== X-Gm-Message-State: AOAM531gA+b3ORt9ePiFBBJLqYNm8cYQAf7uUO9fpduWZMc1VVFVmeeS Kk5ar0fK0pJ+vp8Tm2idIm82AnPoj6U1Z/56oQlJAQ== 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: linux-kernel@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