Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286075
b: refs/heads/master
c: 89879a7
h: refs/heads/master
i:
  286073: 0c7d71e
  286071: 61932c9
v: v3
  • Loading branch information
James Morris committed Jan 17, 2012
1 parent dfe868c commit f75dbe8
Show file tree
Hide file tree
Showing 113 changed files with 2,222 additions and 8,326 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: f429ee3b808118591d1f3cdf3c0d0793911a5677
refs/heads/master: 89879a7eb81f69e6f63bdb2a442fb765c46482c0
2 changes: 1 addition & 1 deletion trunk/MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -5846,7 +5846,7 @@ F: drivers/mmc/host/sdhci-spear.c
SECURITY SUBSYSTEM
M: James Morris <jmorris@namei.org>
L: linux-security-module@vger.kernel.org (suggested Cc:)
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6.git
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git
W: http://security.wiki.kernel.org/
S: Supported
F: security/
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/arm/include/asm/kprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#define MAX_INSN_SIZE 2
#define MAX_STACK_SIZE 64 /* 32 would probably be OK */

#define regs_return_value(regs) ((regs)->ARM_r0)
#define flush_insn_slot(p) do { } while (0)
#define kretprobe_blacklist_size 0

Expand Down
5 changes: 0 additions & 5 deletions trunk/arch/arm/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,6 @@ static inline int valid_user_regs(struct pt_regs *regs)
return 0;
}

static inline long regs_return_value(struct pt_regs *regs)
{
return regs->ARM_r0;
}

#define instruction_pointer(regs) (regs)->ARM_pc

#ifdef CONFIG_SMP
Expand Down
6 changes: 0 additions & 6 deletions trunk/arch/arm/include/asm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ extern void vfp_flush_hwstate(struct thread_info *);
/*
* thread information flags:
* TIF_SYSCALL_TRACE - syscall trace active
* TIF_SYSCAL_AUDIT - syscall auditing active
* TIF_SIGPENDING - signal pending
* TIF_NEED_RESCHED - rescheduling necessary
* TIF_NOTIFY_RESUME - callback before returning to user
Expand All @@ -140,7 +139,6 @@ extern void vfp_flush_hwstate(struct thread_info *);
#define TIF_NEED_RESCHED 1
#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */
#define TIF_SYSCALL_TRACE 8
#define TIF_SYSCALL_AUDIT 9
#define TIF_POLLING_NRFLAG 16
#define TIF_USING_IWMMXT 17
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
Expand All @@ -151,15 +149,11 @@ extern void vfp_flush_hwstate(struct thread_info *);
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
#define _TIF_SECCOMP (1 << TIF_SECCOMP)

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

