mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
define a set that contains noreturn syscalls
hardcode noreturn function list Make LinuxSyscallsScript mark no-return functions This patch makes the script ResolveX86orX64LinuxSyscallsScript.javarecognize syscalls that do not return, and mark these functions asno-return. The list of non-return functions is read fromElfFunctionsThatDoNotReturn.
This commit is contained in:
parent
b57744d4e0
commit
4d7e55d913
1 changed files with 8 additions and 0 deletions
|
@ -65,6 +65,9 @@ public class ResolveX86orX64LinuxSyscallsScript extends GhidraScript {
|
||||||
//native "syscall" instruction
|
//native "syscall" instruction
|
||||||
private static final String SYSCALL_X64_CALLOTHER = "syscall";
|
private static final String SYSCALL_X64_CALLOTHER = "syscall";
|
||||||
|
|
||||||
|
//a set of names of all syscalls that do not return
|
||||||
|
private static final Set<String> noreturnSyscalls = Set.of("exit", "exit_group");
|
||||||
|
|
||||||
//tests whether an instruction is making a system call
|
//tests whether an instruction is making a system call
|
||||||
private Predicate<Instruction> tester;
|
private Predicate<Instruction> tester;
|
||||||
|
|
||||||
|
@ -179,6 +182,11 @@ public class ResolveX86orX64LinuxSyscallsScript extends GhidraScript {
|
||||||
}
|
}
|
||||||
callee = createFunction(callTarget, funcName);
|
callee = createFunction(callTarget, funcName);
|
||||||
callee.setCallingConvention(callingConvention);
|
callee.setCallingConvention(callingConvention);
|
||||||
|
|
||||||
|
//check if the function name is one of the non-returning syscalls
|
||||||
|
if (noreturnSyscalls.contains(funcName)) {
|
||||||
|
callee.setNoReturn(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference ref = currentProgram.getReferenceManager().addMemoryReference(callSite,
|
Reference ref = currentProgram.getReferenceManager().addMemoryReference(callSite,
|
||||||
callTarget, overrideType, SourceType.USER_DEFINED, Reference.MNEMONIC);
|
callTarget, overrideType, SourceType.USER_DEFINED, Reference.MNEMONIC);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue