Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3791935pxf; Mon, 29 Mar 2021 11:30:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxc06s0QQwnVBZdVo2T1cfd/MKaPFdiazECnQfAZx1GIX9bMiruOiIIzssCt+KTV/0EY4MO X-Received: by 2002:a50:e702:: with SMTP id a2mr30359613edn.3.1617042640104; Mon, 29 Mar 2021 11:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617042640; cv=none; d=google.com; s=arc-20160816; b=qd0ONFAf1kHfyVgAVbsYKWCgbZDGEBx38a/DkAl7hkpTBBLtnd3Do1h1H/rxU7Rh10 rj+i+3z9hHAMWCgy6PR9+ufPPluGWJRH+sWh68O5C9r2FIUvAoKXT9ifAH9qP1N5pXIh S+qBwVNhDGXr1zEHBMq3zFjuYhr5EoIa17BnUUm5M9+gXNo/kS1TQC3GbJQhc2fj8XIb KS5+891uhrtyvjTPk+Vz2vIs/6aFEWRrtWMNscjtrpO3dfQnLSAB/9dDb+ZJ8lTq5N6D 8JDEyU4nMCfKxFXC/umLfVRi0AgzjFSjWkfccoNFnja+23xTMhLNAAlfX8PIyce4c+kX yqAQ== 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=Ikp7PZAuK4fo1XgsXlr4Y+BaLjbJ/cSgtNEE/K8IQMY=; b=StQcSNPrNBqpBm0z3Zq8h4LG2JOTM6bhHOMvRLINbD/J1s25kUJ/+n1JE/8icZkBRr hnrVHH27n2vrEBDbMTnMHXOjTTiBw83fMGAg+O5XNq8X4nU22YHqX939jFcFOWZQ4k54 DBW0h8Lx0K+ypJmBAO0Uv7+M6TLrLBTfgEh9z8aJtGxuetS6ezygUyobhKwzzD7zJekO 3OT2ZAfW0xcmk74A0zMWU5yAvhjwuyoWxqA0ESaNSOWpKMCXvyy0dLNg6YmFadiYzBJw GYn28MsmydwRUXI+OvVqPQ5sTksSu12WUbJeWXw2fmyeNHMVccDZjTKn+ne6a8asAGZA +EdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mail.ustc.edu.cn header.s=dkim header.b=JRsHagF5; 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 t22si13940916edd.558.2021.03.29.11.30.17; Mon, 29 Mar 2021 11:30:40 -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=JRsHagF5; 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 S231442AbhC2S3I (ORCPT + 99 others); Mon, 29 Mar 2021 14:29:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbhC2S2i (ORCPT ); Mon, 29 Mar 2021 14:28:38 -0400 Received: from ustc.edu.cn (email6.ustc.edu.cn [IPv6:2001:da8:d800::8]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A69C3C061574; Mon, 29 Mar 2021 11:28:36 -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=Ikp7PZAuK4fo1XgsXlr4Y+BaLjbJ/cSgtN EE/K8IQMY=; b=JRsHagF5EB0tq8tcCsYaGxbe8pefBrNGz1SfSUofY9UUTBSibT rv/xKDsCCfQcT/4c+79BRl1K8ngrKxpzIO04E36vBlcn/N5vFlot5utYwpvwAYVf 1IdfTpDMKL4Xy/FUnXZ87zp4A2cbQr/+7E+UGuBL2Z9STZduhUTugnfLU= Received: from xhacker (unknown [101.86.19.180]) by newmailweb.ustc.edu.cn (Coremail) with SMTP id LkAmygAnLkpEHGJgSvRpAA--.42329S2; Tue, 30 Mar 2021 02:28:20 +0800 (CST) Date: Tue, 30 Mar 2021 02:23:24 +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 Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 3/9] riscv: Constify sys_call_table Message-ID: <20210330022324.6737116c@xhacker> In-Reply-To: <20210330022144.150edc6e@xhacker> References: <20210330022144.150edc6e@xhacker> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-CM-TRANSID: LkAmygAnLkpEHGJgSvRpAA--.42329S2 X-Coremail-Antispam: 1UD129KBjvJXoW7KFyxuF4kuF1rWw17ZFyrJFb_yoW8GrWxpr sxC34kKr95WF18CFyakFyxuryxJ3Z8W34agr1qkan8Cw13trZ8tws0ga4ayFyDGFZrWrW0 gF4I9r90kr48XFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkKb7Iv0xC_Zr1lb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjc xK6I8E87Iv6xkF7I0E14v26F4UJVW0owAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40E FcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUAVWUtwAv7VC2z280aVAFwI0_Gr 0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JM4IIrI8v6xkF7I0E8cxan2IY 04v7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI 0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVW8ZVWrXwCIc40Y 0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UMIIF0xvE42xK8VAvwI8IcIk0rVW8JVW3JwCI42IY6I8E87Iv67AKxVWUJVW8 JwCI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7IU8Wmh7 UUUUU== X-CM-SenderInfo: xmv2xttqjtqzxdloh3xvwfhvlgxou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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