Skip to content

Commit 875cbf3

Browse files
AKASHI Takahiroctmarinas
authored andcommitted
arm64: Add audit support
On AArch64, audit is supported through generic lib/audit.c and compat_audit.c, and so this patch adds arch specific definitions required. Acked-by Will Deacon <will.deacon@arm.com> Acked-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 5701ede commit 875cbf3

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎arch/arm64/Kconfig‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ config ARM64
1010
select ARM_AMBA
1111
select ARM_ARCH_TIMER
1212
select ARM_GIC
13+
select AUDIT_ARCH_COMPAT_GENERIC
1314
select BUILDTIME_EXTABLE_SORT
1415
select CLONE_BACKWARDS
1516
select COMMON_CLK
@@ -28,6 +29,7 @@ config ARM64
2829
select GENERIC_STRNLEN_USER
2930
select GENERIC_TIME_VSYSCALL
3031
select HARDIRQS_SW_RESEND
32+
select HAVE_ARCH_AUDITSYSCALL
3133
select HAVE_ARCH_JUMP_LABEL
3234
select HAVE_ARCH_KGDB
3335
select HAVE_ARCH_TRACEHOOK

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#ifndef __ASM_SYSCALL_H
1717
#define __ASM_SYSCALL_H
1818

19+
#include <uapi/linux/audit.h>
20+
#include <linux/compat.h>
1921
#include <linux/err.h>
2022

2123
extern const void *sys_call_table[];
@@ -105,4 +107,16 @@ static inline void syscall_set_arguments(struct task_struct *task,
105107
memcpy(&regs->regs[i], args, n * sizeof(args[0]));
106108
}
107109

110+
/*
111+
* We don't care about endianness (__AUDIT_ARCH_LE bit) here because
112+
* AArch64 has the same system calls both on little- and big- endian.
113+
*/
114+
static inline int syscall_get_arch(void)
115+
{
116+
if (is_compat_task())
117+
return AUDIT_ARCH_ARM;
118+
119+
return AUDIT_ARCH_AARCH64;
120+
}
121+
108122
#endif /* __ASM_SYSCALL_H */

‎include/uapi/linux/audit.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ enum {
342342
#define __AUDIT_ARCH_64BIT 0x80000000
343343
#define __AUDIT_ARCH_LE 0x40000000
344344

345+
#define AUDIT_ARCH_AARCH64 (EM_AARCH64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
345346
#define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
346347
#define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE)
347348
#define AUDIT_ARCH_ARMEB (EM_ARM)

0 commit comments

Comments
 (0)