/*
* Change these and you break ASM code in entry-common.S
*/
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/arm/kernel/entry-common.S
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ENTRY(ret_from_fork)
get_thread_info tsk
ldr r1, [tsk, #TI_FLAGS] @ check for syscall tracing
mov why, #1
tst r1, #_TIF_SYSCALL_WORK @ are we tracing syscalls?
tst r1, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?
beq ret_slow_syscall
mov r1, sp
mov r0, #1 @ trace exit [IP = 1]
Expand Down Expand Up @@ -443,7 +443,7 @@ ENTRY(vector_swi)
1:
#endif

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

cmp scno, #NR_syscalls @ check upper syscall limit
Expand Down
16 changes: 5 additions & 11 deletions trunk/arch/arm/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,24 +906,18 @@ asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno)
{
unsigned long ip;

if (!test_thread_flag(TIF_SYSCALL_TRACE))
return scno;
if (!(current->ptrace & PT_PTRACED))
return scno;

/*
* Save IP. IP is used to denote syscall entry/exit:
* IP = 0 -> entry, = 1 -> exit
*/
ip = regs->ARM_ip;
regs->ARM_ip = why;

if (!ip)
audit_syscall_exit(regs);
else
audit_syscall_entry(AUDIT_ARCH_ARMEB, scno, regs->ARM_r0,
regs->ARM_r1, regs->ARM_r2, regs->ARM_r3);

if (!test_thread_flag(TIF_SYSCALL_TRACE))
return scno;
if (!(current->ptrace & PT_PTRACED))
return scno;

current_thread_info()->syscall = scno;

/* the 0x80 provides a way for the tracing parent to distinguish
Expand Down
13 changes: 1 addition & 12 deletions trunk/arch/ia64/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,7 @@ static inline unsigned long user_stack_pointer(struct pt_regs *regs)
return regs->ar_bspstore;
}

static inline int is_syscall_success(struct pt_regs *regs)
{
return regs->r10 != -1;
}

static inline long regs_return_value(struct pt_regs *regs)
{
if (is_syscall_success(regs))
return regs->r8;
else
return -regs->r8;
}
#define regs_return_value(regs) ((regs)->r8)

/* Conserve space in histogram by encoding slot bits in address
* bits 2 and 3 rather than bits 0 and 1.
Expand Down
18 changes: 16 additions & 2 deletions trunk/arch/ia64/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,8 +1246,15 @@ syscall_trace_enter (long arg0, long arg1, long arg2, long arg3,
if (test_thread_flag(TIF_RESTORE_RSE))
ia64_sync_krbs();

if (unlikely(current->audit_context)) {
long syscall;
int arch;

audit_syscall_entry(AUDIT_ARCH_IA64, regs.r15, arg0, arg1, arg2, arg3);
syscall = regs.r15;
arch = AUDIT_ARCH_IA64;

audit_syscall_entry(arch, syscall, arg0, arg1, arg2, arg3);
}

return 0;
}
Expand All @@ -1261,7 +1268,14 @@ syscall_trace_leave (long arg0, long arg1, long arg2, long arg3,
{
int step;

audit_syscall_exit(&regs);
if (unlikely(current->audit_context)) {
int success = AUDITSC_RESULT(regs.r10);
long result = regs.r8;

if (success != AUDITSC_SUCCESS)
result = -result;
audit_syscall_exit(success, result);
}

step = test_thread_flag(TIF_SINGLESTEP);
if (step || test_thread_flag(TIF_SYSCALL_TRACE))
Expand Down
5 changes: 0 additions & 5 deletions trunk/arch/microblaze/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ struct pt_regs {
#define instruction_pointer(regs) ((regs)->pc)
#define profile_pc(regs) instruction_pointer(regs)

static inline long regs_return_value(struct pt_regs *regs)
{
return regs->r3;
}

#else /* __KERNEL__ */

/* pt_regs offsets used by gdbserver etc in ptrace syscalls */
Expand Down
9 changes: 6 additions & 3 deletions trunk/arch/microblaze/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
*/
ret = -1L;

audit_syscall_entry(EM_MICROBLAZE, regs->r12, regs->r5, regs->r6,
regs->r7, regs->r8);
if (unlikely(current->audit_context))
audit_syscall_entry(EM_MICROBLAZE, regs->r12,
regs->r5, regs->r6,
regs->r7, regs->r8);

return ret ?: regs->r12;
}
Expand All @@ -157,7 +159,8 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
{
int step;

audit_syscall_exit(regs);
if (unlikely(current->audit_context))
audit_syscall_exit(AUDITSC_RESULT(regs->r3), regs->r3);

step = test_thread_flag(TIF_SINGLESTEP);
if (step || test_thread_flag(TIF_SYSCALL_TRACE))
Expand Down
21 changes: 1 addition & 20 deletions trunk/arch/microblaze/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <linux/cache.h>
#include <linux/of_platform.h>
#include <linux/dma-mapping.h>
#include <linux/cpu.h>
#include <asm/cacheflush.h>
#include <asm/entry.h>
#include <asm/cpuinfo.h>
Expand Down Expand Up @@ -227,23 +226,5 @@ static int __init setup_bus_notifier(void)

return 0;
}
arch_initcall(setup_bus_notifier);

static DEFINE_PER_CPU(struct cpu, cpu_devices);

static int __init topology_init(void)
{
int i, ret;

for_each_present_cpu(i) {
struct cpu *c = &per_cpu(cpu_devices, i);

ret = register_cpu(c, i);
if (ret)
printk(KERN_WARNING "topology_init: register_cpu %d "
"failed (%d)\n", i, ret);
}

return 0;
}
subsys_initcall(topology_init);
arch_initcall(setup_bus_notifier);
14 changes: 1 addition & 13 deletions trunk/arch/mips/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,7 @@ extern int ptrace_set_watch_regs(struct task_struct *child,
*/
#define user_mode(regs) (((regs)->cp0_status & KU_MASK) == KU_USER)

static inline int is_syscall_success(struct pt_regs *regs)
{
return !regs->regs[7];
}

static inline long regs_return_value(struct pt_regs *regs)
{
if (is_syscall_success(regs))
return regs->regs[2];
else
return -regs->regs[2];
}

#define regs_return_value(_regs) ((_regs)->regs[2])
#define instruction_pointer(regs) ((regs)->cp0_epc)
#define profile_pc(regs) instruction_pointer(regs)

Expand Down
11 changes: 7 additions & 4 deletions trunk/arch/mips/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,10 @@ asmlinkage void syscall_trace_enter(struct pt_regs *regs)
}

out:
audit_syscall_entry(audit_arch(), regs->regs[2],
regs->regs[4], regs->regs[5],
regs->regs[6], regs->regs[7]);
if (unlikely(current->audit_context))
audit_syscall_entry(audit_arch(), regs->regs[2],
regs->regs[4], regs->regs[5],
regs->regs[6], regs->regs[7]);
}

