diff options
author | Richard Guy Briggs <rgb@redhat.com> | 2017-01-17 11:07:15 -0500 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2017-01-18 15:05:25 -0500 |
commit | 62bc306e2083436675e33b5bdeb6a77907d35971 (patch) | |
tree | c209cd6b56b331e8dcc1f4bff2eb75ce822226da /net/compat.c | |
parent | 92c82e8a322b32a6cabe7d8800dc10401157a623 (diff) |
audit: log 32-bit socketcalls
32-bit socketcalls were not being logged by audit on x86_64 systems.
Log them. This is basically a duplicate of the call from
net/socket.c:sys_socketcall(), but it addresses the impedance mismatch
between 32-bit userspace process and 64-bit kernel audit.
See: https://github.com/linux-audit/audit-kernel/issues/14
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'net/compat.c')
-rw-r--r-- | net/compat.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/net/compat.c b/net/compat.c index 1cd2ec046164..a96fd2f3507b 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/filter.h> | 22 | #include <linux/filter.h> |
23 | #include <linux/compat.h> | 23 | #include <linux/compat.h> |
24 | #include <linux/security.h> | 24 | #include <linux/security.h> |
25 | #include <linux/audit.h> | ||
25 | #include <linux/export.h> | 26 | #include <linux/export.h> |
26 | 27 | ||
27 | #include <net/scm.h> | 28 | #include <net/scm.h> |
@@ -781,14 +782,24 @@ COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg, | |||
781 | 782 | ||
782 | COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args) | 783 | COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args) |
783 | { | 784 | { |
784 | int ret; | 785 | u32 a[AUDITSC_ARGS]; |
785 | u32 a[6]; | 786 | unsigned int len; |
786 | u32 a0, a1; | 787 | u32 a0, a1; |
788 | int ret; | ||
787 | 789 | ||
788 | if (call < SYS_SOCKET || call > SYS_SENDMMSG) | 790 | if (call < SYS_SOCKET || call > SYS_SENDMMSG) |
789 | return -EINVAL; | 791 | return -EINVAL; |
790 | if (copy_from_user(a, args, nas[call])) | 792 | len = nas[call]; |
793 | if (len > sizeof(a)) | ||
794 | return -EINVAL; | ||
795 | |||
796 | if (copy_from_user(a, args, len)) | ||
791 | return -EFAULT; | 797 | return -EFAULT; |
798 | |||
799 | ret = audit_socketcall_compat(len / sizeof(a[0]), a); | ||
800 | if (ret) | ||
801 | return ret; | ||
802 | |||
792 | a0 = a[0]; | 803 | a0 = a[0]; |
793 | a1 = a[1]; | 804 | a1 = a[1]; |
794 | 805 | ||