aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2006-07-01 07:36:31 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-01 12:56:04 -0400
commitd882b172512758703ff8d9efb96505eaaee48d2e (patch)
tree64b61d69b4af1395b80446fbc61f0488fbaeedb3 /arch/s390/kernel
parenta581c2a4697ee264699b364399b73477af408e00 (diff)
[PATCH] s390: put sys_call_table into .rodata section and write protect it
Put s390's syscall tables into .rodata section and write protect this section to prevent misuse of it. Suggested by Arjan van de Ven <arjan@infradead.org>. Cc: Arjan van de Ven <arjan@infradead.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/entry.S9
-rw-r--r--arch/s390/kernel/entry64.S1
2 files changed, 7 insertions, 3 deletions
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 1a434a7004ee..d8948c342caf 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -228,8 +228,9 @@ sysc_do_svc:
228sysc_nr_ok: 228sysc_nr_ok:
229 mvc SP_ARGS(4,%r15),SP_R7(%r15) 229 mvc SP_ARGS(4,%r15),SP_R7(%r15)
230sysc_do_restart: 230sysc_do_restart:
231 l %r8,BASED(.Lsysc_table)
231 tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) 232 tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
232 l %r8,sys_call_table-system_call(%r7,%r13) # get system call addr. 233 l %r8,0(%r7,%r8) # get system call addr.
233 bnz BASED(sysc_tracesys) 234 bnz BASED(sysc_tracesys)
234 basr %r14,%r8 # call sys_xxxx 235 basr %r14,%r8 # call sys_xxxx
235 st %r2,SP_R2(%r15) # store return value (change R2 on stack) 236 st %r2,SP_R2(%r15) # store return value (change R2 on stack)
@@ -330,9 +331,10 @@ sysc_tracesys:
330 basr %r14,%r1 331 basr %r14,%r1
331 clc SP_R2(4,%r15),BASED(.Lnr_syscalls) 332 clc SP_R2(4,%r15),BASED(.Lnr_syscalls)
332 bnl BASED(sysc_tracenogo) 333 bnl BASED(sysc_tracenogo)
334 l %r8,BASED(.Lsysc_table)
333 l %r7,SP_R2(%r15) # strace might have changed the 335 l %r7,SP_R2(%r15) # strace might have changed the
334 sll %r7,2 # system call 336 sll %r7,2 # system call
335 l %r8,sys_call_table-system_call(%r7,%r13) 337 l %r8,0(%r7,%r8)
336sysc_tracego: 338sysc_tracego:
337 lm %r3,%r6,SP_R3(%r15) 339 lm %r3,%r6,SP_R3(%r15)
338 l %r2,SP_ORIG_R2(%r15) 340 l %r2,SP_ORIG_R2(%r15)
@@ -1009,6 +1011,7 @@ cleanup_io_leave_insn:
1009.Ltrace: .long syscall_trace 1011.Ltrace: .long syscall_trace
1010.Lvfork: .long sys_vfork 1012.Lvfork: .long sys_vfork
1011.Lschedtail: .long schedule_tail 1013.Lschedtail: .long schedule_tail
1014.Lsysc_table: .long sys_call_table
1012 1015
1013.Lcritical_start: 1016.Lcritical_start:
1014 .long __critical_start + 0x80000000 1017 .long __critical_start + 0x80000000
@@ -1017,8 +1020,8 @@ cleanup_io_leave_insn:
1017.Lcleanup_critical: 1020.Lcleanup_critical:
1018 .long cleanup_critical 1021 .long cleanup_critical
1019 1022
1023 .section .rodata, "a"
1020#define SYSCALL(esa,esame,emu) .long esa 1024#define SYSCALL(esa,esame,emu) .long esa
1021sys_call_table: 1025sys_call_table:
1022#include "syscalls.S" 1026#include "syscalls.S"
1023#undef SYSCALL 1027#undef SYSCALL
1024
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index edad60771673..1ca499fa54b4 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -991,6 +991,7 @@ cleanup_io_leave_insn:
991.Lcritical_end: 991.Lcritical_end:
992 .quad __critical_end 992 .quad __critical_end
993 993
994 .section .rodata, "a"
994#define SYSCALL(esa,esame,emu) .long esame 995#define SYSCALL(esa,esame,emu) .long esame
995sys_call_table: 996sys_call_table:
996#include "syscalls.S" 997#include "syscalls.S"