Skip to content

Commit c06b189

Browse files
authored
Merge pull request #92 from bytedance/dev/suxiangyu
fix: insufficient NOP instruction padding in arm64
2 parents 7b017bb + 1a3a98b commit c06b189

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

internal/monkey/mem/write_darwin_arm64.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616

1717
#include "textflag.h"
1818

19-
#define NOP64 WORD $0x1f2003d5; WORD $0x1f2003d5;
19+
#define NOP8 WORD $0x1f2003d5; WORD $0x1f2003d5;
20+
#define NOP64 NOP8; NOP8; NOP8; NOP8; NOP8; NOP8; NOP8; NOP8;
2021
#define NOP512 NOP64; NOP64; NOP64; NOP64; NOP64; NOP64; NOP64; NOP64;
2122
#define NOP4096 NOP512; NOP512; NOP512; NOP512; NOP512; NOP512; NOP512; NOP512;
22-
#define NOP16384 NOP4096; NOP4096; NOP4096; NOP4096; NOP4096; NOP4096; NOP4096; NOP4096;
23+
#define NOP16384 NOP4096; NOP4096; NOP4096; NOP4096;
2324

2425
#define protRW $(0x1|0x2|0x10)
2526
#define mProtect $(0x2000000+74)

internal/monkey/mem/write_linux_arm64.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616

1717
#include "textflag.h"
1818

19-
#define NOP64 WORD $0x1f2003d5; WORD $0x1f2003d5;
19+
#define NOP8 WORD $0x1f2003d5; WORD $0x1f2003d5;
20+
#define NOP64 NOP8; NOP8; NOP8; NOP8; NOP8; NOP8; NOP8; NOP8;
2021
#define NOP512 NOP64; NOP64; NOP64; NOP64; NOP64; NOP64; NOP64; NOP64;
2122
#define NOP4096 NOP512; NOP512; NOP512; NOP512; NOP512; NOP512; NOP512; NOP512;
22-
#define NOP16384 NOP4096; NOP4096; NOP4096; NOP4096; NOP4096; NOP4096; NOP4096; NOP4096;
23+
#define NOP16384 NOP4096; NOP4096; NOP4096; NOP4096;
2324

2425
#define protRW $(0x1|0x2)
2526
#define mProtect $0xe2

mock_condition.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (m *mockCondition) SetToForce(to interface{}) {
106106

107107
// checkGenericAndReceiver check if typ has GenericsInfo and selfReceiver as argument
108108
//
109-
// The hook function will looks like func(_ GenericInfo, self *struct, arg0 int ...)
109+
// The hook function will look like func(_ GenericInfo, self *struct, arg0 int ...)
110110
// When we use 'When' or 'To', our input hook function will looks like:
111111
// 1. func(arg0 int ...)
112112
// 2. func(info GenericInfo, arg0 int ...)

0 commit comments

Comments
 (0)