Skip to content

Commit ab074ad

Browse files
committed
Merge git://git.infradead.org/users/eparis/audit
Pull audit updates from Eric Paris: "So this change across a whole bunch of arches really solves one basic problem. We want to audit when seccomp is killing a process. seccomp hooks in before the audit syscall entry code. audit_syscall_entry took as an argument the arch of the given syscall. Since the arch is part of what makes a syscall number meaningful it's an important part of the record, but it isn't available when seccomp shoots the syscall... For most arch's we have a better way to get the arch (syscall_get_arch) So the solution was two fold: Implement syscall_get_arch() everywhere there is audit which didn't have it. Use syscall_get_arch() in the seccomp audit code. Having syscall_get_arch() everywhere meant it was a useless flag on the stack and we could get rid of it for the typical syscall entry. The other changes inside the audit system aren't grand, fixed some records that had invalid spaces. Better locking around the task comm field. Removing some dead functions and structs. Make some things static. Really minor stuff" * git://git.infradead.org/users/eparis/audit: (31 commits) audit: rename audit_log_remove_rule to disambiguate for trees audit: cull redundancy in audit_rule_change audit: WARN if audit_rule_change called illegally audit: put rule existence check in canonical order next: openrisc: Fix build audit: get comm using lock to avoid race in string printing audit: remove open_arg() function that is never used audit: correct AUDIT_GET_FEATURE return message type audit: set nlmsg_len for multicast messages. audit: use union for audit_field values since they are mutually exclusive audit: invalid op= values for rules audit: use atomic_t to simplify audit_serial() kernel/audit.c: use ARRAY_SIZE instead of sizeof/sizeof[0] audit: reduce scope of audit_log_fcaps audit: reduce scope of audit_net_id audit: arm64: Remove the audit arch argument to audit_syscall_entry arm64: audit: Add audit hook in syscall_trace_enter/exit() audit: x86: drop arch from __audit_syscall_entry() interface sparc: implement is_32bit_task sparc: properly conditionalize use of TIF_32BIT ...
2 parents 61ed53d + 2991dd2 commit ab074ad

43 files changed

Lines changed: 204 additions & 180 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/alpha/include/asm/syscall.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef _ASM_ALPHA_SYSCALL_H
2+
#define _ASM_ALPHA_SYSCALL_H
3+
4+
#include <uapi/linux/audit.h>
5+
6+
static inline int syscall_get_arch(void)
7+
{
8+
return AUDIT_ARCH_ALPHA;
9+
}
10+
11+
#endif /* _ASM_ALPHA_SYSCALL_H */

‎arch/alpha/kernel/ptrace.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ asmlinkage unsigned long syscall_trace_enter(void)
321321
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
322322
tracehook_report_syscall_entry(current_pt_regs()))
323323
ret = -1UL;
324-
audit_syscall_entry(AUDIT_ARCH_ALPHA, regs->r0, regs->r16, regs->r17, regs->r18, regs->r19);
324+
audit_syscall_entry(regs->r0, regs->r16, regs->r17, regs->r18, regs->r19);
325325
return ret ?: current_pt_regs()->r0;
326326
}
327327

‎arch/arm/kernel/ptrace.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,8 +949,8 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
949949
if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
950950
trace_sys_enter(regs, scno);
951951

952-
audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1,
953-
regs->ARM_r2, regs->ARM_r3);
952+
audit_syscall_entry(scno, regs->ARM_r0, regs->ARM_r1, regs->ARM_r2,
953+
regs->ARM_r3);
954954

955955
return scno;
956956
}

‎arch/arm64/kernel/ptrace.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,8 +1120,8 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
11201120
if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
11211121
trace_sys_enter(regs, regs->syscallno);
11221122

1123-
audit_syscall_entry(syscall_get_arch(), regs->syscallno,
1124-
regs->orig_x0, regs->regs[1], regs->regs[2], regs->regs[3]);
1123+
audit_syscall_entry(regs->syscallno, regs->orig_x0, regs->regs[1],
1124+
regs->regs[2], regs->regs[3]);
11251125

11261126
return regs->syscallno;
11271127
}

‎arch/ia64/include/asm/syscall.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef _ASM_SYSCALL_H
1414
#define _ASM_SYSCALL_H 1
1515

16+
#include <uapi/linux/audit.h>
1617
#include <linux/sched.h>
1718
#include <linux/err.h>
1819

@@ -79,4 +80,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
7980

8081
ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
8182
}
83+
84+
static inline int syscall_get_arch(void)
85+
{
86+
return AUDIT_ARCH_IA64;
87+
}
8288
#endif /* _ASM_SYSCALL_H */

‎arch/ia64/kernel/ptrace.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ syscall_trace_enter (long arg0, long arg1, long arg2, long arg3,
12191219
ia64_sync_krbs();
12201220

12211221

1222-
audit_syscall_entry(AUDIT_ARCH_IA64, regs.r15, arg0, arg1, arg2, arg3);
1222+
audit_syscall_entry(regs.r15, arg0, arg1, arg2, arg3);
12231223

12241224
return 0;
12251225
}

‎arch/microblaze/include/asm/syscall.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef __ASM_MICROBLAZE_SYSCALL_H
22
#define __ASM_MICROBLAZE_SYSCALL_H
33

4+
#include <uapi/linux/audit.h>
45
#include <linux/kernel.h>
56
#include <linux/sched.h>
67
#include <asm/ptrace.h>
@@ -99,4 +100,8 @@ static inline void syscall_set_arguments(struct task_struct *task,
99100
asmlinkage long do_syscall_trace_enter(struct pt_regs *regs);
100101
asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
101102

103+
static inline int syscall_get_arch(void)
104+
{
105+
return AUDIT_ARCH_MICROBLAZE;
106+
}
102107
#endif /* __ASM_MICROBLAZE_SYSCALL_H */

‎arch/microblaze/kernel/ptrace.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
147147
*/
148148
ret = -1L;
149149

150-
audit_syscall_entry(EM_MICROBLAZE, regs->r12, regs->r5, regs->r6,
151-
regs->r7, regs->r8);
150+
audit_syscall_entry(regs->r12, regs->r5, regs->r6, regs->r7, regs->r8);
152151

153152
return ret ?: regs->r12;
154153
}

‎arch/mips/include/asm/syscall.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ extern const unsigned long sysn32_call_table[];
129129

130130
static inline int syscall_get_arch(void)
131131
{
132-
int arch = EM_MIPS;
132+
int arch = AUDIT_ARCH_MIPS;
133133
#ifdef CONFIG_64BIT
134134
if (!test_thread_flag(TIF_32BIT_REGS)) {
135135
arch |= __AUDIT_ARCH_64BIT;

‎arch/mips/kernel/ptrace.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -780,9 +780,7 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)
780780
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
781781
trace_sys_enter(regs, regs->regs[2]);
782782

783-
audit_syscall_entry(syscall_get_arch(),
784-
syscall,
785-
regs->regs[4], regs->regs[5],
783+
audit_syscall_entry(syscall, regs->regs[4], regs->regs[5],
786784
regs->regs[6], regs->regs[7]);
787785
return syscall;
788786
}

0 commit comments

Comments
 (0)