[PATCH] Read only syscall tables for x86_64 and i386

Christoph Lameter
2005-06-28T18:47:43Z

Place x86_64 and i386 syscall table into the read only section.

Remove the syscall tables from the data section and place them into the
readonly section (like IA64).

Signed-off-by: Christoph Lameter <christoph@scalex86.org>

Index: linux-2.6.12-mm2/arch/i386/kernel/entry.S
===================================================================
--- linux-2.6.12-mm2.orig/arch/i386/kernel/entry.S 2005-06-28 17:46:31.000000000 +0000
+++ linux-2.6.12-mm2/arch/i386/kernel/entry.S 2005-06-28 17:47:11.000000000 +0000
@@ -680,6 +680,7 @@ ENTRY(spurious_interrupt_bug)
pushl $do_spurious_interrupt_bug
jmp error_code

+.section .rodata,"a"
#include "syscall_table.S"

syscall_table_size=(.-sys_call_table)
Index: linux-2.6.12-mm2/arch/i386/kernel/syscall_table.S
===================================================================
--- linux-2.6.12-mm2.orig/arch/i386/kernel/syscall_table.S 2005-06-28 17:46:31.000000000 +0000
+++ linux-2.6.12-mm2/arch/i386/kernel/syscall_table.S 2005-06-28 17:47:11.000000000 +0000
@@ -1,4 +1,3 @@
-.data
ENTRY(sys_call_table)
.long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */
.long sys_exit
Index: linux-2.6.12-mm2/arch/x86_64/kernel/syscall.c
===================================================================
--- linux-2.6.12-mm2.orig/arch/x86_64/kernel/syscall.c 2005-06-17 19:48:29.000000000 +0000
+++ linux-2.6.12-mm2/arch/x86_64/kernel/syscall.c 2005-06-28 18:22:41.000000000 +0000
@@ -19,7 +19,7 @@ typedef void (*sys_call_ptr_t)(void);

extern void sys_ni_syscall(void);

-sys_call_ptr_t sys_call_table[__NR_syscall_max+1] __cacheline_aligned = {
+const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = {
/* Smells like a like a compiler bug -- it doesn't work when the & below is removed. */
[0 ... __NR_syscall_max] = &sys_ni_syscall,
#include <asm-x86_64/unistd.h>