2021-04-15 02:51:28 +00:00
|
|
|
From 9776f3f02a40570e72a7fe650a94ef156b4fb872 Mon Sep 17 00:00:00 2001
|
2021-02-03 01:27:47 +00:00
|
|
|
From: Kevin Mihelich <kevin@archlinuxarm.org>
|
|
|
|
Date: Tue, 2 Feb 2021 13:58:21 -0700
|
2021-02-19 02:38:15 +00:00
|
|
|
Subject: [PATCH 2/4] Fix sandbox 'Aw snap' for sycalls 403 and 407
|
2021-02-03 01:27:47 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc | 9 ++++++++-
|
|
|
|
.../syscall_parameters_restrictions_unittests.cc | 6 ++++++
|
|
|
|
sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc | 6 ++++++
|
|
|
|
sandbox/linux/system_headers/arm_linux_syscalls.h | 8 ++++++++
|
|
|
|
sandbox/linux/system_headers/mips_linux_syscalls.h | 8 ++++++++
|
|
|
|
5 files changed, 36 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
|
2021-04-15 02:51:28 +00:00
|
|
|
index 5242bde81fbf..bef4cf1d24e0 100644
|
2021-02-03 01:27:47 +00:00
|
|
|
--- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
|
|
|
|
+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
|
2021-04-15 02:51:28 +00:00
|
|
|
@@ -159,7 +159,14 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
|
2021-02-03 01:27:47 +00:00
|
|
|
return Allow();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
- if (sysno == __NR_clock_gettime || sysno == __NR_clock_nanosleep) {
|
|
|
|
+ if (sysno == __NR_clock_gettime || sysno == __NR_clock_nanosleep
|
|
|
|
+#if defined(__NR_clock_gettime64)
|
|
|
|
+ || sysno == __NR_clock_gettime64
|
|
|
|
+#endif
|
|
|
|
+#if defined(__NR_clock_nanosleep_time64)
|
|
|
|
+ || sysno == __NR_clock_nanosleep_time64
|
|
|
|
+#endif
|
|
|
|
+ ) {
|
|
|
|
return RestrictClockID();
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions_unittests.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions_unittests.cc
|
|
|
|
index 4bbfc7e53b6f..540149b67d95 100644
|
|
|
|
--- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions_unittests.cc
|
|
|
|
+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions_unittests.cc
|
|
|
|
@@ -61,6 +61,12 @@ class RestrictClockIdPolicy : public bpf_dsl::Policy {
|
|
|
|
case __NR_clock_gettime:
|
|
|
|
case __NR_clock_getres:
|
|
|
|
case __NR_clock_nanosleep:
|
|
|
|
+#if defined(__NR_clock_nanosleep_time64)
|
|
|
|
+ case __NR_clock_nanosleep_time64:
|
|
|
|
+#endif
|
|
|
|
+#if defined(__NR_clock_gettime64)
|
|
|
|
+ case __NR_clock_gettime64:
|
|
|
|
+#endif
|
|
|
|
return RestrictClockID();
|
|
|
|
default:
|
|
|
|
return Allow();
|
|
|
|
diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
|
2021-04-15 02:51:28 +00:00
|
|
|
index f40d436edfbd..c712b00f6179 100644
|
2021-02-03 01:27:47 +00:00
|
|
|
--- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
|
|
|
|
+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
|
|
|
|
@@ -39,6 +39,12 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
|
|
|
|
// filtered by RestrictClokID().
|
|
|
|
case __NR_clock_gettime: // Parameters filtered by RestrictClockID().
|
|
|
|
case __NR_clock_nanosleep: // Parameters filtered by RestrictClockID().
|
|
|
|
+#if defined(__NR_clock_gettime64)
|
|
|
|
+ case __NR_clock_gettime64: // Parameters filtered by RestrictClockID().
|
|
|
|
+#endif
|
|
|
|
+#if defined(__NR_clock_nanosleep_time64)
|
|
|
|
+ case __NR_clock_nanosleep_time64: // Parameters filtered by RestrictClockID().
|
|
|
|
+#endif
|
|
|
|
case __NR_clock_settime: // Privileged.
|
|
|
|
#if defined(__i386__) || \
|
|
|
|
(defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
|
|
|
|
diff --git a/sandbox/linux/system_headers/arm_linux_syscalls.h b/sandbox/linux/system_headers/arm_linux_syscalls.h
|
|
|
|
index 85e2110b4c29..c39c22b5114d 100644
|
|
|
|
--- a/sandbox/linux/system_headers/arm_linux_syscalls.h
|
|
|
|
+++ b/sandbox/linux/system_headers/arm_linux_syscalls.h
|
|
|
|
@@ -1441,6 +1441,14 @@
|
|
|
|
#define __NR_io_pgetevents (__NR_SYSCALL_BASE+399)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#if !defined(__NR_clock_gettime64)
|
|
|
|
+#define __NR_clock_gettime64 (__NR_SYSCALL_BASE+403)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#if !defined(__NR_clock_nanosleep_time64)
|
|
|
|
+#define __NR_clock_nanosleep_time64 (__NR_SYSCALL_BASE+407)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
// ARM private syscalls.
|
|
|
|
#if !defined(__ARM_NR_BASE)
|
|
|
|
#define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000)
|
|
|
|
diff --git a/sandbox/linux/system_headers/mips_linux_syscalls.h b/sandbox/linux/system_headers/mips_linux_syscalls.h
|
|
|
|
index ddbf97f3d8b5..fa01b3bbc668 100644
|
|
|
|
--- a/sandbox/linux/system_headers/mips_linux_syscalls.h
|
|
|
|
+++ b/sandbox/linux/system_headers/mips_linux_syscalls.h
|
|
|
|
@@ -1433,4 +1433,12 @@
|
|
|
|
#define __NR_memfd_create (__NR_Linux + 354)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#if !defined(__NR_clock_gettime64)
|
|
|
|
+#define __NR_clock_gettime64 (__NR_Linux + 403)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#if !defined(__NR_clock_nanosleep_time64)
|
|
|
|
+#define __NR_clock_nanosleep_time64 (__NR_Linux + 407)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS_LINUX_SYSCALLS_H_
|
|
|
|
--
|
2021-03-03 01:25:53 +00:00
|
|
|
2.30.1
|
2021-02-03 01:27:47 +00:00
|
|
|
|