Skip to content

Commit c05c2ec

Browse files
committed
Merge branch 'parisc-4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc fixes from Helge Deller: "Fix seccomp filter support and SIGSYS signals on compat kernel. Both patches are tagged for v4.5 stable kernel" * 'parisc-4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Fix and enable seccomp filter support parisc: Fix SIGSYS signals in compat case
2 parents e9dcfaf + 910cd32 commit c05c2ec

File tree

6 files changed

+35
-2
lines changed

6 files changed

+35
-2
lines changed

arch/parisc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ config PARISC
3030
select TTY # Needed for pdc_cons.c
3131
select HAVE_DEBUG_STACKOVERFLOW
3232
select HAVE_ARCH_AUDITSYSCALL
33+
select HAVE_ARCH_SECCOMP_FILTER
3334
select ARCH_NO_COHERENT_DMA_MMAP
3435

3536
help

arch/parisc/include/asm/compat.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ typedef struct compat_siginfo {
183183
int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
184184
int _fd;
185185
} _sigpoll;
186+
187+
/* SIGSYS */
188+
struct {
189+
compat_uptr_t _call_addr; /* calling user insn */
190+
int _syscall; /* triggering system call number */
191+
compat_uint_t _arch; /* AUDIT_ARCH_* of syscall */
192+
} _sigsys;
186193
} _sifields;
187194
} compat_siginfo_t;
188195

arch/parisc/include/asm/syscall.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ static inline void syscall_get_arguments(struct task_struct *tsk,
3939
}
4040
}
4141

42+
static inline void syscall_set_return_value(struct task_struct *task,
43+
struct pt_regs *regs,
44+
int error, long val)
45+
{
46+
regs->gr[28] = error ? error : val;
47+
}
48+
49+
static inline void syscall_rollback(struct task_struct *task,
50+
struct pt_regs *regs)
51+
{
52+
/* do nothing */
53+
}
54+
4255
static inline int syscall_get_arch(void)
4356
{
4457
int arch = AUDIT_ARCH_PARISC;

arch/parisc/kernel/ptrace.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
270270
long do_syscall_trace_enter(struct pt_regs *regs)
271271
{
272272
/* Do the secure computing check first. */
273-
secure_computing_strict(regs->gr[20]);
273+
if (secure_computing() == -1)
274+
return -1;
274275

275276
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
276277
tracehook_report_syscall_entry(regs)) {
@@ -296,7 +297,11 @@ long do_syscall_trace_enter(struct pt_regs *regs)
296297
regs->gr[23] & 0xffffffff);
297298

298299
out:
299-
return regs->gr[20];
300+
/*
301+
* Sign extend the syscall number to 64bit since it may have been
302+
* modified by a compat ptrace call
303+
*/
304+
return (int) ((u32) regs->gr[20]);
300305
}
301306

302307
void do_syscall_trace_exit(struct pt_regs *regs)

arch/parisc/kernel/signal32.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,11 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, const siginfo_t *from)
371371
val = (compat_int_t)from->si_int;
372372
err |= __put_user(val, &to->si_int);
373373
break;
374+
case __SI_SYS >> 16:
375+
err |= __put_user(ptr_to_compat(from->si_call_addr), &to->si_call_addr);
376+
err |= __put_user(from->si_syscall, &to->si_syscall);
377+
err |= __put_user(from->si_arch, &to->si_arch);
378+
break;
374379
}
375380
}
376381
return err;

arch/parisc/kernel/syscall.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ tracesys_next:
329329

330330
ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */
331331
LDREG TI_TASK(%r1), %r1
332+
LDREG TASK_PT_GR28(%r1), %r28 /* Restore return value */
332333
LDREG TASK_PT_GR26(%r1), %r26 /* Restore the users args */
333334
LDREG TASK_PT_GR25(%r1), %r25
334335
LDREG TASK_PT_GR24(%r1), %r24
@@ -342,6 +343,7 @@ tracesys_next:
342343
stw %r21, -56(%r30) /* 6th argument */
343344
#endif
344345

346+
cmpib,COND(=),n -1,%r20,tracesys_exit /* seccomp may have returned -1 */
345347
comiclr,>>= __NR_Linux_syscalls, %r20, %r0
346348
b,n .Ltracesys_nosys
347349

0 commit comments

Comments
 (0)