Skip to content

Commit d2fac0a

Browse files
committed
Merge tag 'audit-pr-20211101' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit
Pull audit updates from Paul Moore: "Add some additional audit logging to capture the openat2() syscall open_how struct info. Previous variations of the open()/openat() syscalls allowed audit admins to inspect the syscall args to get the information contained in the new open_how struct used in openat2()" * tag 'audit-pr-20211101' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit: audit: return early if the filter rule has a lower priority audit: add OPENAT2 record to list "how" info audit: add support for the openat2 syscall audit: replace magic audit syscall class numbers with macros lsm_audit: avoid overloading the "key" audit field audit: Convert to SPDX identifier audit: rename struct node to struct audit_node to prevent future name collisions
2 parents cdab10b + d9516f3 commit d2fac0a

File tree

23 files changed

+184
-98
lines changed

23 files changed

+184
-98
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3127,6 +3127,7 @@ W: https://github.com/linux-audit
31273127
T: git git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit.git
31283128
F: include/asm-generic/audit_*.h
31293129
F: include/linux/audit.h
3130+
F: include/linux/audit_arch.h
31303131
F: include/uapi/linux/audit.h
31313132
F: kernel/audit*
31323133
F: lib/*audit.c

arch/alpha/kernel/audit.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ int audit_classify_syscall(int abi, unsigned syscall)
3737
{
3838
switch(syscall) {
3939
case __NR_open:
40-
return 2;
40+
return AUDITSC_OPEN;
4141
case __NR_openat:
42-
return 3;
42+
return AUDITSC_OPENAT;
4343
case __NR_execve:
44-
return 5;
44+
return AUDITSC_EXECVE;
45+
case __NR_openat2:
46+
return AUDITSC_OPENAT2;
4547
default:
46-
return 0;
48+
return AUDITSC_NATIVE;
4749
}
4850
}
4951

arch/ia64/kernel/audit.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ int audit_classify_syscall(int abi, unsigned syscall)
3838
{
3939
switch(syscall) {
4040
case __NR_open:
41-
return 2;
41+
return AUDITSC_OPEN;
4242
case __NR_openat:
43-
return 3;
43+
return AUDITSC_OPENAT;
4444
case __NR_execve:
45-
return 5;
45+
return AUDITSC_EXECVE;
46+
case __NR_openat2:
47+
return AUDITSC_OPENAT2;
4648
default:
47-
return 0;
49+
return AUDITSC_NATIVE;
4850
}
4951
}
5052

arch/parisc/kernel/audit.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ int audit_classify_syscall(int abi, unsigned syscall)
4747
#endif
4848
switch (syscall) {
4949
case __NR_open:
50-
return 2;
50+
return AUDITSC_OPEN;
5151
case __NR_openat:
52-
return 3;
52+
return AUDITSC_OPENAT;
5353
case __NR_execve:
54-
return 5;
54+
return AUDITSC_EXECVE;
55+
case __NR_openat2:
56+
return AUDITSC_OPENAT2;
5557
default:
56-
return 0;
58+
return AUDITSC_NATIVE;
5759
}
5860
}
5961

arch/parisc/kernel/compat_audit.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
#include <linux/audit_arch.h>
23
#include <asm/unistd.h>
34

45
unsigned int parisc32_dir_class[] = {
@@ -30,12 +31,14 @@ int parisc32_classify_syscall(unsigned syscall)
3031
{
3132
switch (syscall) {
3233
case __NR_open:
33-
return 2;
34+
return AUDITSC_OPEN;
3435
case __NR_openat:
35-
return 3;
36+
return AUDITSC_OPENAT;
3637
case __NR_execve:
37-
return 5;
38+
return AUDITSC_EXECVE;
39+
case __NR_openat2:
40+
return AUDITSC_OPENAT2;
3841
default:
39-
return 1;
42+
return AUDITSC_COMPAT;
4043
}
4144
}

arch/powerpc/kernel/audit.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,17 @@ int audit_classify_syscall(int abi, unsigned syscall)
4747
#endif
4848
switch(syscall) {
4949
case __NR_open:
50-
return 2;
50+
return AUDITSC_OPEN;
5151
case __NR_openat:
52-
return 3;
52+
return AUDITSC_OPENAT;
5353
case __NR_socketcall:
54-
return 4;
54+
return AUDITSC_SOCKETCALL;
5555
case __NR_execve:
56-
return 5;
56+
return AUDITSC_EXECVE;
57+
case __NR_openat2:
58+
return AUDITSC_OPENAT2;
5759
default:
58-
return 0;
60+
return AUDITSC_NATIVE;
5961
}
6062
}
6163

arch/powerpc/kernel/compat_audit.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#undef __powerpc64__
3+
#include <linux/audit_arch.h>
34
#include <asm/unistd.h>
45

56
unsigned ppc32_dir_class[] = {
@@ -31,14 +32,16 @@ int ppc32_classify_syscall(unsigned syscall)
3132
{
3233
switch(syscall) {
3334
case __NR_open:
34-
return 2;
35+
return AUDITSC_OPEN;
3536
case __NR_openat:
36-
return 3;
37+
return AUDITSC_OPENAT;
3738
case __NR_socketcall:
38-
return 4;
39+
return AUDITSC_SOCKETCALL;
3940
case __NR_execve:
40-
return 5;
41+
return AUDITSC_EXECVE;
42+
case __NR_openat2:
43+
return AUDITSC_OPENAT2;
4144
default:
42-
return 1;
45+
return AUDITSC_COMPAT;
4346
}
4447
}

arch/s390/kernel/audit.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,17 @@ int audit_classify_syscall(int abi, unsigned syscall)
4747
#endif
4848
switch(syscall) {
4949
case __NR_open:
50-
return 2;
50+
return AUDITSC_OPEN;
5151
case __NR_openat:
52-
return 3;
52+
return AUDITSC_OPENAT;
5353
case __NR_socketcall:
54-
return 4;
54+
return AUDITSC_SOCKETCALL;
5555
case __NR_execve:
56-
return 5;
56+
return AUDITSC_EXECVE;
57+
case __NR_openat2:
58+
return AUDITSC_OPENAT2;
5759
default:
58-
return 0;
60+
return AUDITSC_NATIVE;
5961
}
6062
}
6163

arch/s390/kernel/compat_audit.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#undef __s390x__
3+
#include <linux/audit_arch.h>
34
#include <asm/unistd.h>
45
#include "audit.h"
56

@@ -32,14 +33,16 @@ int s390_classify_syscall(unsigned syscall)
3233
{
3334
switch(syscall) {
3435
case __NR_open:
35-
return 2;
36+
return AUDITSC_OPEN;
3637
case __NR_openat:
37-
return 3;
38+
return AUDITSC_OPENAT;
3839
case __NR_socketcall:
39-
return 4;
40+
return AUDITSC_SOCKETCALL;
4041
case __NR_execve:
41-
return 5;
42+
return AUDITSC_EXECVE;
43+
case __NR_openat2:
44+
return AUDITSC_OPENAT2;
4245
default:
43-
return 1;
46+
return AUDITSC_COMPAT;
4447
}
4548
}

arch/sparc/kernel/audit.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,17 @@ int audit_classify_syscall(int abi, unsigned int syscall)
4848
#endif
4949
switch(syscall) {
5050
case __NR_open:
51-
return 2;
51+
return AUDITSC_OPEN;
5252
case __NR_openat:
53-
return 3;
53+
return AUDITSC_OPENAT;
5454
case __NR_socketcall:
55-
return 4;
55+
return AUDITSC_SOCKETCALL;
5656
case __NR_execve:
57-
return 5;
57+
return AUDITSC_EXECVE;
58+
case __NR_openat2:
59+
return AUDITSC_OPENAT2;
5860
default:
59-
return 0;
61+
return AUDITSC_NATIVE;
6062
}
6163
}
6264

0 commit comments

Comments
 (0)