Comments (10)
Thanks @bpfoley, we have an llvm6 branch now.
https://github.com/AngoraFuzzer/Angora/tree/llvm6
#24
I created llvm7 branch here:
https://github.com/AngoraFuzzer/Angora/tree/llvm7
#24 (comment) mentioned the compiling issues that I still have not solved.
from angora.
Hi, @TheBlueMatt . Thanks for your contribution. I merged your pull request on rust-stable branch.
I haven't tried Angora in LLVM 7. I will put the support for LLVM 7 in my plan.
For the thread local issues, I defined __angora_prev_loc, __angora_context in angora-llvm-pass.so.cc as:
AngoraPrevLoc =
new GlobalVariable(M, Int32Ty, false, GlobalValue::CommonLinkage,
ConstantInt::get(Int32Ty, 0), "__angora_prev_loc", 0,
GlobalVariable::GeneralDynamicTLSModel, 0, false);
AngoraContext =
new GlobalVariable(M, Int32Ty, false, GlobalValue::CommonLinkage,
ConstantInt::get(Int32Ty, 0), "__angora_context", 0,
GlobalVariable::GeneralDynamicTLSModel, 0, false);
And the LLVM API is
GlobalVariable (Module &M, Type *Ty, bool isConstant, LinkageTypes Linkage,
Constant *Initializer, const Twine &Name="", GlobalVariable *InsertBefore=nullptr,
ThreadLocalMode=NotThreadLocal, unsigned AddressSpace=0,
bool isExternallyInitialized=false)
"The the second-to-last arg is 0" is for "AddreessSpace".
And I implemented the "native-built C wrapper" approach for thread local
in the rust-statble
branch.
from angora.
from angora.
It's an interesting topic. As Shnatsel mentioned, the LLVM pass needs to support Rust's LLVM version. However, since Rust has many built-in libraries, modeling the built-in or external libraries used in rust for taint analysis will be the challenge.
from angora.
At least to get things bootstrapped, ie without instrumenting rust's built-in libraries, it looks like building against system rustc/LLVM is pretty easy.
rustc appears to dynamically load LLVM/its LLVM codegen lib at runtime you can't just LD_PRELOAD angora-llvm-pass cause it wont be able to find LLVM hooks at load. This is just that llvm_mode/Makefile to include $(LLVM_CONFIG) --libs in the flags for angora-llvm-pass so that libLLVM gets loaded at start. I think this should be done upstream, so will open a PR in a sec.
Once you do that, you can just something that looks like LD_PRELOAD="/path/to/angora-llvm-pass.so /path/to/unfold-branch-pass.so" RUSTFLAGS="-C passes=unfold_branch_pass,angora_llvm_pass" cargo build.
For me this results in ICEs that look like this, I presume because I'm using LLVM 7, which is unsupported:
Incorrect number of arguments passed to called function!
%71 = call i32 @__angora_trace_cmp(i32 %69, i32 1374339812, i64 %70, i64 1), !dbg !232, !nosanitize !56
from angora.
Note that this is, of course, a little bit awkward, because building Angora requires a nightly rust (ie installed via rustup) and then you have to switch to system-installed rust (ie uninstall rustup/remove it from your PATH) to actually build things with the angora pass. It looks like Angora's nightly-requirement is just for nll (so we can switch to edition-2018 and stable there) and C-linked thread-locals (which I'm worried isn't well-defined anyway, would it be too much of a perf hit to take a function-call into a native-built C wrapper to read these?).
from angora.
I'm also very confused (and know nothing about LLVM) because the #[thread_local] variables in shm_conds don't appear to be defined as thread-locals in angora-llvm-pass.so.cc (the second-to-last arg is 0, which in LLVM's GlobalValue.h appears to be:
enum ThreadLocalMode {
NotThreadLocal = 0,
)
from angora.
@spinpx, what is the state of this? Is there any way I can help move this forward?
from angora.
@dragostis the next steps are probably to retrace the steps I took, above, using the llvm6/7 branch and see how far you can get. Note that you'll have to use system-LLVM (and a rustc built against that, eg use debian packages, not rustup, as afaict rustup doesn't ship the necessary bits of LLVM to build against).
from angora.
We have implemented the new feature for supporting libdft64 here. https://github.com/AngoraFuzzer/Angora/blob/master/docs/pin_mode.md
Since it uses Intel Pin to do track analysis, we needn't compiling whole program now.
from angora.
Related Issues (20)
- Parse track files to json HOT 1
- Increase MAP_SIZE or adjust function call context? HOT 1
- some issues about the context in the source code HOT 4
- Cannot run multiple instances of Angora. HOT 1
- lots of zombie processes? HOT 1
- Angora compile IR HOT 1
- Unable to open file: Os { code: 2, kind: NotFound, message: "No such file or directory" } HOT 3
- valuer error when using validate_lava.py HOT 2
- Testing with stdin Fails HOT 9
- Error in running ./build/build.sh HOT 1
- Building libpng failed, although the input directory is not empty
- Unable to compile lavam programs correctly HOT 1
- Building C++ binaries
- Angora failed to compile PostgreSQL
- Measure effectiveness on FuzzBench HOT 1
- Possible bug in MutInput HOT 3
- '0 files from seeds' even if there exists some files in the input directory
- Setting total run time for fuzzer HOT 3
- Minor inconsistency in gradient descent HOT 1
- Allow track files to persist after execution HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angora.