/*
Expand All @@ -571,7 +572,9 @@ asmlinkage void syscall_trace_enter(struct pt_regs *regs)
*/
asmlinkage void syscall_trace_leave(struct pt_regs *regs)
{
audit_syscall_exit(regs);
if (unlikely(current->audit_context))
audit_syscall_exit(AUDITSC_RESULT(regs->regs[7]),
-regs->regs[2]);

if (!(current->ptrace & PT_PTRACED))
return;
Expand Down
13 changes: 1 addition & 12 deletions trunk/arch/powerpc/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,7 @@ struct pt_regs {
#define instruction_pointer(regs) ((regs)->nip)
#define user_stack_pointer(regs) ((regs)->gpr[1])
#define kernel_stack_pointer(regs) ((regs)->gpr[1])
static inline int is_syscall_success(struct pt_regs *regs)
{
return !(regs->ccr & 0x10000000);
}

static inline long regs_return_value(struct pt_regs *regs)
{
if (is_syscall_success(regs))
return regs->gpr[3];
else
return -regs->gpr[3];
}
#define regs_return_value(regs) ((regs)->gpr[3])

#ifdef CONFIG_SMP
extern unsigned long profile_pc(struct pt_regs *regs);
Expand Down
30 changes: 17 additions & 13 deletions trunk/arch/powerpc/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1724,20 +1724,22 @@ long do_syscall_trace_enter(struct pt_regs *regs)
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
trace_sys_enter(regs, regs->gpr[0]);

if (unlikely(current->audit_context)) {
#ifdef CONFIG_PPC64
if (!is_32bit_task())
audit_syscall_entry(AUDIT_ARCH_PPC64,
regs->gpr[0],
regs->gpr[3], regs->gpr[4],
regs->gpr[5], regs->gpr[6]);
else
if (!is_32bit_task())
audit_syscall_entry(AUDIT_ARCH_PPC64,
regs->gpr[0],
regs->gpr[3], regs->gpr[4],
regs->gpr[5], regs->gpr[6]);
else
#endif
audit_syscall_entry(AUDIT_ARCH_PPC,
regs->gpr[0],
regs->gpr[3] & 0xffffffff,
regs->gpr[4] & 0xffffffff,
regs->gpr[5] & 0xffffffff,
regs->gpr[6] & 0xffffffff);
audit_syscall_entry(AUDIT_ARCH_PPC,
regs->gpr[0],
regs->gpr[3] & 0xffffffff,
regs->gpr[4] & 0xffffffff,
regs->gpr[5] & 0xffffffff,
regs->gpr[6] & 0xffffffff);
}

return ret ?: regs->gpr[0];
}
Expand All @@ -1746,7 +1748,9 @@ void do_syscall_trace_leave(struct pt_regs *regs)
{
int step;

audit_syscall_exit(regs);
if (unlikely(current->audit_context))
audit_syscall_exit((regs->ccr&0x10000000)?AUDITSC_FAILURE:AUDITSC_SUCCESS,
regs->result);

if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
trace_sys_exit(regs, regs->result);
Expand Down
6 changes: 1 addition & 5 deletions trunk/arch/s390/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,13 +541,9 @@ struct user_regs_struct
#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN)
#define user_stack_pointer(regs)((regs)->gprs[15])
#define regs_return_value(regs)((regs)->gprs[2])
#define profile_pc(regs) instruction_pointer(regs)

static inline long regs_return_value(struct pt_regs *regs)
{
return regs->gprs[2];
}

int regs_query_register_offset(const char *name);
const char *regs_query_register_name(unsigned int offset);
unsigned long regs_get_register(struct pt_regs *regs, unsigned int offset);
Expand Down
15 changes: 9 additions & 6 deletions trunk/arch/s390/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,17 +740,20 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
trace_sys_enter(regs, regs->gprs[2]);

audit_syscall_entry(is_compat_task() ?
AUDIT_ARCH_S390 : AUDIT_ARCH_S390X,
regs->gprs[2], regs->orig_gpr2,
regs->gprs[3], regs->gprs[4],
regs->gprs[5]);
if (unlikely(current->audit_context))
audit_syscall_entry(is_compat_task() ?
AUDIT_ARCH_S390 : AUDIT_ARCH_S390X,
regs->gprs[2], regs->orig_gpr2,
regs->gprs[3], regs->gprs[4],
regs->gprs[5]);
return ret ?: regs->gprs[2];
}

asmlinkage void do_syscall_trace_exit(struct pt_regs *regs)
{
audit_syscall_exit(regs);
if (unlikely(current->audit_context))
audit_syscall_exit(AUDITSC_RESULT(regs->gprs[2]),
regs->gprs[2]);

if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
trace_sys_exit(regs, regs->gprs[2]);
Expand Down
5 changes: 1 addition & 4 deletions trunk/arch/sh/include/asm/ptrace_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ struct pt_dspregs {
#ifdef __KERNEL__

#define MAX_REG_OFFSET offsetof(struct pt_regs, tra)
static inline long regs_return_value(struct pt_regs *regs)
{
return regs->regs[0];
}
#define regs_return_value(_regs) ((_regs)->regs[0])

#endif /* __KERNEL__ */

Expand Down
Loading

0 comments on commit f75dbe8

Please sign in to comment.