aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2005-07-10 19:49:28 -0400
committerDavid S. Miller <davem@davemloft.net>2005-07-10 19:49:28 -0400
commitbb49bcda15f1bc1a52c7f887db278447f332eaa7 (patch)
treedec754638f3cbc4123e715c42573648859e20735 /arch
parentaf166d15c3ad4d501a0c4fb5b4547bb2ba205918 (diff)
[SPARC64]: Add SECCOMP support.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc64/Kconfig17
-rw-r--r--arch/sparc64/kernel/entry.S10
-rw-r--r--arch/sparc64/kernel/power.c3
-rw-r--r--arch/sparc64/kernel/ptrace.c12
4 files changed, 28 insertions, 14 deletions
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 4b1329286242..6a4733683f0f 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -43,6 +43,23 @@ config SPARC64_PAGE_SIZE_4MB
43 43
44endchoice 44endchoice
45 45
46config SECCOMP
47 bool "Enable seccomp to safely compute untrusted bytecode"
48 depends on PROC_FS
49 default y
50 help
51 This kernel feature is useful for number crunching applications
52 that may need to compute untrusted bytecode during their
53 execution. By using pipes or other transports made available to
54 the process as file descriptors supporting the read/write
55 syscalls, it's possible to isolate those applications in
56 their own address space using seccomp. Once seccomp is
57 enabled via /proc/<pid>/seccomp, it cannot be disabled
58 and the task is only allowed to execute a few safe syscalls
59 defined by each seccomp mode.
60
61 If unsure, say Y. Only embedded should say N here.
62
46source kernel/Kconfig.hz 63source kernel/Kconfig.hz
47 64
48source "init/Kconfig" 65source "init/Kconfig"
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index b51bd14cde44..acc323eef535 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -1552,7 +1552,7 @@ sys_ptrace: add %sp, PTREGS_OFF, %o0
1552 nop 1552 nop
1553 .align 32 1553 .align 32
15541: ldx [%curptr + TI_FLAGS], %l5 15541: ldx [%curptr + TI_FLAGS], %l5
1555 andcc %l5, _TIF_SYSCALL_TRACE, %g0 1555 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP), %g0
1556 be,pt %icc, rtrap 1556 be,pt %icc, rtrap
1557 clr %l6 1557 clr %l6
1558 call syscall_trace 1558 call syscall_trace
@@ -1676,7 +1676,7 @@ linux_sparc_syscall32:
1676 1676
1677 srl %i5, 0, %o5 ! IEU1 1677 srl %i5, 0, %o5 ! IEU1
1678 srl %i2, 0, %o2 ! IEU0 Group 1678 srl %i2, 0, %o2 ! IEU0 Group
1679 andcc %l0, _TIF_SYSCALL_TRACE, %g0 ! IEU0 Group 1679 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP), %g0 ! IEU0 Group
1680 bne,pn %icc, linux_syscall_trace32 ! CTI 1680 bne,pn %icc, linux_syscall_trace32 ! CTI
1681 mov %i0, %l5 ! IEU1 1681 mov %i0, %l5 ! IEU1
1682 call %l7 ! CTI Group brk forced 1682 call %l7 ! CTI Group brk forced
@@ -1699,7 +1699,7 @@ linux_sparc_syscall:
1699 1699
1700 mov %i3, %o3 ! IEU1 1700 mov %i3, %o3 ! IEU1
1701 mov %i4, %o4 ! IEU0 Group 1701 mov %i4, %o4 ! IEU0 Group
1702 andcc %l0, _TIF_SYSCALL_TRACE, %g0 ! IEU1 Group+1 bubble 1702 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP), %g0 ! IEU1 Group+1 bubble
1703 bne,pn %icc, linux_syscall_trace ! CTI Group 1703 bne,pn %icc, linux_syscall_trace ! CTI Group
1704 mov %i0, %l5 ! IEU0 1704 mov %i0, %l5 ! IEU0
17052: call %l7 ! CTI Group brk forced 17052: call %l7 ! CTI Group brk forced
@@ -1727,7 +1727,7 @@ ret_sys_call:
17271: 17271:
1728 cmp %o0, -ERESTART_RESTARTBLOCK 1728 cmp %o0, -ERESTART_RESTARTBLOCK
1729 bgeu,pn %xcc, 1f 1729 bgeu,pn %xcc, 1f
1730 andcc %l0, _TIF_SYSCALL_TRACE, %l6 1730 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP), %l6
173180: 173180:
1732 /* System call success, clear Carry condition code. */ 1732 /* System call success, clear Carry condition code. */
1733 andn %g3, %g2, %g3 1733 andn %g3, %g2, %g3
@@ -1742,7 +1742,7 @@ ret_sys_call:
1742 /* System call failure, set Carry condition code. 1742 /* System call failure, set Carry condition code.
1743 * Also, get abs(errno) to return to the process. 1743 * Also, get abs(errno) to return to the process.
1744 */ 1744 */
1745 andcc %l0, _TIF_SYSCALL_TRACE, %l6 1745 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP), %l6
1746 sub %g0, %o0, %o0 1746 sub %g0, %o0, %o0
1747 or %g3, %g2, %g3 1747 or %g3, %g2, %g3
1748 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] 1748 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c
index 52f14e399b1c..533104c7907d 100644
--- a/arch/sparc64/kernel/power.c
+++ b/arch/sparc64/kernel/power.c
@@ -4,6 +4,8 @@
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com) 4 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
5 */ 5 */
6 6
7#define __KERNEL_SYSCALLS__
8
7#include <linux/config.h> 9#include <linux/config.h>
8#include <linux/kernel.h> 10#include <linux/kernel.h>
9#include <linux/module.h> 11#include <linux/module.h>
@@ -17,7 +19,6 @@
17#include <asm/ebus.h> 19#include <asm/ebus.h>
18#include <asm/auxio.h> 20#include <asm/auxio.h>
19 21
20#define __KERNEL_SYSCALLS__
21#include <linux/unistd.h> 22#include <linux/unistd.h>
22 23
23/* 24/*
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index 80a76e2ad732..5abf596f5964 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc64/kernel/ptrace.c
@@ -630,9 +630,9 @@ out:
630 630
631asmlinkage void syscall_trace(void) 631asmlinkage void syscall_trace(void)
632{ 632{
633#ifdef DEBUG_PTRACE 633 /* do the secure computing check first */
634 printk("%s [%d]: syscall_trace\n", current->comm, current->pid); 634 secure_computing(current_thread_info()->kregs->u_regs[UREG_G1]);
635#endif 635
636 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 636 if (!test_thread_flag(TIF_SYSCALL_TRACE))
637 return; 637 return;
638 if (!(current->ptrace & PT_PTRACED)) 638 if (!(current->ptrace & PT_PTRACED))
@@ -645,12 +645,8 @@ asmlinkage void syscall_trace(void)
645 * for normal use. strace only continues with a signal if the 645 * for normal use. strace only continues with a signal if the
646 * stopping signal is not SIGTRAP. -brl 646 * stopping signal is not SIGTRAP. -brl
647 */ 647 */
648#ifdef DEBUG_PTRACE
649 printk("%s [%d]: syscall_trace exit= %x\n", current->comm,
650 current->pid, current->exit_code);
651#endif
652 if (current->exit_code) { 648 if (current->exit_code) {
653 send_sig (current->exit_code, current, 1); 649 send_sig(current->exit_code, current, 1);
654 current->exit_code = 0; 650 current->exit_code = 0;
655 } 651 }
656} 652}