-
Notifications
You must be signed in to change notification settings - Fork 1.4k
tools: Makefile: add check-syzos.sh #6356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Example script output: |
|
And |
|
I wonder if it'd be better to represent in as one more https://github.com/google/syzkaller/blob/master/executor/style_test.go test. |
|
style_test.go is checking the source code, whereas here we need to check the compiled binaries, do you think this case is a good fit? |
47669cd to
a59c85f
Compare
Ah, right, you need a binary. Technically, it's quite straightforward to build executor from Go and we do it from multiple tests, e.g. syzkaller/pkg/fuzzer/fuzzer_test.go Line 43 in fdeaa69
We also do have tests that build it for every arch (for which there's a compiler): syzkaller/pkg/runtest/executor_test.go Line 67 in fdeaa69
How long does the test currently take? Is it necessarily better to do the check on each syzkaller build rather than make it a presubmit test? |
4fd994c to
a932141
Compare
Note that the script does not build the executor, it looks at
For now SYZOS is only implemented for arm64 and amd64.
It takes 0.05 seconds, slightly slower than |
If it'd be a presubmit test, I think it would be easier to orchestrate the process from Go. If we do it each build, probably doesn't matter much.
Cool!
If there's no much value in the extra output, I'd suggest we drop it right away. Otherwise LGTM. |
As shown in google#5565, SYZOS code in the `guest` section cannot reference global data, because it is relocated into the guest memory. While arm64 executor has a dynamic check for data accesses, it is virtually impossible to do the same on x86 without implementing an x86 disassembler. Instead of doing so, introduce a build-time script that will detect instructions referencing global data on a best-effort basis.
Replace the switch statement in guest_handle_wr_crn() with a series of if statements.
When compiling the executor in syz-env-old, -fstack-protector may kick in and introduce global accesses that tools/check-syzos.sh reports. To prevent this, introduce the __no_stack_protector macro attribute that disable stack protection for the function in question, and use it for guest code. While at it, factor out some common definitions into common_kvm_syzos.h
a932141 to
e38b06c
Compare
|
I changed the happy path to use |
As shown in #5565, SYZOS code in the
guestsection cannot reference global data, because it is relocated into the guest memory.While arm64 executor has a dynamic check for data accesses, it is virtually impossible to do the same on x86 without implementing an x86 disassembler. Instead of doing so, introduce a build-time script that will detect instructions referencing global data on a best-effort basis.
Before sending a pull request, please review Contribution Guidelines:
https://github.com/google/syzkaller/blob/master/docs/contributing.md