From 08076f0500fda00ba09a926a25a0300dc21bade0 Mon Sep 17 00:00:00 2001 From: hexcoder- Date: Sat, 6 Feb 2021 12:04:29 +0100 Subject: fix qemu build script for Arch Linux ($CROSS) --- qemu_mode/build_qemu_support.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qemu_mode/build_qemu_support.sh') diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh index a435f6f6..a161cc43 100755 --- a/qemu_mode/build_qemu_support.sh +++ b/qemu_mode/build_qemu_support.sh @@ -364,6 +364,10 @@ ORIG_CROSS="$CROSS" if [ "$ORIG_CROSS" = "" ]; then CROSS=$CPU_TARGET-linux-gnu-gcc + if ! command -v "$CROSS" > /dev/null + then # works on Arch Linux + CROSS=$CPU_TARGET-pc-linux-gnu-gcc + fi fi if ! command -v "$CROSS" > /dev/null -- cgit 1.4.1 From 91f2f057e4eacab4cd3a1a11cde157e3a31470d0 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Thu, 11 Feb 2021 21:17:08 +0100 Subject: fix #723 --- qemu_mode/build_qemu_support.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'qemu_mode/build_qemu_support.sh') diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh index 608db9e4..e14d238a 100755 --- a/qemu_mode/build_qemu_support.sh +++ b/qemu_mode/build_qemu_support.sh @@ -233,7 +233,6 @@ QEMU_CONF_FLAGS=" \ --disable-xen \ --disable-xen-pci-passthrough \ --disable-xfsctl \ - --enable-pie \ --python=${PYTHONBIN} \ --target-list="${CPU_TARGET}-linux-user" \ --without-default-devices \ @@ -253,6 +252,11 @@ if [ "$STATIC" = "1" ]; then --static \ --extra-cflags=-DAFL_QEMU_STATIC_BUILD=1 \ " + +else + + QEMU_CONF_FLAGS="{$QEMU_CONF_FLAGS} --enable-pie " + fi if [ "$DEBUG" = "1" ]; then -- cgit 1.4.1 From 95c77c848688b72f6f961f93afe4e33f3c54594e Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Sun, 14 Feb 2021 11:46:23 +0100 Subject: try qemu build fix --- qemu_mode/build_qemu_support.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'qemu_mode/build_qemu_support.sh') diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh index a161cc43..5eb35855 100755 --- a/qemu_mode/build_qemu_support.sh +++ b/qemu_mode/build_qemu_support.sh @@ -234,14 +234,14 @@ QEMU_CONF_FLAGS=" \ --disable-xen-pci-passthrough \ --disable-xfsctl \ --enable-pie \ - --python=${PYTHONBIN} \ + --python=$PYTHONBIN \ --target-list="${CPU_TARGET}-linux-user" \ --without-default-devices \ " if [ -n "${CROSS_PREFIX}" ]; then - QEMU_CONF_FLAGS="${QEMU_CONF_FLAGS} --cross-prefix=${CROSS_PREFIX}" + QEMU_CONF_FLAGS="$QEMU_CONF_FLAGS --cross-prefix=$CROSS_PREFIX" fi @@ -249,7 +249,7 @@ if [ "$STATIC" = "1" ]; then echo Building STATIC binary - QEMU_CONF_FLAGS="${QEMU_CONF_FLAGS} \ + QEMU_CONF_FLAGS="$QEMU_CONF_FLAGS \ --static \ --extra-cflags=-DAFL_QEMU_STATIC_BUILD=1 \ " @@ -262,7 +262,7 @@ if [ "$DEBUG" = "1" ]; then # --enable-gcov might go here but incurs a mesonbuild error on meson # versions prior to 0.56: # https://github.com/qemu/meson/commit/903d5dd8a7dc1d6f8bef79e66d6ebc07c - QEMU_CONF_FLAGS="${QEMU_CONF_FLAGS} \ + QEMU_CONF_FLAGS="$QEMU_CONF_FLAGS \ --disable-strip \ --enable-debug \ --enable-debug-info \ @@ -275,7 +275,7 @@ if [ "$DEBUG" = "1" ]; then else - QEMU_CONF_FLAGS="${QEMU_CONF_FLAGS} \ + QEMU_CONF_FLAGS="$QEMU_CONF_FLAGS \ --disable-debug-info \ --disable-debug-mutex \ --disable-debug-tcg \ @@ -290,7 +290,7 @@ if [ "$PROFILING" = "1" ]; then echo Building PROFILED binary - QEMU_CONF_FLAGS="${QEMU_CONF_FLAGS} \ + QEMU_CONF_FLAGS="$QEMU_CONF_FLAGS \ --enable-gprof \ --enable-profiler \ " @@ -298,7 +298,7 @@ if [ "$PROFILING" = "1" ]; then fi # shellcheck disable=SC2086 -./configure ${QEMU_CONF_FLAGS} || exit 1 +./configure $QEMU_CONF_FLAGS || exit 1 echo "[+] Configuration complete." -- cgit 1.4.1 From fe477e96ae0488890e7149da00abcaec933a2045 Mon Sep 17 00:00:00 2001 From: hexcoder Date: Mon, 15 Feb 2021 09:24:13 +0100 Subject: fix configure arguments --- qemu_mode/build_qemu_support.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qemu_mode/build_qemu_support.sh') diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh index e3c9d6ff..50e5d4e8 100755 --- a/qemu_mode/build_qemu_support.sh +++ b/qemu_mode/build_qemu_support.sh @@ -255,7 +255,7 @@ if [ "$STATIC" = "1" ]; then else - QEMU_CONF_FLAGS="{$QEMU_CONF_FLAGS} --enable-pie " + QEMU_CONF_FLAGS="${QEMU_CONF_FLAGS} --enable-pie " fi -- cgit 1.4.1 From 07884e00549b247d59c6289e58808aae401eeb79 Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Mon, 1 Mar 2021 09:37:07 +0100 Subject: feodora qemu lib fix --- qemu_mode/build_qemu_support.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'qemu_mode/build_qemu_support.sh') diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh index 50e5d4e8..815e77d6 100755 --- a/qemu_mode/build_qemu_support.sh +++ b/qemu_mode/build_qemu_support.sh @@ -374,10 +374,20 @@ if [ "$ORIG_CROSS" = "" ]; then fi fi -if ! command -v "$CROSS" > /dev/null -then +if ! command -v "$CROSS" > /dev/null ; then + if [ "$CPU_TARGET" = "$(uname -m)" ] ; then + echo "[+] Building afl++ qemu support libraries with CC=$CC" + echo "[+] Building libcompcov ..." + make -C libcompcov && echo "[+] libcompcov ready" + echo "[+] Building unsigaction ..." + make -C unsigaction && echo "[+] unsigaction ready" + echo "[+] Building libqasan ..." + make -C libqasan && echo "[+] unsigaction ready" + else echo "[!] Cross compiler $CROSS could not be found, cannot compile libcompcov libqasan and unsigaction" + fi else + echo "[+] Building afl++ qemu support libraries with CC=$CROSS" echo "[+] Building libcompcov ..." make -C libcompcov CC=$CROSS && echo "[+] libcompcov ready" echo "[+] Building unsigaction ..." -- cgit 1.4.1 From 3977d50b5538e8097eb5d9329c6df5eaa147374b Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Thu, 4 Mar 2021 10:52:22 +0100 Subject: update qemuafl and remove git stas --- qemu_mode/QEMUAFL_VERSION | 2 +- qemu_mode/build_qemu_support.sh | 2 +- qemu_mode/qemuafl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'qemu_mode/build_qemu_support.sh') diff --git a/qemu_mode/QEMUAFL_VERSION b/qemu_mode/QEMUAFL_VERSION index 1152380c..a7f25da3 100644 --- a/qemu_mode/QEMUAFL_VERSION +++ b/qemu_mode/QEMUAFL_VERSION @@ -1 +1 @@ -e36a30ebca +d1ca56b84e diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh index 815e77d6..97a05800 100755 --- a/qemu_mode/build_qemu_support.sh +++ b/qemu_mode/build_qemu_support.sh @@ -132,7 +132,7 @@ echo "[+] Got qemuafl." cd "qemuafl" || exit 1 echo "[*] Checking out $QEMUAFL_VERSION" -sh -c 'git stash && git stash drop' 1>/dev/null 2>/dev/null +# sh -c 'git stash && git stash drop' 1>/dev/null 2>/dev/null git checkout "$QEMUAFL_VERSION" || echo Warning: could not check out to commit $QEMUAFL_VERSION echo "[*] Making sure imported headers matches" diff --git a/qemu_mode/qemuafl b/qemu_mode/qemuafl index 213f3b27..d1ca56b8 160000 --- a/qemu_mode/qemuafl +++ b/qemu_mode/qemuafl @@ -1 +1 @@ -Subproject commit 213f3b27dd099ef352181c48cd75c0f20a73e3f0 +Subproject commit d1ca56b84e78f821406eef28d836918edfc8d610 -- cgit 1.4.1 From 08ef8d6b787f1a04b5ec3644d7ecae41d2668193 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Thu, 4 Mar 2021 10:57:00 +0100 Subject: NO_CHECKOUT=1 ./build_qemu_support.sh --- qemu_mode/build_qemu_support.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'qemu_mode/build_qemu_support.sh') diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh index 97a05800..4d3d9bf6 100755 --- a/qemu_mode/build_qemu_support.sh +++ b/qemu_mode/build_qemu_support.sh @@ -131,9 +131,13 @@ test -d qemuafl || { echo "[-] Not checked out, please install git or check your echo "[+] Got qemuafl." cd "qemuafl" || exit 1 -echo "[*] Checking out $QEMUAFL_VERSION" -# sh -c 'git stash && git stash drop' 1>/dev/null 2>/dev/null -git checkout "$QEMUAFL_VERSION" || echo Warning: could not check out to commit $QEMUAFL_VERSION +if [ -n "$NO_CHECKOUT" ]; then + echo "[*] Skipping checkout to $QEMUAFL_VERSION" +else + echo "[*] Checking out $QEMUAFL_VERSION" + sh -c 'git stash' 1>/dev/null 2>/dev/null + git checkout "$QEMUAFL_VERSION" || echo Warning: could not check out to commit $QEMUAFL_VERSION +fi echo "[*] Making sure imported headers matches" cp "../../include/config.h" "./qemuafl/imported/" || exit 1 -- cgit 1.4.1 From a0a917ad87b066fc96ba7e69e5aa837b3837d67c Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Tue, 9 Mar 2021 21:03:18 +0100 Subject: better CROSS detection --- qemu_mode/build_qemu_support.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'qemu_mode/build_qemu_support.sh') diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh index 4d3d9bf6..0101b733 100755 --- a/qemu_mode/build_qemu_support.sh +++ b/qemu_mode/build_qemu_support.sh @@ -376,6 +376,18 @@ if [ "$ORIG_CROSS" = "" ]; then then # works on Arch Linux CROSS=$CPU_TARGET-pc-linux-gnu-gcc fi + if ! command -v "$CROSS" > /dev/null && [ "$CPU_TARGET" = "i386" ] + then + CROSS=i686-linux-gnu-gcc + if ! command -v "$CROSS" > /dev/null + then # works on Arch Linux + CROSS=i686-pc-linux-gnu-gcc + fi + if ! command -v "$CROSS" > /dev/null && [ "`uname -m`" = "x86_64" ] + then # set -m32 + CROSS="$CC -m32" + fi + fi fi if ! command -v "$CROSS" > /dev/null ; then -- cgit 1.4.1 From 40ba8814b381d7e090717df8197f5957a5013ca9 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Tue, 9 Mar 2021 21:05:58 +0100 Subject: better CROSS detection --- qemu_mode/build_qemu_support.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'qemu_mode/build_qemu_support.sh') diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh index 0101b733..a88cb54f 100755 --- a/qemu_mode/build_qemu_support.sh +++ b/qemu_mode/build_qemu_support.sh @@ -385,6 +385,7 @@ if [ "$ORIG_CROSS" = "" ]; then fi if ! command -v "$CROSS" > /dev/null && [ "`uname -m`" = "x86_64" ] then # set -m32 + test "$CC" = "" && CC="gcc" CROSS="$CC -m32" fi fi -- cgit 1.4.1 From 0d6e5712372477a61a4ebee6995fb48d30e93304 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Tue, 9 Mar 2021 21:11:44 +0100 Subject: better CROSS detection --- qemu_mode/build_qemu_support.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'qemu_mode/build_qemu_support.sh') diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh index a88cb54f..c9674c53 100755 --- a/qemu_mode/build_qemu_support.sh +++ b/qemu_mode/build_qemu_support.sh @@ -386,7 +386,8 @@ if [ "$ORIG_CROSS" = "" ]; then if ! command -v "$CROSS" > /dev/null && [ "`uname -m`" = "x86_64" ] then # set -m32 test "$CC" = "" && CC="gcc" - CROSS="$CC -m32" + CROSS="$CC" + CROSS_FLAGS=-m32 fi fi fi @@ -404,13 +405,13 @@ if ! command -v "$CROSS" > /dev/null ; then echo "[!] Cross compiler $CROSS could not be found, cannot compile libcompcov libqasan and unsigaction" fi else - echo "[+] Building afl++ qemu support libraries with CC=$CROSS" + echo "[+] Building afl++ qemu support libraries with CC=\"$CROSS $CROSS_FLAGS\"" echo "[+] Building libcompcov ..." - make -C libcompcov CC=$CROSS && echo "[+] libcompcov ready" + make -C libcompcov CC="$CROSS $CROSS_FLAGS" && echo "[+] libcompcov ready" echo "[+] Building unsigaction ..." - make -C unsigaction CC=$CROSS && echo "[+] unsigaction ready" + make -C unsigaction CC="$CROSS $CROSS_FLAGS" && echo "[+] unsigaction ready" echo "[+] Building libqasan ..." - make -C libqasan CC=$CROSS && echo "[+] unsigaction ready" + make -C libqasan CC="$CROSS $CROSS_FLAGS" && echo "[+] unsigaction ready" fi echo "[+] All done for qemu_mode, enjoy!" -- cgit 1.4.1 From 87eb44abe4c30c777b6d5dad890bea7cdeeffdf3 Mon Sep 17 00:00:00 2001 From: "R. Elliott Childre" Date: Tue, 9 Mar 2021 16:24:59 -0500 Subject: Remove QEMU dependency checks Most of these packages (bison, flex, pixman (in non-system mode)) are no longer dependencies of QEMU and regardless, QEMU's build system is quite capable of finding dependencies by itself and will error out accordingly. This prevents having to further change this code as QEMU's dependencies inevitably change. --- qemu_mode/build_qemu_support.sh | 43 +---------------------------------------- 1 file changed, 1 insertion(+), 42 deletions(-) (limited to 'qemu_mode/build_qemu_support.sh') diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh index c9674c53..38085389 100755 --- a/qemu_mode/build_qemu_support.sh +++ b/qemu_mode/build_qemu_support.sh @@ -59,51 +59,11 @@ if [ ! -f "../afl-showmap" ]; then fi -PREREQ_NOTFOUND= -for i in git wget sha384sum bison flex iconv patch pkg-config; do - - T=`command -v "$i" 2>/dev/null` - - if [ "$T" = "" ]; then - - echo "[-] Error: '$i' not found, please install first." - PREREQ_NOTFOUND=1 - - fi - -done - -PYTHONBIN=`command -v python3 || command -v python || command -v python2` - -if [ "$PYTHONBIN" = "" ]; then - echo "[-] Error: 'python' not found, please install using 'sudo apt install python3'." - PREREQ_NOTFOUND=1 -fi - - -if [ ! -d "/usr/include/glib-2.0/" -a ! -d "/usr/local/include/glib-2.0/" ]; then - - echo "[-] Error: devel version of 'glib2' not found, please install first." - PREREQ_NOTFOUND=1 - -fi - -if [ ! -d "/usr/include/pixman-1/" -a ! -d "/usr/local/include/pixman-1/" ]; then - - echo "[-] Error: devel version of 'pixman-1' not found, please install first." - PREREQ_NOTFOUND=1 - -fi - if echo "$CC" | grep -qF /afl-; then echo "[-] Error: do not use afl-gcc or afl-clang to compile this tool." - PREREQ_NOTFOUND=1 - -fi - -if [ "$PREREQ_NOTFOUND" = "1" ]; then exit 1 + fi echo "[+] All checks passed!" @@ -237,7 +197,6 @@ QEMU_CONF_FLAGS=" \ --disable-xen \ --disable-xen-pci-passthrough \ --disable-xfsctl \ - --python=${PYTHONBIN} \ --target-list="${CPU_TARGET}-linux-user" \ --without-default-devices \ " -- cgit 1.4.1