mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Merge pull request #2289 from xiaobo55x:syscall_cleanup
PiperOrigin-RevId: 306303148
This commit is contained in:
@@ -29,6 +29,8 @@ namespace {
|
||||
#define SYS_getrandom 318
|
||||
#elif defined(__i386__)
|
||||
#define SYS_getrandom 355
|
||||
#elif defined(__aarch64__)
|
||||
#define SYS_getrandom 278
|
||||
#else
|
||||
#error "Unknown architecture"
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,7 @@ TEST(LseekTest, NegativeOffset) {
|
||||
// A 32-bit off_t is not large enough to represent an offset larger than
|
||||
// maximum file size on standard file systems, so it isn't possible to cause
|
||||
// overflow.
|
||||
#ifdef __x86_64__
|
||||
#if defined(__x86_64__) || defined(__aarch64__)
|
||||
TEST(LseekTest, Overflow) {
|
||||
// HA! Classic Linux. We really should have an EOVERFLOW
|
||||
// here, since we're seeking to something that cannot be
|
||||
|
||||
@@ -199,8 +199,10 @@ TEST(MunlockallTest, Basic) {
|
||||
}
|
||||
|
||||
#ifndef SYS_mlock2
|
||||
#ifdef __x86_64__
|
||||
#if defined(__x86_64__)
|
||||
#define SYS_mlock2 325
|
||||
#elif defined(__aarch64__)
|
||||
#define SYS_mlock2 284
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ TEST_F(MMapTest, MapFixed) {
|
||||
}
|
||||
|
||||
// 64-bit addresses work too
|
||||
#ifdef __x86_64__
|
||||
#if defined(__x86_64__) || defined(__aarch64__)
|
||||
TEST_F(MMapTest, MapFixed64) {
|
||||
EXPECT_THAT(Map(0x300000000000, kPageSize, PROT_NONE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0),
|
||||
@@ -571,6 +571,12 @@ const uint8_t machine_code[] = {
|
||||
0xb8, 0x2a, 0x00, 0x00, 0x00, // movl $42, %eax
|
||||
0xc3, // retq
|
||||
};
|
||||
#elif defined(__aarch64__)
|
||||
const uint8_t machine_code[] = {
|
||||
0x40, 0x05, 0x80, 0x52, // mov w0, #42
|
||||
0xc0, 0x03, 0x5f, 0xd6, // ret
|
||||
};
|
||||
#endif
|
||||
|
||||
// PROT_EXEC allows code execution
|
||||
TEST_F(MMapTest, ProtExec) {
|
||||
@@ -605,7 +611,6 @@ TEST_F(MMapTest, NoProtExecDeath) {
|
||||
|
||||
EXPECT_EXIT(func(), ::testing::KilledBySignal(SIGSEGV), "");
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(MMapTest, NoExceedLimitData) {
|
||||
void* prevbrk;
|
||||
@@ -1644,6 +1649,7 @@ TEST(MMapNoFixtureTest, MapReadOnlyAfterCreateWriteOnly) {
|
||||
}
|
||||
|
||||
// Conditional on MAP_32BIT.
|
||||
// This flag is supported only on x86-64, for 64-bit programs.
|
||||
#ifdef __x86_64__
|
||||
|
||||
TEST(MMapNoFixtureTest, Map32Bit) {
|
||||
|
||||
Reference in New Issue
Block a user