Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339514
b: refs/heads/master
c: 9b790d7
h: refs/heads/master
v: v3
  • Loading branch information
Kees Cook authored and Russell King committed Nov 19, 2012
1 parent c42501b commit 7f6ceca
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1f59d13bee172945ccdfbc5018477ba94a0ac28e
refs/heads/master: 9b790d71d58be65f9508ab60920eb978af828412
7 changes: 4 additions & 3 deletions trunk/arch/arm/include/asm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
#define TIF_SYSCALL_TRACE 8
#define TIF_SYSCALL_AUDIT 9
#define TIF_SYSCALL_TRACEPOINT 10
#define TIF_SECCOMP 11 /* seccomp syscall filtering active */
#define TIF_USING_IWMMXT 17
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
#define TIF_RESTORE_SIGMASK 20
#define TIF_SECCOMP 21
#define TIF_SWITCH_MM 22 /* deferred switch_mm */

#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
Expand All @@ -163,11 +163,12 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)

/* Checks for any syscall work in entry-common.S */
#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT)
#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
_TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP)

/*
* Change these and you break ASM code in entry-common.S
Expand Down
10 changes: 0 additions & 10 deletions trunk/arch/arm/kernel/entry-common.S
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,6 @@ local_restart:
ldr r10, [tsk, #TI_FLAGS] @ check for syscall tracing
stmdb sp!, {r4, r5} @ push fifth and sixth args

#ifdef CONFIG_SECCOMP
tst r10, #_TIF_SECCOMP
beq 1f
mov r0, scno
bl __secure_computing
add r0, sp, #S_R0 + S_OFF @ pointer to regs
ldmia r0, {r0 - r3} @ have to reload r0 - r3
1:
#endif

tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls?
bne __sys_trace

Expand Down
29 changes: 20 additions & 9 deletions trunk/arch/arm/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -916,16 +916,11 @@ enum ptrace_syscall_dir {
PTRACE_SYSCALL_EXIT,
};

static int ptrace_syscall_trace(struct pt_regs *regs, int scno,
enum ptrace_syscall_dir dir)
static int tracehook_report_syscall(struct pt_regs *regs,
enum ptrace_syscall_dir dir)
{
unsigned long ip;

current_thread_info()->syscall = scno;

if (!test_thread_flag(TIF_SYSCALL_TRACE))
return scno;

/*
* IP is used to denote syscall entry/exit:
* IP = 0 -> entry, =1 -> exit
Expand All @@ -944,19 +939,35 @@ static int ptrace_syscall_trace(struct pt_regs *regs, int scno,

asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
{
scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER);
current_thread_info()->syscall = scno;

/* Do the secure computing check first; failures should be fast. */
if (secure_computing(scno) == -1)
return -1;

if (test_thread_flag(TIF_SYSCALL_TRACE))
scno = tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);

if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
trace_sys_enter(regs, scno);

audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1,
regs->ARM_r2, regs->ARM_r3);

return scno;
}

asmlinkage int syscall_trace_exit(struct pt_regs *regs, int scno)
{
scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_EXIT);
current_thread_info()->syscall = scno;

if (test_thread_flag(TIF_SYSCALL_TRACE))
scno = tracehook_report_syscall(regs, PTRACE_SYSCALL_EXIT);

if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
trace_sys_exit(regs, scno);

audit_syscall_exit(regs);

return scno;
}

0 comments on commit 7f6ceca

Please sign in to comment.