mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Merge pull request #1459 from lubinszARM:pr_save_util
PiperOrigin-RevId: 290273702
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user