Open
Conversation
mrh929
commented
Dec 17, 2023
| vector<GlobalVariable *> GVs; | ||
| for (GlobalVariable &GV : M.getGlobalList()) { | ||
| // only process non llvm-generated IRs | ||
| if(GV.getName().contains("llvm")) |
Contributor
Author
There was a problem hiding this comment.
我们把 Module 内的所有 Globals 筛选出来的时候,没有对全局变量做特判,这会导致有一部分由 llvm 生成的全局变量(这里代称为 llvm-global)也放到列表中来。
其实本来这也没什么问题的,因为后续我们有语句去把这些无关的变量过滤掉。
但是,我们的 appendToGlobalCtors 函数会删除 llvm-global,再添加新的 llvm-global,这会导致之前 vector 中的 llvm-global 变成无意义指针,后续的 pass 在处理变量的时候会 crash 掉,所以我们一开始就不应该把这些变量筛选进来。
所以把有 llvm 字样的所有全局变量忽略掉就好了。
mrh929
commented
Dec 17, 2023
| } | ||
| if(GV->getValueType()->isArrayTy()){ // the value can be array | ||
| ArrayType *ArrTy = dyn_cast<ArrayType>(GV->getValueType()); | ||
| if(!ArrTy->getElementType()->isIntegerTy()){ // but the array must be integerty |
Contributor
Author
There was a problem hiding this comment.
我们对数组变量做筛选的时候,没有判断数组内元素是否为浮点,正好 IR 没办法拿 double、float 来做异或,所以遇到这种数,就需要跳过,不做处理。
如果后续有对浮点的加密方式,需要重新写相关逻辑。
Fix Pluto flat mode bugs
ignore intdata in GlobalsEncryption(bug)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix bugs: