pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

wip/triforceafl: import triforceafl-0.0.2017.06.01



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sun Jun 2 23:45:56 2019 +0200
Changeset:	b9be9874dbc8b20783d7d617aa841b6ff9a45e07

Added Files:
	triforceafl/DESCR
	triforceafl/Makefile
	triforceafl/PLIST
	triforceafl/distinfo
	triforceafl/patches/patch-qemu__mode_build__qemu__support.sh
	triforceafl/patches/patch-qemu__mode_qemu_Makefile
	triforceafl/patches/patch-qemu__mode_qemu_audio_audio.c
	triforceafl/patches/patch-qemu__mode_qemu_hw_display_omap__dss.c
	triforceafl/patches/patch-qemu__mode_qemu_hw_net_etraxfs__eth.c
	triforceafl/patches/patch-qemu__mode_qemu_hw_net_xilinx__axienet.c
	triforceafl/patches/patch-qemu__mode_qemu_hw_ppc_mac__newworld.c
	triforceafl/patches/patch-qemu__mode_qemu_hw_ppc_mac__oldworld.c
	triforceafl/patches/patch-qemu__mode_qemu_memory.c
	triforceafl/patches/patch-qemu__mode_qemu_slirp_tcp__subr.c
	triforceafl/patches/patch-qemu__mode_qemu_tests_Makefile

Log Message:
wip/triforceafl: import triforceafl-0.0.2017.06.01

Patched version of AFL that supports full-system fuzzing
using QEMU. The included QEMU has been updated to allow tracing
of branches when running a system emulator for x86_64.
Extra instructions have been added to start AFL's forkserver,
make fuzz settings, and mark the start and stop of test cases.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=b9be9874dbc8b20783d7d617aa841b6ff9a45e07

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 triforceafl/DESCR                                  |  5 ++
 triforceafl/Makefile                               | 41 ++++++++++++
 triforceafl/PLIST                                  | 78 ++++++++++++++++++++++
 triforceafl/distinfo                               | 17 +++++
 .../patch-qemu__mode_build__qemu__support.sh       | 21 ++++++
 triforceafl/patches/patch-qemu__mode_qemu_Makefile | 26 ++++++++
 .../patches/patch-qemu__mode_qemu_audio_audio.c    | 16 +++++
 .../patch-qemu__mode_qemu_hw_display_omap__dss.c   | 30 +++++++++
 .../patch-qemu__mode_qemu_hw_net_etraxfs__eth.c    | 25 +++++++
 .../patch-qemu__mode_qemu_hw_net_xilinx__axienet.c | 16 +++++
 .../patch-qemu__mode_qemu_hw_ppc_mac__newworld.c   | 38 +++++++++++
 .../patch-qemu__mode_qemu_hw_ppc_mac__oldworld.c   | 38 +++++++++++
 triforceafl/patches/patch-qemu__mode_qemu_memory.c | 15 +++++
 .../patch-qemu__mode_qemu_slirp_tcp__subr.c        | 15 +++++
 .../patches/patch-qemu__mode_qemu_tests_Makefile   | 17 +++++
 15 files changed, 398 insertions(+)

