Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
背景: 在模拟一个elf的文件执行时,该elf需要用到libdl.so的dlvsym函数,但我看了下unidbg带的so中仅支持dlsym函数,于是我手动实现该函数,并通过registerSvc注册进SvcMemory,再通过registerSymbol函数注册到libdl的Module里。
问题:当我注册进去后发现, elf中依旧找不到dlvsym函数,而我尝试通过module.findSymbolByName()和memory.dlsym()去寻找,依旧找不到dlvsym函数。
发现:我看了一下代码,对于系统库的LinuxMoudle而言,发现findSymbolByName仅从缓存和elf文件结构中寻找符号,而registerSymbol函数仅将符号添加到hook表,也就是说registerSymbol实际上只支持对elf文件中的符号进行hook(替换),而无法添加符号函数。
解决:我认为如果仅是对现有符号进行hook,这非真正意义上的注册符号,所以我认为registerSymbol除了hook,应该还支持进行增加符号。