@@ -31,7 +31,7 @@ def __init__(self, binary, options, offset):
31
31
self .__filterRE = re .compile ("({})$" .format (re_str )) if re_str else None
32
32
33
33
def __passCleanX86 (self , decodes ):
34
- br = ["ret" , "repz ret" , "retf" , "int" , "sysenter" , "jmp" , "notrack jmp" , "call" , "notrack call" , "syscall" ]
34
+ br = ["ret" , "repz ret" , "retf" , "int" , "sysenter" , "jmp" , "notrack jmp" , "call" , "notrack call" , "syscall" , "iret" , "iretd" , "iretq" , "sysret" , "sysretq" ]
35
35
36
36
if decodes [- 1 ][2 ] not in br :
37
37
return True
@@ -314,7 +314,7 @@ def addJOPGadgets(self, section):
314
314
elif arch == CS_ARCH_RISCV :
315
315
if arch_endian == CS_MODE_BIG_ENDIAN :
316
316
gadgets = [
317
- #32 bits encoded register
317
+ #32 bits encoded register
318
318
[b"[\x00 -\xff ]{2}[\x00 -\xff ][\x67 \x6f \xe7 \xef ]" ,4 , 1 ],
319
319
[b"[\x00 -\xff ]{2}[\x00 -\xff ][\x63 \xe3 ]" , 4 , 1 ],
320
320
@@ -365,6 +365,9 @@ def addSYSGadgets(self, section):
365
365
[b"\x0f \x34 \xc3 " , 3 , 1 ], # sysenter ; ret
366
366
[b"\x0f \x05 \xc3 " , 3 , 1 ], # syscall ; ret
367
367
[b"\x65 \xff \x15 \x10 \x00 \x00 \x00 \xc3 " , 8 , 1 ], # call DWORD PTR gs:0x10 ; ret
368
+ [b"\x0f \x07 " , 2 , 1 ], # sysret
369
+ [b"\x48 \x0f \x07 " , 3 , 1 ], # sysret
370
+ [b"\xcf " , 1 , 1 ], # iret
368
371
]
369
372
370
373
elif arch == CS_ARCH_MIPS :
@@ -413,7 +416,7 @@ def addSYSGadgets(self, section):
413
416
gadgets = [
414
417
[b"\x73 \x00 \x00 \x00 " , 4 , 2 ] # syscall
415
418
]
416
-
419
+
417
420
arch_mode = CS_MODE_RISCV64 | CS_MODE_RISCVC
418
421
else :
419
422
print ("Gadgets().addSYSGadgets() - Architecture not supported" )
0 commit comments