Skip to content

Commit

Permalink
riscv: Constify sys_call_table
Browse files Browse the repository at this point in the history
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 <jszhang@kernel.org>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
  • Loading branch information
Jisheng Zhang authored and Palmer Dabbelt committed Apr 26, 2021
1 parent de31ea4 commit e6a3022
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/riscv/include/asm/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <linux/err.h>

/* 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.
Expand Down
2 changes: 1 addition & 1 deletion arch/riscv/kernel/syscall_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <asm/unistd.h>
};

0 comments on commit e6a3022

Please sign in to comment.