You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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 ...
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
#ifndef _ASM_ALPHA_SYSCALL_H
|
||||
#define _ASM_ALPHA_SYSCALL_H
|
||||
|
||||
#include <uapi/linux/audit.h>
|
||||
|
||||
static inline int syscall_get_arch(void)
|
||||
{
|
||||
return AUDIT_ARCH_ALPHA;
|
||||
}
|
||||
|
||||
#endif /* _ASM_ALPHA_SYSCALL_H */
|
||||
@@ -321,7 +321,7 @@ asmlinkage unsigned long syscall_trace_enter(void)
|
||||
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
|
||||
tracehook_report_syscall_entry(current_pt_regs()))
|
||||
ret = -1UL;
|
||||
audit_syscall_entry(AUDIT_ARCH_ALPHA, regs->r0, regs->r16, regs->r17, regs->r18, regs->r19);
|
||||
audit_syscall_entry(regs->r0, regs->r16, regs->r17, regs->r18, regs->r19);
|
||||
return ret ?: current_pt_regs()->r0;
|
||||
}
|
||||
|
||||
|
||||
@@ -949,8 +949,8 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
|
||||
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);
|
||||
audit_syscall_entry(scno, regs->ARM_r0, regs->ARM_r1, regs->ARM_r2,
|
||||
regs->ARM_r3);
|
||||
|
||||
return scno;
|
||||
}
|
||||
|
||||
@@ -1120,8 +1120,8 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
|
||||
if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
|
||||
trace_sys_enter(regs, regs->syscallno);
|
||||
|
||||
audit_syscall_entry(syscall_get_arch(), regs->syscallno,
|
||||
regs->orig_x0, regs->regs[1], regs->regs[2], regs->regs[3]);
|
||||
audit_syscall_entry(regs->syscallno, regs->orig_x0, regs->regs[1],
|
||||
regs->regs[2], regs->regs[3]);
|
||||
|
||||
return regs->syscallno;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#ifndef _ASM_SYSCALL_H
|
||||
#define _ASM_SYSCALL_H 1
|
||||
|
||||
#include <uapi/linux/audit.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
@@ -79,4 +80,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
|
||||
|
||||
ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
|
||||
}
|
||||
|
||||
static inline int syscall_get_arch(void)
|
||||
{
|
||||
return AUDIT_ARCH_IA64;
|
||||
}
|
||||
#endif /* _ASM_SYSCALL_H */
|
||||
|
||||
@@ -1219,7 +1219,7 @@ syscall_trace_enter (long arg0, long arg1, long arg2, long arg3,
|
||||
ia64_sync_krbs();
|
||||
|
||||
|
||||
audit_syscall_entry(AUDIT_ARCH_IA64, regs.r15, arg0, arg1, arg2, arg3);
|
||||
audit_syscall_entry(regs.r15, arg0, arg1, arg2, arg3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef __ASM_MICROBLAZE_SYSCALL_H
|
||||
#define __ASM_MICROBLAZE_SYSCALL_H
|
||||
|
||||
#include <uapi/linux/audit.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <asm/ptrace.h>
|
||||
@@ -99,4 +100,8 @@ static inline void syscall_set_arguments(struct task_struct *task,
|
||||
asmlinkage long do_syscall_trace_enter(struct pt_regs *regs);
|
||||
asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
|
||||
|
||||
static inline int syscall_get_arch(void)
|
||||
{
|
||||
return AUDIT_ARCH_MICROBLAZE;
|
||||
}
|
||||
#endif /* __ASM_MICROBLAZE_SYSCALL_H */
|
||||
|
||||
@@ -147,8 +147,7 @@ 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);
|
||||
audit_syscall_entry(regs->r12, regs->r5, regs->r6, regs->r7, regs->r8);
|
||||
|
||||
return ret ?: regs->r12;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ extern const unsigned long sysn32_call_table[];
|
||||
|
||||
static inline int syscall_get_arch(void)
|
||||
{
|
||||
int arch = EM_MIPS;
|
||||
int arch = AUDIT_ARCH_MIPS;
|
||||
#ifdef CONFIG_64BIT
|
||||
if (!test_thread_flag(TIF_32BIT_REGS)) {
|
||||
arch |= __AUDIT_ARCH_64BIT;
|
||||
|
||||
@@ -780,9 +780,7 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)
|
||||
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
|
||||
trace_sys_enter(regs, regs->regs[2]);
|
||||
|
||||
audit_syscall_entry(syscall_get_arch(),
|
||||
syscall,
|
||||
regs->regs[4], regs->regs[5],
|
||||
audit_syscall_entry(syscall, regs->regs[4], regs->regs[5],
|
||||
regs->regs[6], regs->regs[7]);
|
||||
return syscall;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#ifndef __ASM_OPENRISC_SYSCALL_H__
|
||||
#define __ASM_OPENRISC_SYSCALL_H__
|
||||
|
||||
#include <uapi/linux/audit.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
@@ -71,4 +72,8 @@ syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
|
||||
memcpy(®s->gpr[3 + i], args, n * sizeof(args[0]));
|
||||
}
|
||||
|
||||
static inline int syscall_get_arch(void)
|
||||
{
|
||||
return AUDIT_ARCH_OPENRISC;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -55,9 +55,8 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
|
||||
/* A placeholder; OR32 does not have fp support yes, so no fp regs for now. */
|
||||
typedef unsigned long elf_fpregset_t;
|
||||
|
||||
/* This should be moved to include/linux/elf.h */
|
||||
/* EM_OPENRISC is defined in linux/elf-em.h */
|
||||
#define EM_OR32 0x8472
|
||||
#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
|
||||
|
||||
/*
|
||||
* These are used to set parameters in the core dumps.
|
||||
|
||||
@@ -187,8 +187,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
|
||||
*/
|
||||
ret = -1L;
|
||||
|
||||
audit_syscall_entry(AUDIT_ARCH_OPENRISC, regs->gpr[11],
|
||||
regs->gpr[3], regs->gpr[4],
|
||||
audit_syscall_entry(regs->gpr[11], regs->gpr[3], regs->gpr[4],
|
||||
regs->gpr[5], regs->gpr[6]);
|
||||
|
||||
return ret ? : regs->gpr[11];
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#ifndef _ASM_PARISC_SYSCALL_H_
|
||||
#define _ASM_PARISC_SYSCALL_H_
|
||||
|
||||
#include <uapi/linux/audit.h>
|
||||
#include <linux/compat.h>
|
||||
#include <linux/err.h>
|
||||
#include <asm/ptrace.h>
|
||||
|
||||
@@ -37,4 +39,13 @@ static inline void syscall_get_arguments(struct task_struct *tsk,
|
||||
}
|
||||
}
|
||||
|
||||
static inline int syscall_get_arch(void)
|
||||
{
|
||||
int arch = AUDIT_ARCH_PARISC;
|
||||
#ifdef CONFIG_64BIT
|
||||
if (!is_compat_task())
|
||||
arch = AUDIT_ARCH_PARISC64;
|
||||
#endif
|
||||
return arch;
|
||||
}
|
||||
#endif /*_ASM_PARISC_SYSCALL_H_*/
|
||||
|
||||
@@ -280,14 +280,11 @@ long do_syscall_trace_enter(struct pt_regs *regs)
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
if (!is_compat_task())
|
||||
audit_syscall_entry(AUDIT_ARCH_PARISC64,
|
||||
regs->gr[20],
|
||||
regs->gr[26], regs->gr[25],
|
||||
regs->gr[24], regs->gr[23]);
|
||||
audit_syscall_entry(regs->gr[20], regs->gr[26], regs->gr[25],
|
||||
regs->gr[24], regs->gr[23]);
|
||||
else
|
||||
#endif
|
||||
audit_syscall_entry(AUDIT_ARCH_PARISC,
|
||||
regs->gr[20] & 0xffffffff,
|
||||
audit_syscall_entry(regs->gr[20] & 0xffffffff,
|
||||
regs->gr[26] & 0xffffffff,
|
||||
regs->gr[25] & 0xffffffff,
|
||||
regs->gr[24] & 0xffffffff,
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
#ifndef _ASM_SYSCALL_H
|
||||
#define _ASM_SYSCALL_H 1
|
||||
|
||||
#include <uapi/linux/audit.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/thread_info.h>
|
||||
|
||||
/* ftrace syscalls requires exporting the sys_call_table */
|
||||
#ifdef CONFIG_FTRACE_SYSCALLS
|
||||
@@ -86,4 +88,8 @@ static inline void syscall_set_arguments(struct task_struct *task,
|
||||
memcpy(®s->gpr[3 + i], args, n * sizeof(args[0]));
|
||||
}
|
||||
|
||||
static inline int syscall_get_arch(void)
|
||||
{
|
||||
return is_32bit_task() ? AUDIT_ARCH_PPC : AUDIT_ARCH_PPC64;
|
||||
}
|
||||
#endif /* _ASM_SYSCALL_H */
|
||||
|
||||
@@ -1788,14 +1788,11 @@ long do_syscall_trace_enter(struct pt_regs *regs)
|
||||
|
||||
#ifdef CONFIG_PPC64
|
||||
if (!is_32bit_task())
|
||||
audit_syscall_entry(AUDIT_ARCH_PPC64,
|
||||
regs->gpr[0],
|
||||
regs->gpr[3], regs->gpr[4],
|
||||
audit_syscall_entry(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],
|
||||
audit_syscall_entry(regs->gpr[0],
|
||||
regs->gpr[3] & 0xffffffff,
|
||||
regs->gpr[4] & 0xffffffff,
|
||||
regs->gpr[5] & 0xffffffff,
|
||||
|
||||
@@ -834,9 +834,7 @@ 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,
|
||||
audit_syscall_entry(regs->gprs[2], regs->orig_gpr2,
|
||||
regs->gprs[3], regs->gprs[4],
|
||||
regs->gprs[5]);
|
||||
out:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef __ASM_SH_SYSCALL_32_H
|
||||
#define __ASM_SH_SYSCALL_32_H
|
||||
|
||||
#include <uapi/linux/audit.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/err.h>
|
||||
@@ -93,4 +94,13 @@ static inline void syscall_set_arguments(struct task_struct *task,
|
||||
}
|
||||
}
|
||||
|
||||
static inline int syscall_get_arch(void)
|
||||
{
|
||||
int arch = AUDIT_ARCH_SH;
|
||||
|
||||
#ifdef CONFIG_CPU_LITTLE_ENDIAN
|
||||
arch |= __AUDIT_ARCH_LE;
|
||||
#endif
|
||||
return arch;
|
||||
}
|
||||
#endif /* __ASM_SH_SYSCALL_32_H */
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef __ASM_SH_SYSCALL_64_H
|
||||
#define __ASM_SH_SYSCALL_64_H
|
||||
|
||||
#include <uapi/linux/audit.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <asm/ptrace.h>
|
||||
@@ -61,4 +62,17 @@ static inline void syscall_set_arguments(struct task_struct *task,
|
||||
memcpy(®s->regs[2 + i], args, n * sizeof(args[0]));
|
||||
}
|
||||
|
||||
static inline int syscall_get_arch(void)
|
||||
{
|
||||
int arch = AUDIT_ARCH_SH;
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
arch |= __AUDIT_ARCH_64BIT;
|
||||
#endif
|
||||
#ifdef CONFIG_CPU_LITTLE_ENDIAN
|
||||
arch |= __AUDIT_ARCH_LE;
|
||||
#endif
|
||||
|
||||
return arch;
|
||||
}
|
||||
#endif /* __ASM_SH_SYSCALL_64_H */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user