summaryrefslogtreecommitdiffhomepage
path: root/test/util/save_util_linux.cc
diff options
context:
space:
mode:
authorBin Lu <bin.lu@arm.com>2019-12-24 10:29:36 +0800
committerBin Lu <bin.lu@arm.com>2019-12-30 10:09:48 +0800
commit03e53745cc04f674d4795fcafcca755c836e526f (patch)
treec45bec6e3c1177bda70d184ed369fc9c69bd4499 /test/util/save_util_linux.cc
parent574e988f2bc6060078a17f37a377441703c52a22 (diff)
Add test/util/save_util_linux.cc:MaybeSave to support arm64
There is no syscall_create_module on Arm64. Signed-off-by: Bin Lu <bin.lu@arm.com>
Diffstat (limited to 'test/util/save_util_linux.cc')
-rw-r--r--test/util/save_util_linux.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/util/save_util_linux.cc b/test/util/save_util_linux.cc
index 7a0f14342..cd56118c0 100644
--- a/test/util/save_util_linux.cc
+++ b/test/util/save_util_linux.cc
@@ -18,13 +18,25 @@
#include "test/util/save_util.h"
+#if defined(__x86_64__) || defined(__i386__)
+#define SYS_TRIGGER_SAVE SYS_create_module
+#elif defined(__aarch64__)
+#define SYS_TRIGGER_SAVE SYS_finit_module
+#else
+#error "Unknown architecture"
+#endif
+
namespace gvisor {
namespace testing {
void MaybeSave() {
if (internal::ShouldSave()) {
int orig_errno = errno;
- syscall(SYS_create_module, nullptr, 0);
+ // We use it to trigger saving the sentry state
+ // when this syscall is called.
+ // Notice: this needs to be a valid syscall
+ // that is not used in any of the syscall tests.
+ syscall(SYS_TRIGGER_SAVE, nullptr, 0);
errno = orig_errno;
}
}