aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-04 11:59:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-04 11:59:53 -0400
commit02cf1da2548d318ad4db9eb4cf8656e24b11aefc (patch)
treeb966cb8239e1a934c2a91da67162b7a7a7b5ac8d /arch
parenta4fdb2a46f617b8b2cd47acec026ec16532edbc6 (diff)
parent8d03bc56cc27ddd93f70a630686ef06289787c78 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile
Pull tile updates from Chris Metcalf: "This includes secure computing support as well as miscellaneous minor improvements" * git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile: tile: correct some typos in opcode type names tile/vdso: emit a GNU hash as well tile: Remove finish_arch_switch tile: enable full SECCOMP support tile/time: Migrate to new 'set-state' interface
Diffstat (limited to 'arch')
-rw-r--r--arch/tile/Kconfig17
-rw-r--r--arch/tile/include/asm/Kbuild1
-rw-r--r--arch/tile/include/asm/elf.h4
-rw-r--r--arch/tile/include/asm/syscall.h28
-rw-r--r--arch/tile/include/uapi/arch/opcode_tilegx.h6
-rw-r--r--arch/tile/kernel/intvec_32.S1
-rw-r--r--arch/tile/kernel/intvec_64.S1
-rw-r--r--arch/tile/kernel/ptrace.c3
-rw-r--r--arch/tile/kernel/time.c8
-rw-r--r--arch/tile/kernel/vdso/Makefile4
10 files changed, 61 insertions, 12 deletions
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 9def1f52d03a..2ba12d761723 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -32,6 +32,7 @@ config TILE
32 select EDAC_SUPPORT 32 select EDAC_SUPPORT
33 select GENERIC_STRNCPY_FROM_USER 33 select GENERIC_STRNCPY_FROM_USER
34 select GENERIC_STRNLEN_USER 34 select GENERIC_STRNLEN_USER
35 select HAVE_ARCH_SECCOMP_FILTER
35 36
36# FIXME: investigate whether we need/want these options. 37# FIXME: investigate whether we need/want these options.
37# select HAVE_IOREMAP_PROT 38# select HAVE_IOREMAP_PROT
@@ -221,6 +222,22 @@ config COMPAT
221 If enabled, the kernel will support running TILE-Gx binaries 222 If enabled, the kernel will support running TILE-Gx binaries
222 that were built with the -m32 option. 223 that were built with the -m32 option.
223 224
225config SECCOMP
226 bool "Enable seccomp to safely compute untrusted bytecode"
227 depends on PROC_FS
228 help
229 This kernel feature is useful for number crunching applications
230 that may need to compute untrusted bytecode during their
231 execution. By using pipes or other transports made available to
232 the process as file descriptors supporting the read/write
233 syscalls, it's possible to isolate those applications in
234 their own address space using seccomp. Once seccomp is
235 enabled via prctl, it cannot be disabled and the task is only
236 allowed to execute a few safe syscalls defined by each seccomp
237 mode.
238
239 If unsure, say N.
240
224config SYSVIPC_COMPAT 241config SYSVIPC_COMPAT
225 def_bool y 242 def_bool y
226 depends on COMPAT && SYSVIPC 243 depends on COMPAT && SYSVIPC
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
index d8a843163471..ba35c41c71ff 100644
--- a/arch/tile/include/asm/Kbuild
+++ b/arch/tile/include/asm/Kbuild
@@ -28,6 +28,7 @@ generic-y += poll.h
28generic-y += posix_types.h 28generic-y += posix_types.h
29generic-y += preempt.h 29generic-y += preempt.h
30generic-y += resource.h 30generic-y += resource.h
31generic-y += seccomp.h
31generic-y += sembuf.h 32generic-y += sembuf.h
32generic-y += serial.h 33generic-y += serial.h
33generic-y += shmbuf.h 34generic-y += shmbuf.h
diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h
index 41d9878a9686..c505d77e4d06 100644
--- a/arch/tile/include/asm/elf.h
+++ b/arch/tile/include/asm/elf.h
@@ -22,6 +22,7 @@
22#include <arch/chip.h> 22#include <arch/chip.h>
23 23
24#include <linux/ptrace.h> 24#include <linux/ptrace.h>
25#include <linux/elf-em.h>
25#include <asm/byteorder.h> 26#include <asm/byteorder.h>
26#include <asm/page.h> 27#include <asm/page.h>
27 28
@@ -30,9 +31,6 @@ typedef unsigned long elf_greg_t;
30#define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t)) 31#define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t))
31typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 32typedef elf_greg_t elf_gregset_t[ELF_NGREG];
32 33
33#define EM_TILEPRO 188
34#define EM_TILEGX 191
35
36/* Provide a nominal data structure. */ 34/* Provide a nominal data structure. */
37#define ELF_NFPREG 0 35#define ELF_NFPREG 0
38typedef double elf_fpreg_t; 36typedef double elf_fpreg_t;
diff --git a/arch/tile/include/asm/syscall.h b/arch/tile/include/asm/syscall.h
index 9644b88f133d..373d73064ea1 100644
--- a/arch/tile/include/asm/syscall.h
+++ b/arch/tile/include/asm/syscall.h
@@ -20,6 +20,8 @@
20 20
21#include <linux/sched.h> 21#include <linux/sched.h>
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/audit.h>
24#include <linux/compat.h>
23#include <arch/abi.h> 25#include <arch/abi.h>
24 26
25/* The array of function pointers for syscalls. */ 27/* The array of function pointers for syscalls. */
@@ -61,7 +63,15 @@ static inline void syscall_set_return_value(struct task_struct *task,
61 struct pt_regs *regs, 63 struct pt_regs *regs,
62 int error, long val) 64 int error, long val)
63{ 65{
64 regs->regs[0] = (long) error ?: val; 66 if (error) {
67 /* R0 is the passed-in negative error, R1 is positive. */
68 regs->regs[0] = error;
69 regs->regs[1] = -error;
70 } else {
71 /* R1 set to zero to indicate no error. */
72 regs->regs[0] = val;
73 regs->regs[1] = 0;
74 }
65} 75}
66 76
67static inline void syscall_get_arguments(struct task_struct *task, 77static inline void syscall_get_arguments(struct task_struct *task,
@@ -82,4 +92,20 @@ static inline void syscall_set_arguments(struct task_struct *task,
82 memcpy(&regs[i], args, n * sizeof(args[0])); 92 memcpy(&regs[i], args, n * sizeof(args[0]));
83} 93}
84 94
95/*
96 * We don't care about endianness (__AUDIT_ARCH_LE bit) here because
97 * tile has the same system calls both on little- and big- endian.
98 */
99static inline int syscall_get_arch(void)
100{
101 if (is_compat_task())
102 return AUDIT_ARCH_TILEGX32;
103
104#ifdef CONFIG_TILEGX
105 return AUDIT_ARCH_TILEGX;
106#else
107 return AUDIT_ARCH_TILEPRO;
108#endif
109}
110
85#endif /* _ASM_TILE_SYSCALL_H */ 111#endif /* _ASM_TILE_SYSCALL_H */
diff --git a/arch/tile/include/uapi/arch/opcode_tilegx.h b/arch/tile/include/uapi/arch/opcode_tilegx.h
index d76ff2db745e..9e46eaa847d4 100644
--- a/arch/tile/include/uapi/arch/opcode_tilegx.h
+++ b/arch/tile/include/uapi/arch/opcode_tilegx.h
@@ -830,11 +830,11 @@ enum
830 ADDX_RRR_0_OPCODE_X0 = 2, 830 ADDX_RRR_0_OPCODE_X0 = 2,
831 ADDX_RRR_0_OPCODE_X1 = 2, 831 ADDX_RRR_0_OPCODE_X1 = 2,
832 ADDX_RRR_0_OPCODE_Y0 = 0, 832 ADDX_RRR_0_OPCODE_Y0 = 0,
833 ADDX_SPECIAL_0_OPCODE_Y1 = 0, 833 ADDX_RRR_0_OPCODE_Y1 = 0,
834 ADD_RRR_0_OPCODE_X0 = 3, 834 ADD_RRR_0_OPCODE_X0 = 3,
835 ADD_RRR_0_OPCODE_X1 = 3, 835 ADD_RRR_0_OPCODE_X1 = 3,
836 ADD_RRR_0_OPCODE_Y0 = 1, 836 ADD_RRR_0_OPCODE_Y0 = 1,
837 ADD_SPECIAL_0_OPCODE_Y1 = 1, 837 ADD_RRR_0_OPCODE_Y1 = 1,
838 ANDI_IMM8_OPCODE_X0 = 3, 838 ANDI_IMM8_OPCODE_X0 = 3,
839 ANDI_IMM8_OPCODE_X1 = 3, 839 ANDI_IMM8_OPCODE_X1 = 3,
840 ANDI_OPCODE_Y0 = 2, 840 ANDI_OPCODE_Y0 = 2,
@@ -995,6 +995,7 @@ enum
995 LD4U_ADD_IMM8_OPCODE_X1 = 12, 995 LD4U_ADD_IMM8_OPCODE_X1 = 12,
996 LD4U_OPCODE_Y2 = 2, 996 LD4U_OPCODE_Y2 = 2,
997 LD4U_UNARY_OPCODE_X1 = 20, 997 LD4U_UNARY_OPCODE_X1 = 20,
998 LDNA_ADD_IMM8_OPCODE_X1 = 21,
998 LDNA_UNARY_OPCODE_X1 = 21, 999 LDNA_UNARY_OPCODE_X1 = 21,
999 LDNT1S_ADD_IMM8_OPCODE_X1 = 13, 1000 LDNT1S_ADD_IMM8_OPCODE_X1 = 13,
1000 LDNT1S_UNARY_OPCODE_X1 = 22, 1001 LDNT1S_UNARY_OPCODE_X1 = 22,
@@ -1015,7 +1016,6 @@ enum
1015 LD_UNARY_OPCODE_X1 = 29, 1016 LD_UNARY_OPCODE_X1 = 29,
1016 LNK_UNARY_OPCODE_X1 = 30, 1017 LNK_UNARY_OPCODE_X1 = 30,
1017 LNK_UNARY_OPCODE_Y1 = 14, 1018 LNK_UNARY_OPCODE_Y1 = 14,
1018 LWNA_ADD_IMM8_OPCODE_X1 = 21,
1019 MFSPR_IMM8_OPCODE_X1 = 22, 1019 MFSPR_IMM8_OPCODE_X1 = 22,
1020 MF_UNARY_OPCODE_X1 = 31, 1020 MF_UNARY_OPCODE_X1 = 31,
1021 MM_BF_OPCODE_X0 = 7, 1021 MM_BF_OPCODE_X0 = 7,
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index cdbda45a4e4b..fbbe2ea882ea 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -1224,6 +1224,7 @@ handle_syscall:
1224 jal do_syscall_trace_enter 1224 jal do_syscall_trace_enter
1225 } 1225 }
1226 FEEDBACK_REENTER(handle_syscall) 1226 FEEDBACK_REENTER(handle_syscall)
1227 blz r0, .Lsyscall_sigreturn_skip
1227 1228
1228 /* 1229 /*
1229 * We always reload our registers from the stack at this 1230 * We always reload our registers from the stack at this
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S
index 800b91d3f9dc..58964d209d4d 100644
--- a/arch/tile/kernel/intvec_64.S
+++ b/arch/tile/kernel/intvec_64.S
@@ -1247,6 +1247,7 @@ handle_syscall:
1247 jal do_syscall_trace_enter 1247 jal do_syscall_trace_enter
1248 } 1248 }
1249 FEEDBACK_REENTER(handle_syscall) 1249 FEEDBACK_REENTER(handle_syscall)
1250 bltz r0, .Lsyscall_sigreturn_skip
1250 1251
1251 /* 1252 /*
1252 * We always reload our registers from the stack at this 1253 * We always reload our registers from the stack at this
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index f84eed8243da..bdc126faf741 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -262,6 +262,9 @@ int do_syscall_trace_enter(struct pt_regs *regs)
262 if (work & _TIF_NOHZ) 262 if (work & _TIF_NOHZ)
263 user_exit(); 263 user_exit();
264 264
265 if (secure_computing() == -1)
266 return -1;
267
265 if (work & _TIF_SYSCALL_TRACE) { 268 if (work & _TIF_SYSCALL_TRACE) {
266 if (tracehook_report_syscall_entry(regs)) 269 if (tracehook_report_syscall_entry(regs))
267 regs->regs[TREG_SYSCALL_NR] = -1; 270 regs->regs[TREG_SYSCALL_NR] = -1;
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index 00178ecf9aea..178989e6d3e3 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -140,10 +140,10 @@ static int tile_timer_set_next_event(unsigned long ticks,
140 * Whenever anyone tries to change modes, we just mask interrupts 140 * Whenever anyone tries to change modes, we just mask interrupts
141 * and wait for the next event to get set. 141 * and wait for the next event to get set.
142 */ 142 */
143static void tile_timer_set_mode(enum clock_event_mode mode, 143static int tile_timer_shutdown(struct clock_event_device *evt)
144 struct clock_event_device *evt)
145{ 144{
146 arch_local_irq_mask_now(INT_TILE_TIMER); 145 arch_local_irq_mask_now(INT_TILE_TIMER);
146 return 0;
147} 147}
148 148
149/* 149/*
@@ -157,7 +157,9 @@ static DEFINE_PER_CPU(struct clock_event_device, tile_timer) = {
157 .rating = 100, 157 .rating = 100,
158 .irq = -1, 158 .irq = -1,
159 .set_next_event = tile_timer_set_next_event, 159 .set_next_event = tile_timer_set_next_event,
160 .set_mode = tile_timer_set_mode, 160 .set_state_shutdown = tile_timer_shutdown,
161 .set_state_oneshot = tile_timer_shutdown,
162 .tick_resume = tile_timer_shutdown,
161}; 163};
162 164
163void setup_tile_timer(void) 165void setup_tile_timer(void)
diff --git a/arch/tile/kernel/vdso/Makefile b/arch/tile/kernel/vdso/Makefile
index a025f63d54cd..c54fff37b5ff 100644
--- a/arch/tile/kernel/vdso/Makefile
+++ b/arch/tile/kernel/vdso/Makefile
@@ -54,7 +54,7 @@ $(obj)/built-in.o: $(obj)/vdso-syms.o
54$(obj)/built-in.o: ld_flags += -R $(obj)/vdso-syms.o 54$(obj)/built-in.o: ld_flags += -R $(obj)/vdso-syms.o
55 55
56SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \ 56SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
57 $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) 57 $(call cc-ldoption, -Wl$(comma)--hash-style=both)
58SYSCFLAGS_vdso_syms.o = -r 58SYSCFLAGS_vdso_syms.o = -r
59$(obj)/vdso-syms.o: $(src)/vdso.lds $(obj)/vrt_sigreturn.o FORCE 59$(obj)/vdso-syms.o: $(src)/vdso.lds $(obj)/vrt_sigreturn.o FORCE
60 $(call if_changed,vdsold) 60 $(call if_changed,vdsold)
@@ -113,6 +113,6 @@ $(obj)/vrt_sigreturn32.o: $(obj)/vrt_sigreturn.S
113$(obj)/vdso32.o: $(obj)/vdso32.so 113$(obj)/vdso32.o: $(obj)/vdso32.so
114 114
115SYSCFLAGS_vdso32.so.dbg = -m32 -shared -s -Wl,-soname=linux-vdso32.so.1 \ 115SYSCFLAGS_vdso32.so.dbg = -m32 -shared -s -Wl,-soname=linux-vdso32.so.1 \
116 $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) 116 $(call cc-ldoption, -Wl$(comma)--hash-style=both)
117$(obj)/vdso32.so.dbg: $(src)/vdso.lds $(obj-vdso32) 117$(obj)/vdso32.so.dbg: $(src)/vdso.lds $(obj-vdso32)
118 $(call if_changed,vdsold) 118 $(call if_changed,vdsold)