Skip to content
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

afl-qemu: update to qemu 2.10.0, as specified by afl 2.52b #51398

Merged
merged 3 commits into from Jan 6, 2019

Conversation

Projects
None yet
3 participants
@risicle
Copy link
Contributor

risicle commented Dec 2, 2018

refresh patches & configure options directly from afl 2.52b to make
installation as vanilla as possible

Motivation for this change

afl's qemu mode as packaged in master and release-18.09 doesn't work (correct me if it's somehow working for you!), because instead of using the specified 2.10.0, it's been left at 2.3.0. This doesn't work because afl 2.52b passes an env var QEMU_LOG=nochain, which qemu 2.3.0 doesn't understand, failing with an error message.

The patches themselves had also been only minimally updated from what I can see, just enough to get them to compile. Here I've pulled the patches (and afl-types.h, afl-config.h) fresh from the afl 2.52b sources, but also pulled in a cherrypicked fix from qemu git to build against glibc 2.27.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

pkgs/tools/security/afl/qemu.nix Outdated
# patches extracted from afl source
./qemu-patches/elfload.patch
./qemu-patches/cpu-exec.patch
./qemu-patches/syscall.patch

This comment has been minimized.

@Mic92

Mic92 Dec 2, 2018

Contributor

Can these patches be downloaded instead of living in the nixpkgs source tree?

This comment has been minimized.

@risicle

risicle Dec 2, 2018

Author Contributor

Unlikely - I've hand-modified at least one of them. See the README as to how/why this is necessary.

This comment has been minimized.

@Mic92

Mic92 Dec 2, 2018

Contributor

Can you use fetchpatch for the unmodified ones?

This comment has been minimized.

@risicle

risicle Dec 3, 2018

Author Contributor

It's a bit odder than that actually - the patches actually come from the afl source tree itself, so really ideally there would be a neat way to fish them out of there...? Question is how to do it without introducing some kind of weird recursive dependency.

This comment has been minimized.

@Mic92

Mic92 Dec 3, 2018

Contributor

Either you write a postPatch hook that calls patch or add something like something like: ${src}/qemu-patches/patch-name.patch to the patches list. Both should not have any problems with recursion.

This comment has been minimized.

@risicle

risicle Dec 3, 2018

Author Contributor

It's not the qemu source the patches live in, but the afl source. This qemu is a dependency of afl, and to ensure the correct pairing of versions, I'll have to take that afl package (or at least its src file) as an argument to this function to be able to access it, hence my worry about recursion. It should be possible but will require some jiggery pokery.

This comment has been minimized.

@Mic92

Mic92 Dec 3, 2018

Contributor

Since you are not depending on the build output but the source, this should not be a problem either. Using "${avl.src}/qemu-patches/patch-name.patch" should work too.

This comment has been minimized.

@risicle

risicle Dec 5, 2018

Author Contributor

Ahok I'll try that

afl-qemu: update to qemu 2.10.0, as specified by afl 2.52b
refresh patches & configure options directly from afl 2.52b to make
installation as vanilla as possible

@risicle risicle force-pushed the risicle:ris-afl-qemu-fix branch to 5a09820 Dec 22, 2018

@risicle

This comment has been minimized.

Copy link
Contributor Author

risicle commented Dec 22, 2018

Ok this appears to do the right thing - not convinced it actually ends up with a clearer result and it requires the odd fixed-point-y thing in afl's default.nix, but whatever.

At some point I should probably also look at enabling it for more platforms - I think its x86 restriction is just there out of conservativeness.

@risicle

This comment has been minimized.

Copy link
Contributor Author

risicle commented Jan 5, 2019

Any word on this?

Mic92 added some commits Jan 5, 2019

@Mic92

This comment has been minimized.

Copy link
Contributor

Mic92 commented Jan 5, 2019

I made some cleanups but only check if they build. Mind having a look at it?

@GrahamcOfBorg GrahamcOfBorg requested a review from thoughtpolice Jan 5, 2019

@risicle

This comment has been minimized.

Copy link
Contributor Author

risicle commented Jan 5, 2019

Will do so...

@risicle

This comment has been minimized.

Copy link
Contributor Author

risicle commented Jan 5, 2019

Works for me 👍

@Mic92 Mic92 merged commit 9d8ccfe into NixOS:master Jan 6, 2019

10 checks passed

grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A manual
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A options
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A manual
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A tarball
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A unstable
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.