summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-01-17 09:08:47 -0800
committergVisor bot <gvisor-bot@google.com>2020-01-17 09:08:47 -0800
commitc98e1bc23f790dbd9a2ce68c5e35a352f854cafd (patch)
treee5d7c6f873d0697d809d5c8a9322c290622a8fc8
parent989b611f5a13b0334cec5809a84e4b034785d283 (diff)
parent03e53745cc04f674d4795fcafcca755c836e526f (diff)
Merge pull request #1459 from lubinszARM:pr_save_util
PiperOrigin-RevId: 290273702
-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;
}
}