diffs:
diff --git a/triforceafl/DESCR b/triforceafl/DESCR
new file mode 100644
index 0000000000..57bb00acc8
--- /dev/null
+++ b/triforceafl/DESCR
@@ -0,0 +1,5 @@
+Patched version of AFL that supports full-system fuzzing
+using QEMU. The included QEMU has been updated to allow tracing
+of branches when running a system emulator for x86_64.
+Extra instructions have been added to start AFL's forkserver,
+make fuzz settings, and mark the start and stop of test cases.
diff --git a/triforceafl/Makefile b/triforceafl/Makefile
new file mode 100644
index 0000000000..c3e692ec1f
--- /dev/null
+++ b/triforceafl/Makefile
@@ -0,0 +1,41 @@
+# $NetBSD$
+
+DISTNAME=	TriforceAFL-0.0.${SNAPSHOT}
+PKGNAME=	${DISTNAME:tl}
+CATEGORIES=	emulators
+MASTER_SITES=	${MASTER_SITE_GITHUB:=nccgroup/}
+GITHUB_TAG=	2a8ed329233a921044c903222fc3aa029ef68c69
+
+SNAPSHOT=	2017.06.01
+
+MAINTAINER=	vishnu%akulpillai.com@localhost
+HOMEPAGE=	https://github.com/nccgroup/TriforceAFL/
+COMMENT=	AFL/QEMU fuzzing with full-system emulation
+LICENSE=	gnu-gpl-v2 AND gnu-lgpl-v2.1 AND mit AND modified-bsd
+LICENSE+=	AND apache-2.0
+
+USE_TOOLS=	bash:run bison gmake perl:build pkg-config makeinfo
+REPLACE_SH+=	afl-plot
+REPLACE_BASH+=	afl-cmin
+
+WRKSRC=		${WRKDIR}/TriforceAFL-${GITHUB_TAG}
+
+PYTHON_VERSIONS_ACCEPTED=	27 # not ported as of 2017.06.01
+
+AFLPREFIX=	${PREFIX}/${PKGBASE}
+
+MAKE_FLAGS=	PREFIX=${AFLPREFIX}
+
+post-install:
+	${RUN} cd ${WRKSRC} && \
+		${INSTALL_PROGRAM} afl-qemu-system-trace \
+			${DESTDIR}${AFLPREFIX}/bin
+
+.include "../../devel/glib2/buildlink3.mk"
+.include "../../devel/ncurses/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../lang/python/extension.mk"
+.include "../../security/libgcrypt/buildlink3.mk"
+.include "../../x11/pixman/buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/triforceafl/PLIST b/triforceafl/PLIST
new file mode 100644
index 0000000000..98402a8343
--- /dev/null
+++ b/triforceafl/PLIST
@@ -0,0 +1,78 @@
+@comment $NetBSD$
+triforceafl/bin/afl-analyze
+triforceafl/bin/afl-clang
+triforceafl/bin/afl-clang++
+triforceafl/bin/afl-cmin
+triforceafl/bin/afl-fuzz
+triforceafl/bin/afl-g++
+triforceafl/bin/afl-gcc
+triforceafl/bin/afl-gotcpu
+triforceafl/bin/afl-plot
+triforceafl/bin/afl-qemu-system-trace
+triforceafl/bin/afl-showmap
+triforceafl/bin/afl-tmin
+triforceafl/bin/afl-whatsup
+triforceafl/lib/afl/afl-as
+triforceafl/lib/afl/as
+triforceafl/share/afl/testcases/README.testcases
+triforceafl/share/afl/testcases/_extras/gif.dict
+triforceafl/share/afl/testcases/_extras/html_tags.dict
+triforceafl/share/afl/testcases/_extras/jpeg.dict
+triforceafl/share/afl/testcases/_extras/js.dict
+triforceafl/share/afl/testcases/_extras/pdf.dict
+triforceafl/share/afl/testcases/_extras/png.dict
+triforceafl/share/afl/testcases/_extras/sql.dict
+triforceafl/share/afl/testcases/_extras/tiff.dict
+triforceafl/share/afl/testcases/_extras/webp.dict
+triforceafl/share/afl/testcases/_extras/xml.dict
+triforceafl/share/afl/testcases/archives/common/ar/small_archive.a
+triforceafl/share/afl/testcases/archives/common/bzip2/small_archive.bz2
+triforceafl/share/afl/testcases/archives/common/cab/small_archive.cab
+triforceafl/share/afl/testcases/archives/common/compress/small_archive.Z
+triforceafl/share/afl/testcases/archives/common/cpio/small_archive.cpio
+triforceafl/share/afl/testcases/archives/common/gzip/small_archive.gz
+triforceafl/share/afl/testcases/archives/common/lzo/small_archive.lzo
+triforceafl/share/afl/testcases/archives/common/rar/small_archive.rar
+triforceafl/share/afl/testcases/archives/common/tar/small_archive.tar
+triforceafl/share/afl/testcases/archives/common/xz/small_archive.xz
+triforceafl/share/afl/testcases/archives/common/zip/small_archive.zip
+triforceafl/share/afl/testcases/archives/exotic/arj/small_archive.arj
+triforceafl/share/afl/testcases/archives/exotic/lha/small_archive.lha
+triforceafl/share/afl/testcases/archives/exotic/lrzip/small_archive.lrz
+triforceafl/share/afl/testcases/archives/exotic/lzip/small_archive.lz
+triforceafl/share/afl/testcases/archives/exotic/lzma/small_archive.lzma
+triforceafl/share/afl/testcases/archives/exotic/rzip/small_archive.rz
+triforceafl/share/afl/testcases/archives/exotic/zoo/small_archive.zoo
+triforceafl/share/afl/testcases/images/bmp/not_kitty.bmp
+triforceafl/share/afl/testcases/images/gif/not_kitty.gif
+triforceafl/share/afl/testcases/images/ico/not_kitty.ico
+triforceafl/share/afl/testcases/images/jp2/not_kitty.jp2
+triforceafl/share/afl/testcases/images/jpeg/not_kitty.jpg
+triforceafl/share/afl/testcases/images/jxr/not_kitty.jxr
+triforceafl/share/afl/testcases/images/png/not_kitty.png
+triforceafl/share/afl/testcases/images/png/not_kitty_alpha.png
+triforceafl/share/afl/testcases/images/png/not_kitty_gamma.png
+triforceafl/share/afl/testcases/images/png/not_kitty_icc.png
+triforceafl/share/afl/testcases/images/tiff/not_kitty.tiff
+triforceafl/share/afl/testcases/images/webp/not_kitty.webp
+triforceafl/share/afl/testcases/multimedia/h264/small_movie.mp4
+triforceafl/share/afl/testcases/others/elf/small_exec.elf
+triforceafl/share/afl/testcases/others/js/small_script.js
+triforceafl/share/afl/testcases/others/pcap/small_capture.pcap
+triforceafl/share/afl/testcases/others/pdf/small.pdf
+triforceafl/share/afl/testcases/others/rtf/small_document.rtf
+triforceafl/share/afl/testcases/others/sql/simple_queries.sql
+triforceafl/share/afl/testcases/others/text/hello_world.txt
+triforceafl/share/afl/testcases/others/xml/small_document.xml
+triforceafl/share/doc/afl/ChangeLog
+triforceafl/share/doc/afl/QuickStartGuide.txt
+triforceafl/share/doc/afl/README
+triforceafl/share/doc/afl/env_variables.txt
+triforceafl/share/doc/afl/historical_notes.txt
+triforceafl/share/doc/afl/notes_for_asan.txt
+triforceafl/share/doc/afl/parallel_fuzzing.txt
+triforceafl/share/doc/afl/perf_tips.txt
+triforceafl/share/doc/afl/sister_projects.txt
+triforceafl/share/doc/afl/status_screen.txt
+triforceafl/share/doc/afl/technical_details.txt
+triforceafl/share/doc/afl/triforce_internals.txt
diff --git a/triforceafl/distinfo b/triforceafl/distinfo
new file mode 100644
index 0000000000..a08a8e0313
--- /dev/null
+++ b/triforceafl/distinfo
@@ -0,0 +1,17 @@
+$NetBSD$
+
+SHA1 (TriforceAFL-0.0.2017.06.01-2a8ed329233a921044c903222fc3aa029ef68c69.tar.gz) = 9ab1432700070345ee61b4a8719e90b9756de131
+RMD160 (TriforceAFL-0.0.2017.06.01-2a8ed329233a921044c903222fc3aa029ef68c69.tar.gz) = e4c34a542de1e6a5f6cad204fcea17858e7b6a34
+SHA512 (TriforceAFL-0.0.2017.06.01-2a8ed329233a921044c903222fc3aa029ef68c69.tar.gz) = aac1abb5e9d334923a4d6dab159e518bce1944573884e1012620aff139d4d0abcdbca41104c1c2eed9006fc277321f1f13212a698a7b7c49c6b0f1f98078d2e0
+Size (TriforceAFL-0.0.2017.06.01-2a8ed329233a921044c903222fc3aa029ef68c69.tar.gz) = 32045053 bytes
+SHA1 (patch-qemu__mode_build__qemu__support.sh) = 76fdbbbb93971e0ce55579b90c183a90b9a80e8f
+SHA1 (patch-qemu__mode_qemu_Makefile) = 8d8baa55e4f93ba635f9399c8e0a29f6f59d2292
+SHA1 (patch-qemu__mode_qemu_audio_audio.c) = aaa82ac3208ef605cb6f5b0fabd38a0d223f21f2
+SHA1 (patch-qemu__mode_qemu_hw_display_omap__dss.c) = 48f38ead6aa5a14b13f87e44217bb551817280ad
+SHA1 (patch-qemu__mode_qemu_hw_net_etraxfs__eth.c) = ceec571369f0f0a1f5b177f28a70a6d888ed67f2
+SHA1 (patch-qemu__mode_qemu_hw_net_xilinx__axienet.c) = 14106d36592b27beccf50f3844fc64fc5d591c1c
+SHA1 (patch-qemu__mode_qemu_hw_ppc_mac__newworld.c) = 51ecb00d8b0848277d6783eb3ee437665f6f963c
+SHA1 (patch-qemu__mode_qemu_hw_ppc_mac__oldworld.c) = 666b828a0060879503497c1405e2d2601d88bb5e
+SHA1 (patch-qemu__mode_qemu_memory.c) = 5f2de939254ea5d1b8acc76580205163edee471c
+SHA1 (patch-qemu__mode_qemu_slirp_tcp__subr.c) = 057d6e7b7af5ba9b3994f7944e797d0e1fd0c73b
+SHA1 (patch-qemu__mode_qemu_tests_Makefile) = c668c88991ccefdac8b0665113ea2c1a3d479ec5
diff --git a/triforceafl/patches/patch-qemu__mode_build__qemu__support.sh b/triforceafl/patches/patch-qemu__mode_build__qemu__support.sh
new file mode 100644
index 0000000000..2531965edb
--- /dev/null
+++ b/triforceafl/patches/patch-qemu__mode_build__qemu__support.sh
@@ -0,0 +1,21 @@
+$NetBSD$
+
+Disable linux-user and bsd-user
+
+--- qemu_mode/build_qemu_support.sh.orig	2017-05-31 22:53:05.000000000 +0000
++++ qemu_mode/build_qemu_support.sh
+@@ -6,12 +6,11 @@
+ cd qemu
+ 
+ CFLAGS="-O3" ./configure --disable-werror \
+-  --enable-system --enable-linux-user \
++  --enable-system --disable-linux-user --disable-bsd-user \
+   --enable-guest-base --disable-gtk --disable-sdl --disable-vnc \
+-  --target-list="x86_64-linux-user x86_64-softmmu arm-softmmu aarch64-softmmu"
++  --target-list="x86_64-softmmu arm-softmmu aarch64-softmmu"
+ 
+ make
+-cp -f "x86_64-linux-user/qemu-x86_64" "../../afl-qemu-trace"
+ cp -f "x86_64-softmmu/qemu-system-x86_64" "../../afl-qemu-system-trace"
+ cp -f "x86_64-softmmu/qemu-system-x86_64" "../../qemu-system-x86_64"
+ cp -f "arm-softmmu/qemu-system-arm" "../../qemu-system-arm"
diff --git a/triforceafl/patches/patch-qemu__mode_qemu_Makefile b/triforceafl/patches/patch-qemu__mode_qemu_Makefile
new file mode 100644
index 0000000000..6e38142d23
--- /dev/null
+++ b/triforceafl/patches/patch-qemu__mode_qemu_Makefile
@@ -0,0 +1,26 @@
+$NetBSD$
+
+Imported patch from qemu-2.3.0
+
+--- qemu_mode/qemu/Makefile.orig	2017-05-31 22:53:05.000000000 +0000
++++ qemu_mode/qemu/Makefile
+@@ -184,6 +184,7 @@ $(SRC_PATH)/pixman/configure:
+ DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
+ DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
+ DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
++ARFLAGS=	-rcs
+ 
+ subdir-dtc:dtc/libfdt dtc/tests
+ 	$(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,)
+@@ -391,8 +392,9 @@ endif
+ install-confdir:
+ 	$(INSTALL_DIR) "$(DESTDIR)$(qemu_confdir)"
+ 
+-install-sysconfig: install-datadir install-confdir
+-	$(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(qemu_confdir)"
++install-sysconfig:
++	$(INSTALL_DIR) "$(DESTDIR)$(egdir)"
++	$(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(egdir)"
+ 
+ install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig \
+ install-datadir install-localstatedir
diff --git a/triforceafl/patches/patch-qemu__mode_qemu_audio_audio.c b/triforceafl/patches/patch-qemu__mode_qemu_audio_audio.c
new file mode 100644
index 0000000000..73d11ca1aa
--- /dev/null
+++ b/triforceafl/patches/patch-qemu__mode_qemu_audio_audio.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Avoid conflicts with SSP read() macro in NetBSD's <ssp/unistd.h>
+(PR lib/43832: ssp causes common names to be defines)
+
+--- qemu_mode/qemu/audio/audio.c.orig	2017-05-31 22:53:05.000000000 +0000
++++ qemu_mode/qemu/audio/audio.c
+@@ -1173,7 +1173,7 @@ int AUD_read (SWVoiceIn *sw, void *buf, 
+         return 0;
+     }
+ 
+-    bytes = sw->hw->pcm_ops->read (sw, buf, size);
++    bytes = (*sw->hw->pcm_ops->read )(sw, buf, size);
+     return bytes;
+ }
+ 
diff --git a/triforceafl/patches/patch-qemu__mode_qemu_hw_display_omap__dss.c b/triforceafl/patches/patch-qemu__mode_qemu_hw_display_omap__dss.c
new file mode 100644
index 0000000000..64d8f7be41
--- /dev/null
+++ b/triforceafl/patches/patch-qemu__mode_qemu_hw_display_omap__dss.c
@@ -0,0 +1,30 @@
+$NetBSD$
+
+Avoid conflicts with SSP read() macro in NetBSD's <ssp/unistd.h>
+(PR lib/43832: ssp causes common names to be defines)
+
+--- qemu_mode/qemu/hw/display/omap_dss.c.orig	2017-05-31 22:53:05.000000000 +0000
++++ qemu_mode/qemu/hw/display/omap_dss.c
+@@ -794,18 +794,18 @@ static void omap_rfbi_write(void *opaque
+         break;
+     case 0x58:	/* RFBI_READ */
+         if ((s->rfbi.control & (1 << 2)) && s->rfbi.chip[0])
+-            s->rfbi.rxbuf = s->rfbi.chip[0]->read(s->rfbi.chip[0]->opaque, 1);
++	    s->rfbi.rxbuf = (*s->rfbi.chip[0]->read)(s->rfbi.chip[0]->opaque, 1);
+         else if ((s->rfbi.control & (1 << 3)) && s->rfbi.chip[1])
+-            s->rfbi.rxbuf = s->rfbi.chip[1]->read(s->rfbi.chip[1]->opaque, 1);
++	    s->rfbi.rxbuf = (*s->rfbi.chip[1]->read)(s->rfbi.chip[1]->opaque, 1);
+         if (!-- s->rfbi.pixels)
+             omap_rfbi_transfer_stop(s);
+         break;
+ 
+     case 0x5c:	/* RFBI_STATUS */
+         if ((s->rfbi.control & (1 << 2)) && s->rfbi.chip[0])
+-            s->rfbi.rxbuf = s->rfbi.chip[0]->read(s->rfbi.chip[0]->opaque, 0);
++	    s->rfbi.rxbuf = (*s->rfbi.chip[0]->read)(s->rfbi.chip[0]->opaque, 0);
+         else if ((s->rfbi.control & (1 << 3)) && s->rfbi.chip[1])
+-            s->rfbi.rxbuf = s->rfbi.chip[1]->read(s->rfbi.chip[1]->opaque, 0);
++	    s->rfbi.rxbuf = (*s->rfbi.chip[1]->read)(s->rfbi.chip[1]->opaque, 0);
+         if (!-- s->rfbi.pixels)
+             omap_rfbi_transfer_stop(s);
+         break;
diff --git a/triforceafl/patches/patch-qemu__mode_qemu_hw_net_etraxfs__eth.c b/triforceafl/patches/patch-qemu__mode_qemu_hw_net_etraxfs__eth.c
new file mode 100644
index 0000000000..030aea95e4
--- /dev/null
+++ b/triforceafl/patches/patch-qemu__mode_qemu_hw_net_etraxfs__eth.c
@@ -0,0 +1,25 @@
+$NetBSD$
+
+Avoid conflicts with SSP read() macro in NetBSD's <ssp/unistd.h>
+(PR lib/43832: ssp causes common names to be defines)
+
+--- qemu_mode/qemu/hw/net/etraxfs_eth.c.orig	2017-05-31 22:53:05.000000000 +0000
++++ qemu_mode/qemu/hw/net/etraxfs_eth.c
+@@ -185,7 +185,7 @@ static void mdio_read_req(struct qemu_md
+ 
+     phy = bus->devs[bus->addr];
+     if (phy && phy->read) {
+-        bus->data = phy->read(phy, bus->req);
++	bus->data = (*phy->read)(phy, bus->req);
+     } else {
+         bus->data = 0xffff;
+     }
+@@ -364,7 +364,7 @@ static void eth_validate_duplex(ETRAXFSE
+     int new_mm = 0;
+ 
+     phy = eth->mdio_bus.devs[eth->phyaddr];
+-    phy_duplex = !!(phy->read(phy, 18) & (1 << 11));
++    phy_duplex = !!((*phy->read)(phy, 18) & (1 << 11));
+     mac_duplex = !!(eth->regs[RW_REC_CTRL] & 128);
+ 
+     if (mac_duplex != phy_duplex) {
diff --git a/triforceafl/patches/patch-qemu__mode_qemu_hw_net_xilinx__axienet.c b/triforceafl/patches/patch-qemu__mode_qemu_hw_net_xilinx__axienet.c
new file mode 100644
index 0000000000..73d5c7053b
--- /dev/null
+++ b/triforceafl/patches/patch-qemu__mode_qemu_hw_net_xilinx__axienet.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Avoid conflicts with SSP read() macro in NetBSD's <ssp/unistd.h>
+(PR lib/43832: ssp causes common names to be defines)
+
+--- qemu_mode/qemu/hw/net/xilinx_axienet.c.orig	2017-05-31 22:53:05.000000000 +0000
++++ qemu_mode/qemu/hw/net/xilinx_axienet.c
+@@ -210,7 +210,7 @@ static uint16_t mdio_read_req(struct MDI
+ 
+     phy = bus->devs[addr];
+     if (phy && phy->read) {
+-        data = phy->read(phy, reg);
++        data = (*phy->read)(phy, reg);
+     } else {
+         data = 0xffff;
+     }
diff --git a/triforceafl/patches/patch-qemu__mode_qemu_hw_ppc_mac__newworld.c b/triforceafl/patches/patch-qemu__mode_qemu_hw_ppc_mac__newworld.c
new file mode 100644
index 0000000000..50108caa28
--- /dev/null
+++ b/triforceafl/patches/patch-qemu__mode_qemu_hw_ppc_mac__newworld.c
@@ -0,0 +1,38 @@
+$NetBSD$
+
+Avoid conflicts with round_page() macro in DragonFly's <cpu/param.h>
+
+--- qemu_mode/qemu/hw/ppc/mac_newworld.c.orig	2017-05-31 22:53:05.000000000 +0000
++++ qemu_mode/qemu/hw/ppc/mac_newworld.c
+@@ -127,7 +127,7 @@ static uint64_t translate_kernel_address
+     return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR;
+ }
+ 
+-static hwaddr round_page(hwaddr addr)
++static hwaddr round_pageq(hwaddr addr)
+ {
+     return (addr + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
+ }
+@@ -257,7 +257,7 @@ static void ppc_core99_init(MachineState
+         }
+         /* load initrd */
+         if (initrd_filename) {
+-            initrd_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
++            initrd_base = round_pageq(kernel_base + kernel_size + KERNEL_GAP);
+             initrd_size = load_image_targphys(initrd_filename, initrd_base,
+                                               ram_size - initrd_base);
+             if (initrd_size < 0) {
+@@ -265,11 +265,11 @@ static void ppc_core99_init(MachineState
+                          initrd_filename);
+                 exit(1);
+             }
+-            cmdline_base = round_page(initrd_base + initrd_size);
++            cmdline_base = round_pageq(initrd_base + initrd_size);
+         } else {
+             initrd_base = 0;
+             initrd_size = 0;
+-            cmdline_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
++            cmdline_base = round_pageq(kernel_base + kernel_size + KERNEL_GAP);
+         }
+         ppc_boot_device = 'm';
+     } else {
diff --git a/triforceafl/patches/patch-qemu__mode_qemu_hw_ppc_mac__oldworld.c b/triforceafl/patches/patch-qemu__mode_qemu_hw_ppc_mac__oldworld.c
new file mode 100644
index 0000000000..9406081b54
--- /dev/null
+++ b/triforceafl/patches/patch-qemu__mode_qemu_hw_ppc_mac__oldworld.c
@@ -0,0 +1,38 @@
+$NetBSD$
+
+Avoid conflicts with round_page() macro in DragonFly's <cpu/param.h>
+
+--- qemu_mode/qemu/hw/ppc/mac_oldworld.c.orig	2017-05-31 22:53:05.000000000 +0000
++++ qemu_mode/qemu/hw/ppc/mac_oldworld.c
+@@ -60,7 +60,7 @@ static uint64_t translate_kernel_address
+     return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR;
+ }
+ 
+-static hwaddr round_page(hwaddr addr)
++static hwaddr round_pageq(hwaddr addr)
+ {
+     return (addr + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
+ }
+@@ -185,7 +185,7 @@ static void ppc_heathrow_init(MachineSta
+         }
+         /* load initrd */
+         if (initrd_filename) {
+-            initrd_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
++            initrd_base = round_pageq(kernel_base + kernel_size + KERNEL_GAP);
+             initrd_size = load_image_targphys(initrd_filename, initrd_base,
+                                               ram_size - initrd_base);
+             if (initrd_size < 0) {
+@@ -193,11 +193,11 @@ static void ppc_heathrow_init(MachineSta
+                          initrd_filename);
+                 exit(1);
+             }
+-            cmdline_base = round_page(initrd_base + initrd_size);
++            cmdline_base = round_pageq(initrd_base + initrd_size);
+         } else {
+             initrd_base = 0;
+             initrd_size = 0;
+-            cmdline_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
++            cmdline_base = round_pageq(kernel_base + kernel_size + KERNEL_GAP);
+         }
+         ppc_boot_device = 'm';
+     } else {
diff --git a/triforceafl/patches/patch-qemu__mode_qemu_memory.c b/triforceafl/patches/patch-qemu__mode_qemu_memory.c
new file mode 100644
index 0000000000..e3c0b775a1
--- /dev/null
+++ b/triforceafl/patches/patch-qemu__mode_qemu_memory.c
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Imported patch from qemu-2.3.0
+
+--- qemu_mode/qemu/memory.c.orig	2017-05-31 22:53:05.000000000 +0000
++++ qemu_mode/qemu/memory.c
+@@ -394,7 +394,7 @@ static void memory_region_read_accessor(
+     if (mr->flush_coalesced_mmio) {
+         qemu_flush_coalesced_mmio_buffer();
+     }
+-    tmp = mr->ops->read(mr->opaque, addr, size);
++    tmp = (*mr->ops->read)(mr->opaque, addr, size);
+     trace_memory_region_ops_read(mr, addr, tmp, size);
+     *value |= (tmp & mask) << shift;
+ }
diff --git a/triforceafl/patches/patch-qemu__mode_qemu_slirp_tcp__subr.c b/triforceafl/patches/patch-qemu__mode_qemu_slirp_tcp__subr.c
new file mode 100644
index 0000000000..0daf28f2b2
--- /dev/null
+++ b/triforceafl/patches/patch-qemu__mode_qemu_slirp_tcp__subr.c
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Imported patch from qemu-2.3.0
+
+--- qemu_mode/qemu/slirp/tcp_subr.c.orig	2017-05-31 22:53:05.000000000 +0000
++++ qemu_mode/qemu/slirp/tcp_subr.c
+@@ -340,6 +340,8 @@ int tcp_fconnect(struct socket *so)
+     socket_set_fast_reuse(s);
+     opt = 1;
+     qemu_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(opt));
++    opt = 1;
++    qemu_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
+ 
+     addr.sin_family = AF_INET;
+     if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) ==
diff --git a/triforceafl/patches/patch-qemu__mode_qemu_tests_Makefile b/triforceafl/patches/patch-qemu__mode_qemu_tests_Makefile
new file mode 100644
index 0000000000..a8c6d32341
--- /dev/null
+++ b/triforceafl/patches/patch-qemu__mode_qemu_tests_Makefile
@@ -0,0 +1,17 @@
+$NetBSD$
+
+Don't link -lutil on SunOS
+
+--- qemu_mode/qemu/tests/Makefile.orig	2017-05-31 22:53:05.000000000 +0000
++++ qemu_mode/qemu/tests/Makefile
+@@ -371,8 +371,10 @@ tests/test-qemu-opts$(EXESUF): tests/tes
+ tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(block-obj-y) libqemuutil.a libqemustub.a
+ 
+ ifeq ($(CONFIG_POSIX),y)
++ifneq ($(CONFIG_SOLARIS),y)
+ LIBS += -lutil
+ endif
++endif
+ 
+ # QTest rules
+ 


Home | Main Index | Thread Index | Old Index