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: fix build, by switch to gcc as compiler #34802

Merged
merged 2 commits into from Feb 19, 2018
Merged

afl: fix build, by switch to gcc as compiler #34802

merged 2 commits into from Feb 19, 2018

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented Feb 10, 2018

Apparently they set CFLAGS incompatible with clang.
Also only provide a default value for AFL_CC/AFL_CXX for afl-clang-fast:
User might want to overriding, but this is not a PATH variable that can
be prepended with :.

@thoughtpolice I have tested afl only lightly, maybe I miss something important.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-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/)
  • Fits CONTRIBUTING.md.

Apparently they set CFLAGS incompatible with clang.
Also only provide a default value for AFL_CC/AFL_CXX for afl-clang-fast:
User might want to overriding, but this is not a PATH variable that can
be prepended with :.
@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Partial log (click to expand)

Package ‘afl-2.52b’ in /private/var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/lnl7-mac/pkgs/tools/security/afl/default.nix:65 is not supported on ‘x86_64-darwin’, refusing to evaluate.

a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowBroken = true; }
to ~/.config/nixpkgs/config.nix.

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Partial log (click to expand)

error: while evaluating the attribute 'installPhase' of the derivation 'afl-2.52b' at /var/lib/gc-of-borg/nix-test-rs-2/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-2/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating the attribute 'configureFlags' of the derivation 'afl-qemu-2.3.0' at /var/lib/gc-of-borg/nix-test-rs-2/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-2/pkgs/stdenv/generic/make-derivation.nix:148:11:
afl: no support for aarch64-linux!

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

shrinking /nix/store/fd7j2k2h3vmnfalgw9wmfz4zxgs7wz4n-afl-2.52b/share/afl/testcases/others/elf/small_exec.elf
cannot find section .dynamic
strip is /nix/store/5qj61lcvzlap87rf6blvf8p577d482bv-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/fd7j2k2h3vmnfalgw9wmfz4zxgs7wz4n-afl-2.52b/lib  /nix/store/fd7j2k2h3vmnfalgw9wmfz4zxgs7wz4n-afl-2.52b/bin
patching script interpreter paths in /nix/store/fd7j2k2h3vmnfalgw9wmfz4zxgs7wz4n-afl-2.52b
checking for references to /build in /nix/store/fd7j2k2h3vmnfalgw9wmfz4zxgs7wz4n-afl-2.52b...
wrong ELF type
wrong ELF type
cannot find section .dynamic
/nix/store/fd7j2k2h3vmnfalgw9wmfz4zxgs7wz4n-afl-2.52b

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

/nix/store/fd7j2k2h3vmnfalgw9wmfz4zxgs7wz4n-afl-2.52b

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Partial log (click to expand)

Package ‘afl-2.52b’ in /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/pkgs/tools/security/afl/default.nix:65 is not supported on ‘aarch64-linux’, refusing to evaluate.

a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowBroken = true; }
to ~/.config/nixpkgs/config.nix.

@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Partial log (click to expand)

Package ‘afl-2.52b’ in /Users/graham/nix-borg/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-ndnd/pkgs/tools/security/afl/default.nix:65 is not supported on ‘x86_64-darwin’, refusing to evaluate.

a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowBroken = true; }
to ~/.config/nixpkgs/config.nix.

@dezgeg
Copy link
Contributor

dezgeg commented Feb 18, 2018

I tested this (with afl-gcc, not afl-clang nor afl-clang-fast) and seemed to work.

@dezgeg dezgeg merged commit e38cb9b into NixOS:master Feb 19, 2018
@dezgeg
Copy link
Contributor

dezgeg commented Feb 19, 2018

Let's at least have a working AFL for now, and revisit later if clang needs to be brought back to buildInputs.

@Mic92 Mic92 deleted the afl branch February 20, 2018 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants