diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 5f0b6961d5e9..f57aa9fe72fa 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -7757,6 +7757,12 @@ githubId = 411447; name = "Leo Gaspard"; }; + ekzyis = { + email = "ramdip.singhgill@gmail.com"; + github = "ekzyis"; + githubId = 27162016; + name = "Ramdip Gill"; + }; elasticdog = { email = "aaron@elasticdog.com"; github = "elasticdog"; diff --git a/pkgs/tools/security/aflplusplus/default.nix b/pkgs/tools/security/aflplusplus/default.nix index b3e2e5e3fbb1..9e92be083985 100644 --- a/pkgs/tools/security/aflplusplus/default.nix +++ b/pkgs/tools/security/aflplusplus/default.nix @@ -17,6 +17,7 @@ wine ? null, cmocka, llvmPackages, + withNyx ? false, }: # wine fuzzing is only known to work for win32 binaries, and using a mixture of @@ -24,6 +25,10 @@ # a full 32bit version of this package if you want to do wine fuzzing assert (wine != null) -> (stdenv.targetPlatform.system == "i686-linux"); +# nyx mode is only available on x86_64-linux, +# see nyx_mode/build_nyx_support.sh in source code of aflplusplus +assert withNyx -> (stdenv.targetPlatform.system == "x86_64-linux"); + let aflplusplus-qemu = callPackage ./qemu.nix { }; qemu-exe-name = @@ -35,6 +40,17 @@ let throw "aflplusplus: no support for ${stdenv.targetPlatform.system}!"; libdislocator = callPackage ./libdislocator.nix { inherit aflplusplus; }; libtokencap = callPackage ./libtokencap.nix { inherit aflplusplus; }; + + libnyx = + if withNyx then callPackage ./nyx_mode/libnyx/libnyx.nix { inherit aflplusplus; } else null; + qemu-nyx = + if withNyx then callPackage ./nyx_mode/QEMU-Nyx/qemu-nyx.nix { inherit aflplusplus; } else null; + nyx-packer = + if withNyx then + callPackage ./nyx_mode/packer/packer.nix { inherit aflplusplus qemu-nyx; } + else + null; + aflplusplus = stdenvNoCC.mkDerivation rec { pname = "aflplusplus"; version = "4.35c"; @@ -43,7 +59,12 @@ let owner = "AFLplusplus"; repo = "AFLplusplus"; tag = "v${version}"; - hash = "sha256-j5YH39JKcjYuDqyl+KRMtgn3UoeWEW1z7m4ysf2uilc="; + hash = + if withNyx then + "sha256-srHrYPEb0UAP/G9cOxJOZ9D6v9pxqez28suPsa70E2M=" + else + "sha256-j5YH39JKcjYuDqyl+KRMtgn3UoeWEW1z7m4ysf2uilc="; + fetchSubmodules = withNyx; }; enableParallelBuilding = true; @@ -68,6 +89,10 @@ let # warning: "_FORTIFY_SOURCE" redefined hardeningDisable = [ "fortify" ]; + # We build nyx mode dependencies ourselves, so this patch skips + # build_nyx_support.sh in the aflplusplus source code. It also skips + # test-nyx-mode.sh because we can't test nyx mode in the sandbox. + patches = lib.optional withNyx ./nyx_mode/nyx_mode.patch; postPatch = '' # Don't care about this. rm Android.bp @@ -94,6 +119,9 @@ let substituteInPlace GNUmakefile.llvm \ --replace-fail "\$(LLVM_BINDIR)/clang" "${clang}/bin/clang" + '' + + lib.optionalString withNyx '' + patchShebangs nyx_mode/build_nyx_support.sh ''; env.NIX_CFLAGS_COMPILE = toString [ @@ -145,7 +173,15 @@ let --replace-fail "cgdelete" "${libcgroup}/bin/cgdelete" patchShebangs $out/bin - + '' + + lib.optionalString withNyx '' + # Use same FHS as if built from source using build_nyx_support.sh. This + # means libnyx.so must be next to afl binaries and nyx_mode dependencies + # are in nyx_mode/. + cp ${libnyx}/lib/libnyx.so $out/bin + mkdir $out/nyx_mode + ln -s ${nyx-packer} $out/nyx_mode/packer + ln -s ${qemu-nyx} $out/nyx_mode/QEMU-Nyx '' + lib.optionalString (wine != null) '' substitute afl-wine-trace $out/bin/afl-wine-trace \ @@ -166,6 +202,7 @@ let file cmocka ]; + doInstallCheck = true; installCheckPhase = '' runHook preInstallCheck @@ -191,7 +228,13 @@ let ''; passthru = { - inherit libdislocator libtokencap; + inherit + libdislocator + libtokencap + libnyx + nyx-packer + qemu-nyx + ; qemu = aflplusplus-qemu; }; diff --git a/pkgs/tools/security/aflplusplus/nyx_mode/QEMU-Nyx/qemu-nyx.nix b/pkgs/tools/security/aflplusplus/nyx_mode/QEMU-Nyx/qemu-nyx.nix new file mode 100644 index 000000000000..ee4e9bcb1ba6 --- /dev/null +++ b/pkgs/tools/security/aflplusplus/nyx_mode/QEMU-Nyx/qemu-nyx.nix @@ -0,0 +1,77 @@ +{ + stdenv, + lib, + fetchFromGitHub, + python3, + pkg-config, + flex, + bison, + glib, + pixman, + aflplusplus, +}: + +# this derivation assumes x86_64-linux +assert stdenv.targetPlatform.system == "x86_64-linux"; + +stdenv.mkDerivation { + version = builtins.readFile (aflplusplus.src + "/nyx_mode/QEMU_NYX_VERSION"); + pname = "QEMU-Nyx"; + + src = aflplusplus.src; + postUnpack = '' + sourceRoot="$sourceRoot/nyx_mode/QEMU-Nyx" + ''; + + # same flags for ./configure as ./compile_qemu_nyx.sh static would set + configureFlags = [ + "--target-list=x86_64-softmmu" + "--disable-docs" + "--disable-gtk" + "--disable-werror" + "--disable-capstone" + "--disable-libssh" + "--disable-tools" + "--enable-nyx" + "--enable-nyx-static" + ]; + + nativeBuildInputs = [ + python3 + pkg-config + flex + bison + ]; + + buildInputs = [ + glib + pixman + ]; + + enableParallelBuilding = true; + + preConfigure = '' + CAPSTONE_ROOT=$PWD/capstone_v4 + LIBXDC_ROOT=$PWD/libxdc + + make -C $CAPSTONE_ROOT -j$(nproc) + make -C $LIBXDC_ROOT -j$(nproc) clean + + # For some reason the Makefile of libxdc clears LDFLAGS; we remove that line + # so ld can find libcapstone.so.4 + sed -i '3d' $LIBXDC_ROOT/Makefile + + NO_LTO=1 LDFLAGS="-L$CAPSTONE_ROOT -L$LIBXDC_ROOT" CFLAGS="-I$CAPSTONE_ROOT/include/" make -C $LIBXDC_ROOT -j$(nproc) + + export LIBS="-L$CAPSTONE_ROOT -L$LIBXDC_ROOT/" + export QEMU_CFLAGS="-I$CAPSTONE_ROOT/include/ -I$LIBXDC_ROOT/ $QEMU_CFLAGS" + ''; + + meta = { + homepage = "https://github.com/nyx-fuzz/QEMU-Nyx"; + description = "Nyx's fork of QEMU"; + license = lib.licenses.gpl2Only; + platforms = lib.platforms.x86_64; + maintainers = with lib.maintainers; [ ekzyis ]; + }; +} diff --git a/pkgs/tools/security/aflplusplus/nyx_mode/libnyx/Cargo.lock b/pkgs/tools/security/aflplusplus/nyx_mode/libnyx/Cargo.lock new file mode 100644 index 000000000000..bb830117fea8 --- /dev/null +++ b/pkgs/tools/security/aflplusplus/nyx_mode/libnyx/Cargo.lock @@ -0,0 +1,1242 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cbindgen" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadd868a2ce9ca38de7eeafdcec9c7065ef89b42b32f0839278d55f35c54d1ff" +dependencies = [ + "clap", + "heck 0.4.1", + "indexmap", + "log", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn 2.0.117", + "tempfile", + "toml", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "clap" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b193af5b67834b676abd72466a96c1024e6a6ad978a1f484bd90b85c94041351" +dependencies = [ + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "colored" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" +dependencies = [ + "lazy_static", + "windows-sys 0.59.0", +] + +[[package]] +name = "config" +version = "0.1.0" +dependencies = [ + "libc", + "ron", + "serde", + "serde_derive", +] + +[[package]] +name = "const_fn" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413d67b29ef1021b4d60f4aa1e925ca031751e213832b4b1d588fae623c05c60" + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + +[[package]] +name = "doc-comment" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "780955b8b195a21ab8e4ac6b60dd1dbdcec1dc6c51c0617964b08c81785e12c9" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "fs4" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cef5c93884e5cef757f63446122c2f420713c3e03f85540d09485b9415983b4a" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "fuzz_runner" +version = "0.1.0" +dependencies = [ + "byteorder", + "colored", + "config", + "derivative", + "fs4", + "glob", + "libc", + "nix", + "quick-error", + "rand", + "serde", + "serde_derive", + "snafu", + "subprocess", + "time", + "timeout-readwrite", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", + "wasip3", +] + +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", + "serde", + "serde_core", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.183" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" + +[[package]] +name = "libnyx" +version = "0.1.0" +dependencies = [ + "cbindgen", + "config", + "fuzz_runner", + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset", + "pin-utils", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.117", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "ron" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86018df177b1beef6c7c8ef949969c4f7cb9a9344181b92486b23c79995bdaa4" +dependencies = [ + "base64", + "bitflags 1.3.2", + "serde", +] + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags 2.11.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "sha1" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" +dependencies = [ + "sha1_smol", +] + +[[package]] +name = "sha1_smol" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" + +[[package]] +name = "snafu" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7" +dependencies = [ + "doc-comment", + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "standback" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +dependencies = [ + "version_check", +] + +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn 1.0.109", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn 1.0.109", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subprocess" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c56e8662b206b9892d7a5a3f2ecdbcb455d3d6b259111373b7e08b8055158a8" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.2", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "time" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb", + "time-macros", + "version_check", + "winapi", +] + +[[package]] +name = "time-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn 1.0.109", +] + +[[package]] +name = "timeout-readwrite" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37312ddc0adbd0f112618a4250ac586448151ff6d69241ff061b29b883349f3e" +dependencies = [ + "nix", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.117", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.11.0", + "hashbrown 0.15.5", + "indexmap", + "semver 1.0.27", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck 0.5.0", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck 0.5.0", + "indexmap", + "prettyplease", + "syn 2.0.117", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.11.0", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver 1.0.27", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "zerocopy" +version = "0.8.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e8bc7269b54418e7aeeef514aa68f8690b8c0489a06b0136e5f57c4c5ccab89" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/pkgs/tools/security/aflplusplus/nyx_mode/libnyx/libnyx.nix b/pkgs/tools/security/aflplusplus/nyx_mode/libnyx/libnyx.nix new file mode 100644 index 000000000000..5a7649691575 --- /dev/null +++ b/pkgs/tools/security/aflplusplus/nyx_mode/libnyx/libnyx.nix @@ -0,0 +1,39 @@ +{ + lib, + stdenv, + rustPlatform, + aflplusplus, + python3, +}: + +rustPlatform.buildRustPackage { + version = builtins.readFile (aflplusplus.src + "/nyx_mode/LIBNYX_VERSION"); + pname = "libnyx"; + + src = aflplusplus.src; + postUnpack = '' + sourceRoot="$sourceRoot/nyx_mode/libnyx/libnyx" + cp ${./Cargo.lock} "$sourceRoot/Cargo.lock" + ''; + + cargoLock = { + lockFile = ./Cargo.lock; + }; + + doCheck = false; + + installPhase = '' + runHook preInstall + mkdir -p $out/lib + cp "target/${stdenv.hostPlatform.rust.rustcTarget}/release/liblibnyx.so" $out/lib/libnyx.so + runHook postInstall + ''; + + meta = { + homepage = "https://github.com/nyx-fuzz/libnyx"; + description = "Rust library to build hypervisor-based snapshot fuzzers"; + license = lib.licenses.gpl2Only; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ ekzyis ]; + }; +} diff --git a/pkgs/tools/security/aflplusplus/nyx_mode/nyx_mode.patch b/pkgs/tools/security/aflplusplus/nyx_mode/nyx_mode.patch new file mode 100644 index 000000000000..9e47fb8fa380 --- /dev/null +++ b/pkgs/tools/security/aflplusplus/nyx_mode/nyx_mode.patch @@ -0,0 +1,98 @@ +diff --git a/nyx_mode/build_nyx_support.sh b/nyx_mode/build_nyx_support.sh +index 9b75b7bf..b7ec92e8 100755 +--- a/nyx_mode/build_nyx_support.sh ++++ b/nyx_mode/build_nyx_support.sh +@@ -7,7 +7,8 @@ echo " Nyx build script" + echo "=================================================" + echo + +-echo "[*] Performing basic sanity checks..." ++echo "[+] Nyx mode dependencies are built in other derivations, skipping ..." ++exit 1 + + if [ "$CI" = "true" ]; then + +diff --git a/test/test-nyx-mode.sh b/test/test-nyx-mode.sh +index 7aaa8c5b..5f624ada 100755 +--- a/test/test-nyx-mode.sh ++++ b/test/test-nyx-mode.sh +@@ -4,78 +4,7 @@ + + $ECHO "$BLUE[*] Testing: nyx_mode" + +-test "$CI" = "true" && { +- $ECHO "$YELLOW[-] nyx_mode cannot be tested in the Github CI, skipping ..." +-} || { +- +- unset AFL_CC +- +- test -e ../libnyx.so && { +- ../afl-cc -o test-instr ../test-instr.c > errors 2>&1 +- test -e test-instr && { +- { +- rm -rf nyx-test in out +- $ECHO "$GREY[*] running nyx_packer" +- python3 ../nyx_mode/packer/packer/nyx_packer.py \ +- ./test-instr \ +- nyx-test \ +- afl \ +- instrumentation \ +- --fast_reload_mode \ +- --purge > /dev/null 2>&1 +- +- test -e nyx-test/test-instr && { +- +- $ECHO "$GREY[*] running nyx_config_gen" +- python3 ../nyx_mode/packer/packer/nyx_config_gen.py nyx-test Kernel > /dev/null 2>&1 +- +- test -e nyx-test/config.ron && { +- sudo modprobe -r kvm-intel +- sudo modprobe -r kvm +- sudo modprobe kvm enable_vmware_backdoor=y +- sudo modprobe kvm-intel +- #cat /sys/module/kvm/parameters/enable_vmware_backdoor +- +- mkdir -p in +- echo 00000 > in/in +- $ECHO "$GREY[*] running afl-fuzz for nyx_mode, this will take approx 10 seconds" +- { +- AFL_DEBUG=1 ../afl-fuzz -i in -o out -V05 -X -- ./nyx-test >>errors 2>&1 +- } >>errors 2>&1 +- test -n "$( ls out/default/queue/id:000002* 2>/dev/null )" && { +- $ECHO "$GREEN[+] afl-fuzz is working correctly with nyx_mode" +- RUNTIME=`grep execs_done out/default/fuzzer_stats | awk '{print$3}'` +- rm -rf errors nyx-test test-instr in out +- } || { +- echo CUT------------------------------------------------------------------CUT +- cat errors +- echo CUT------------------------------------------------------------------CUT +- $ECHO "$RED[!] afl-fuzz is not working correctly with nyx_mode" +- CODE=1 +- } +- } || { +- $ECHO "$RED[!] nyx_packer failed, likely install requirements not met." +- CODE=1 +- } +- } || { +- $ECHO "$RED[!] nyx_packer failed, likely install requirements not met." +- CODE=1 +- } +- #rm -rf test-instr in out errors nyx-test +- } +- } || { +- echo CUT------------------------------------------------------------------CUT +- cat errors +- echo CUT------------------------------------------------------------------CUT +- $ECHO "$RED[!] afl-cc compilation of test targets failed - what is going on??" +- CODE=1 +- } +- } || { +- $ECHO "$YELLOW[-] nyx_mode is not compiled, cannot test" +- INCOMPLETE=1 +- } +- +-} ++$ECHO "$GREY[-] nyx_mode cannot be tested inside the sandbox" + + . ./test-post.sh + diff --git a/pkgs/tools/security/aflplusplus/nyx_mode/packer/packer.nix b/pkgs/tools/security/aflplusplus/nyx_mode/packer/packer.nix new file mode 100644 index 000000000000..a91a24b0cc28 --- /dev/null +++ b/pkgs/tools/security/aflplusplus/nyx_mode/packer/packer.nix @@ -0,0 +1,156 @@ +{ + stdenv, + lib, + callPackage, + fetchFromGitHub, + cpio, + gzip, + glibc, + pkgsi686Linux, + pax-utils, + makeWrapper, + python3, + aflplusplus, + qemu-nyx, +}: + +# this derivation assumes x86_64-linux +assert stdenv.targetPlatform.system == "x86_64-linux"; + +let + python3WithPkgs = python3.withPackages (ps: [ + ps.msgpack + ps.jinja2 + ]); +in +stdenv.mkDerivation { + version = builtins.readFile (aflplusplus.src + "/nyx_mode/PACKER_VERSION"); + pname = "nyx-packer"; + + src = aflplusplus.src; + postUnpack = '' + sourceRoot="$sourceRoot/nyx_mode/packer" + ''; + + patches = [ + # this patch does following things: + # * write default config to ~/.nyx/nyx.ini because nix store is read-only + # * fix https://github.com/nyx-fuzz/packer/issues/35 + # * apply Matt Morehouse's patch (https://github.com/nyx-fuzz/packer/pull/34) + ./packer.patch + ]; + + strictDeps = true; + + # compile_64.sh / compile_loader use -O0; _FORTIFY_SOURCE needs optimization + hardeningDisable = [ "fortify" ]; + + nativeBuildInputs = [ + cpio + gzip + makeWrapper + ]; + + buildInputs = [ + glibc + glibc.static + pkgsi686Linux.glibc + ]; + + dontConfigure = true; + + postPatch = '' + substituteInPlace packer/common/config.py \ + --replace-fail \ + '"QEMU-PT_PATH": "../../QEMU-Nyx/x86_64-softmmu/qemu-system-x86_64"' \ + '"QEMU-PT_PATH": "${qemu-nyx}/bin/qemu-system-x86_64"' + + # fix paths to shared libraries that assume debian FHS + substituteInPlace linux_initramfs/pack.sh \ + --replace-fail \ + 'cp -L /lib/ld-linux.so.2' \ + 'cp -L ${pkgsi686Linux.glibc}/lib/ld-linux.so.2' \ + --replace-fail \ + 'cp -L /lib/x86_64-linux-gnu/libdl.so.2' \ + 'cp -L ${glibc}/lib/libdl.so.2' \ + --replace-fail \ + 'cp -L /lib/x86_64-linux-gnu/libc.so.6' \ + 'cp -L ${glibc}/lib/libc.so.6' \ + --replace-fail \ + 'cp -L /lib64/ld-linux-x86-64.so.2' \ + 'cp -L ${glibc}/lib/ld-linux-x86-64.so.2' \ + --replace-fail \ + 'cp -L /lib64/libdl.so.2' \ + 'cp -L ${glibc}/lib/libdl.so.2' \ + --replace-fail \ + 'cp -L /lib64/libc.so.6' \ + 'cp -L ${glibc}/lib/libc.so.6' \ + --replace-fail \ + 'cp -L /lib32/libc.so.6' \ + 'cp -L ${pkgsi686Linux.glibc}/lib/libc.so.6' \ + --replace-fail \ + 'cp -L /lib32/libdl.so.2' \ + 'cp -L ${pkgsi686Linux.glibc}/lib/libdl.so.2' \ + --replace-fail \ + 'cp /lib/x86_64-linux-gnu/libnss_compat.so.2' \ + 'cp -L ${glibc}/lib/libnss_compat.so.2' \ + --replace-fail \ + 'cp /lib64/libnss_compat.so.2' \ + 'cp ${glibc}/lib/libnss_compat.so.2' + ''; + + buildPhase = '' + runHook preBuild + + pushd packer/linux_x86_64-userspace + echo "+ bash -e compile_64.sh" + bash -e compile_64.sh + popd + + pushd linux_initramfs + echo "+ bash -e pack.sh" + bash -e pack.sh + popd + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + # copy build tree so python scripts can assume regular relative paths + cp -r . "$out" && chmod -R u+w "$out" + + PATH="${python3WithPkgs}/bin:$PATH" patchShebangs --build $out/packer + wrapProgram $out/packer/nyx_packer.py \ + --suffix PATH : ${ + lib.makeBinPath [ + pax-utils + qemu-nyx + ] + } + wrapProgram $out/packer/nyx_config_gen.py \ + --suffix PATH : ${ + lib.makeBinPath [ + pax-utils + qemu-nyx + ] + } + + runHook postInstall + ''; + + postFixup = '' + # packer binaries are meant to run inside the vm + find "$out/packer/linux_x86_64-userspace/bin64" -type f \ + -exec patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 {} \; + ''; + + meta = { + homepage = "https://github.com/nyx-fuzz/packer"; + description = "image packer for Nyx VMs"; + license = lib.licenses.gpl2Only; + platforms = lib.platforms.x86_64; + maintainers = with lib.maintainers; [ ekzyis ]; + }; +} diff --git a/pkgs/tools/security/aflplusplus/nyx_mode/packer/packer.patch b/pkgs/tools/security/aflplusplus/nyx_mode/packer/packer.patch new file mode 100644 index 000000000000..b91ee31dc30c --- /dev/null +++ b/pkgs/tools/security/aflplusplus/nyx_mode/packer/packer.patch @@ -0,0 +1,103 @@ +diff --git a/linux_initramfs/pack.sh b/linux_initramfs/pack.sh +index e042bb5..f04c0a1 100644 +--- a/linux_initramfs/pack.sh ++++ b/linux_initramfs/pack.sh +@@ -40,15 +40,17 @@ mkdir rootTemplate/lib/i386-linux-gnu/ + mkdir rootTemplate/lib/x86_64-linux-gnu/ + + cp -L /lib/ld-linux.so.2 rootTemplate/lib/ld-linux.so.2 +-cp -L /lib64/ld-linux-x86-64.so.2 rootTemplate/lib64/ld-linux-x86-64.so.2 + cp -L /lib/x86_64-linux-gnu/libdl.so.2 rootTemplate/lib/x86_64-linux-gnu/libdl.so.2 + cp -L /lib/x86_64-linux-gnu/libc.so.6 rootTemplate//lib/x86_64-linux-gnu/libc.so.6 ++cp -L /lib64/ld-linux-x86-64.so.2 rootTemplate/lib64/ld-linux-x86-64.so.2 ++cp -L /lib64/libdl.so.2 rootTemplate/lib64/libdl.so.2 ++cp -L /lib64/libc.so.6 rootTemplate/lib64/libc.so.6 + cp -L /lib32/libc.so.6 rootTemplate//lib32/libc.so.6 +-cp -L /lib/ld-linux.so.2 rootTemplate/lib/ld-linux.so.2 + cp -L /lib32/libdl.so.2 rootTemplate/lib32/libdl.so.2 + + # fix nasty nss bugs (getpwnam_r, ...) + cp /lib/x86_64-linux-gnu/libnss_compat.so.2 rootTemplate//lib/x86_64-linux-gnu/ ++cp /lib64/libnss_compat.so.2 rootTemplate/lib64/ + + cp -r "rootTemplate" "init" + sed '/START/c\./loader' init/init_template > init/init +diff --git a/linux_initramfs/rootTemplate/init_template b/linux_initramfs/rootTemplate/init_template +index 0d29602..f555082 100755 +--- a/linux_initramfs/rootTemplate/init_template ++++ b/linux_initramfs/rootTemplate/init_template +@@ -19,7 +19,7 @@ adduser --gecos "ubuntu" --disabled-password --ingroup ubuntu ubuntu + echo "ubuntu:ubuntu" | chpasswd + + # multiarch support +-export LD_LIBRARY_PATH=/lib32 ++export LD_LIBRARY_PATH=/lib64:/lib32 + + START + #./loader +diff --git a/packer/common/config.py b/packer/common/config.py +index 74f2b2e..e0fcf3a 100644 +--- a/packer/common/config.py ++++ b/packer/common/config.py +@@ -39,7 +39,7 @@ default_config = { + "QEMU-PT_PATH": "../../QEMU-Nyx/x86_64-softmmu/qemu-system-x86_64", + "KERNEL": "../linux_initramfs/bzImage-linux-4.15-rc7", + "INIT_RAMFS": "../linux_initramfs/init.cpio.gz", +- "DEFAULT_FUZZER_CONFIG_FOLDER": "./fuzzer_configs/", ++ "DEFAULT_FUZZER_CONFIG_FOLDER": os.path.expanduser("~/.nyx/fuzzer_configs/"), + "DEFAULT_VM_HDA": "", + "DEFAULT_VM_PRESNAPSHOT": "", + } +@@ -149,6 +149,9 @@ class ConfigReader(object): + def __init_config(self, config_file): + if not os.path.exists(config_file): + print("Configuration \"%s\" not found -> Creating..."%(os.path.realpath(config_file))) ++ config_dir = os.path.dirname(os.path.abspath(config_file)) ++ os.makedirs(config_dir, exist_ok=True) ++ os.makedirs(config_dir+"/fuzzer_configs/", exist_ok=True) + f = open(config_file, "w") + config = configparser.ConfigParser() + config["Packer"] = {} +@@ -261,7 +264,7 @@ class PackerConfiguration: + self.load_old_state = False + + def __load_config(self): +- self.config_values = ConfigReader(os.path.dirname(os.path.realpath(__file__))+"/../nyx.ini", self.__config_section, self.__config_default).get_values() ++ self.config_values = ConfigReader(os.path.expanduser("~/.nyx/nyx.ini"), self.__config_section, self.__config_default).get_values() + + def __load_arguments(self): + modes = ["afl", "spec"] +@@ -344,7 +347,7 @@ class ConfigGeneratorConfiguration: + self.load_old_state = False + + def __load_config(self): +- self.config_values = ConfigReader(os.path.dirname(os.path.realpath(__file__)) +"/../nyx.ini", self.__config_section, self.__config_default).get_values() ++ self.config_values = ConfigReader(os.path.expanduser("~/.nyx/nyx.ini"), self.__config_section, self.__config_default).get_values() + + def __load_arguments(self): + +diff --git a/packer/common/self_check.py b/packer/common/self_check.py +index 10f2405..e16ac37 100644 +--- a/packer/common/self_check.py ++++ b/packer/common/self_check.py +@@ -170,12 +170,14 @@ def check_apple_ignore_msrs(config): + + + def check_nyx_ini(): +- if not os.path.exists(os.path.dirname(sys.argv[0])+"/nyx.ini") and not os.path.exists("nyx.ini"): +- from common.config import FuzzerConfiguration +- FuzzerConfiguration(skip_args=True).create_initial_config() +- print(WARNING + WARNING_PREFIX + "nyx.ini file does not exist. Creating..." + ENDC) +- return False +- return True ++ # comment this code out because FuzzerConfiguration does not exist ++ # see https://github.com/nyx-fuzz/packer/issues/35 ++ # if not os.path.exists(os.path.dirname(sys.argv[0])+"/nyx.ini") and not os.path.exists("nyx.ini"): ++ # from common.config import FuzzerConfiguration ++ # FuzzerConfiguration(skip_args=True).create_initial_config() ++ # print(WARNING + WARNING_PREFIX + "nyx.ini file does not exist. Creating..." + ENDC) ++ # return False ++ return os.path.exists(os.path.expanduser("~/.nyx/nyx.ini")) + + + def check_qemu_version(config):