summaryrefslogtreecommitdiff
path: root/pkgs/tools/security/aflplusplus/qemu.nix
blob: 6c00155ef1f6d6579b66d2241c192fcf33b606d2 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
{
  lib,
  stdenv,
  python3,
  zlib,
  pkg-config,
  glib,
  perl,
  texinfo,
  libuuid,
  flex,
  bison,
  pixman,
  meson,
  fetchFromGitHub,
  ninja,
}:

let
  qemuName = "qemu-5.2.50";
in
stdenv.mkDerivation {
  name = "aflplusplus-${qemuName}";

  src = fetchFromGitHub {
    owner = "AFLplusplus";
    repo = "qemuafl";
    # Use a revision that contains a fix for https://github.com/AFLplusplus/AFLplusplus/issues/2296
    # instead of https://github.com/AFLplusplus/AFLplusplus/blob/v4.31c/qemu_mode/QEMUAFL_VERSION.
    rev = "ef1cd9a8cb1522c918faab42805216f9a4054dda";
    sha256 = "sha256-tbKDnDoBtFhvtE9nbi9XuHPuFuGezUFngnw4pJyKFgY=";
    fetchSubmodules = true;
  };

  nativeBuildInputs = [
    python3
    perl
    pkg-config
    flex
    bison
    meson
    texinfo
    ninja
  ];

  buildInputs = [
    zlib
    glib
    pixman
    libuuid
  ];

  enableParallelBuilding = true;

  dontUseMesonConfigure = true; # meson's configurePhase isn't compatible with qemu build
  preBuild = "cd build";
  preConfigure = ''
    # this script isn't marked as executable b/c it's indirectly used by meson. Needed to patch its shebang
    chmod +x ./scripts/shaderinclude.pl
    patchShebangs .
  '';

  configureFlags = [
    "--target-list=${stdenv.hostPlatform.uname.processor}-linux-user"
    "--sysconfdir=/etc"
    "--localstatedir=/var"
    "--meson=meson"
    "--disable-system"
    "--enable-linux-user"
    "--enable-pie"
    "--audio-drv-list="
    "--disable-blobs"
    "--disable-bochs"
    "--disable-brlapi"
    "--disable-bsd-user"
    "--disable-bzip2"
    "--disable-cap-ng"
    "--disable-cloop"
    "--disable-curl"
    "--disable-curses"
    "--disable-dmg"
    "--disable-fdt"
    "--disable-gcrypt"
    "--disable-glusterfs"
    "--disable-gnutls"
    "--disable-gtk"
    "--disable-guest-agent"
    "--disable-iconv"
    "--disable-libiscsi"
    "--disable-libnfs"
    "--disable-libssh"
    "--disable-libusb"
    "--disable-linux-aio"
    "--disable-live-block-migration"
    "--disable-lzo"
    "--disable-nettle"
    "--disable-numa"
    "--disable-opengl"
    "--disable-parallels"
    "--disable-plugins"
    "--disable-qcow1"
    "--disable-qed"
    "--disable-rbd"
    "--disable-rdma"
    "--disable-replication"
    "--disable-sdl"
    "--disable-seccomp"
    "--disable-sheepdog"
    "--disable-smartcard"
    "--disable-snappy"
    "--disable-spice"
    "--disable-system"
    "--disable-tools"
    "--disable-tpm"
    "--disable-usb-redir"
    "--disable-vde"
    "--disable-vdi"
    "--disable-vhost-crypto"
    "--disable-vhost-kernel"
    "--disable-vhost-net"
    "--disable-vhost-scsi"
    "--disable-vhost-user"
    "--disable-vhost-vdpa"
    "--disable-vhost-vsock"
    "--disable-virglrenderer"
    "--disable-virtfs"
    "--disable-vnc"
    "--disable-vnc-jpeg"
    "--disable-vnc-png"
    "--disable-vnc-sasl"
    "--disable-vte"
    "--disable-vvfat"
    "--disable-xen"
    "--disable-xen-pci-passthrough"
    "--disable-xfsctl"
    "--without-default-devices"
  ];

  meta = {
    homepage = "https://github.com/AFLplusplus/qemuafl";
    description = "Fork of QEMU with AFL++ instrumentation support";
    license = lib.licenses.gpl2Plus;
    maintainers = with lib.maintainers; [
      ris
      msanft
    ];
    platforms = lib.platforms.linux;
  };
}