Friday, March 26, 2021

Re: UPDATE: QEMU 5.2.0

On 2021/03/26 12:26, Moritz Buhl wrote:
> Hi ports@,
>
> Thanks for updating to QEMU 5.2.0 this should fix the following CVE:

not really much need to list all of these in full, there are and always
will be bugs

> Currently the patch to update the version number does not apply as the
> changes suggested by Landry were implemented for 5.1.0.

easy enough to rebase it:

Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/qemu/Makefile,v
retrieving revision 1.206
diff -u -p -r1.206 Makefile
--- Makefile 28 Feb 2021 18:38:41 -0000 1.206
+++ Makefile 26 Mar 2021 12:22:29 -0000
@@ -6,11 +6,10 @@ DPB_PROPERTIES= parallel
COMMENT-main= multi system emulator
COMMENT-ga= QEMU guest agent

-VERSION= 5.1.0
-DISTNAME= qemu-5.1.0
+VERSION= 5.2.0
+DISTNAME= qemu-${VERSION}
PKGNAME-main= qemu-${VERSION}
PKGNAME-ga= qemu-ga-${VERSION}
-REVISION-main= 3
CATEGORIES= emulators
MASTER_SITES= https://download.qemu.org/
EXTRACT_SUFX= .tar.xz
@@ -39,6 +38,7 @@ MODULES= lang/python
MODPY_RUNDEP= No

BUILD_DEPENDS= devel/gettext,-tools \
+ devel/ninja \
textproc/py-sphinx${MODPY_FLAVOR}>=3.5.1

RUN_DEPENDS-main= ${BUILD_PKGPATH}-ga
@@ -50,7 +50,6 @@ LIB_DEPENDS-main= ${LIB_DEPENDS} \
archivers/zstd \
converters/libiconv \
devel/capstone/main \
- devel/dtc \
devel/libiscsi \
devel/libnfs \
devel/libusb1 \
@@ -73,9 +72,6 @@ FAKE_FLAGS= qemu_confdir=${PREFIX}/share
EXTRA_CFLAGS= -I${LOCALBASE}/include -I${X11BASE}/include
EXTRA_LDFLAGS= -L${LOCALBASE}/lib -L${X11BASE}/lib

-# fix build with ancient ncurses. ncurses needs to be updated to 5.9 or newer.
-EXTRA_CFLAGS+= -D_XOPEN_SOURCE_EXTENDED
-
# until the system headers are fixed properly.
EXTRA_CFLAGS+= -Wno-redundant-decls

@@ -94,7 +90,6 @@ CONFIGURE_ARGS= --prefix=${PREFIX} \
--extra-ldflags="${EXTRA_LDFLAGS}" \
--disable-bsd-user \
--enable-capstone=system \
- --enable-curses \
--disable-auth-pam \
--disable-gcrypt \
--disable-sdl-image \
Index: distinfo
===================================================================
RCS file: /cvs/ports/emulators/qemu/distinfo,v
retrieving revision 1.62
diff -u -p -r1.62 distinfo
--- distinfo 17 Aug 2020 09:58:44 -0000 1.62
+++ distinfo 26 Mar 2021 12:22:29 -0000
@@ -1,2 +1,2 @@
-SHA256 (qemu-5.1.0.tar.xz) = yRdOtZM9nrXmH1Qc1tEYTNMRjf5MXElVvBvcTTkPpOU=
-SIZE (qemu-5.1.0.tar.xz) = 62911540
+SHA256 (qemu-5.2.0.tar.xz) = yxjYibYo++Y3ZysDJnidmw47gCfgRFuTZTfHhUnfF7w=
+SIZE (qemu-5.2.0.tar.xz) = 106902800
Index: patches/patch-audio_Makefile_objs
===================================================================
RCS file: patches/patch-audio_Makefile_objs
diff -N patches/patch-audio_Makefile_objs
--- patches/patch-audio_Makefile_objs 17 Aug 2020 09:58:44 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-$OpenBSD: patch-audio_Makefile_objs,v 1.3 2020/08/17 09:58:44 sthen Exp $
-
-sndio module
-
-Index: audio/Makefile.objs
---- audio/Makefile.objs.orig
-+++ audio/Makefile.objs
-@@ -29,6 +29,11 @@ sdl.mo-objs = sdlaudio.o
- sdl.mo-cflags := $(SDL_CFLAGS)
- sdl.mo-libs := $(SDL_LIBS)
-
-+# sndio module
-+common-obj-$(CONFIG_AUDIO_SNDIO) += sndio.mo
-+sndio.mo-objs = sndioaudio.o
-+sndio.mo-libs := $(SNDIO_LIBS)
-+
- # jack module
- common-obj-$(CONFIG_AUDIO_JACK) += jack.mo
- jack.mo-objs = jackaudio.o
Index: patches/patch-audio_audio_c
===================================================================
RCS file: /cvs/ports/emulators/qemu/patches/patch-audio_audio_c,v
retrieving revision 1.8
diff -u -p -r1.8 patch-audio_audio_c
--- patches/patch-audio_audio_c 17 Aug 2020 09:58:44 -0000 1.8
+++ patches/patch-audio_audio_c 26 Mar 2021 12:22:29 -0000
@@ -3,7 +3,7 @@ $OpenBSD: patch-audio_audio_c,v 1.8 2020
Index: audio/audio.c
--- audio/audio.c.orig
+++ audio/audio.c
-@@ -1973,6 +1973,7 @@ void audio_create_pdos(Audiodev *dev)
+@@ -2027,6 +2027,7 @@ void audio_create_pdos(Audiodev *dev)
CASE(OSS, oss, Oss);
CASE(PA, pa, Pa);
CASE(SDL, sdl, );
Index: patches/patch-audio_meson_build
===================================================================
RCS file: patches/patch-audio_meson_build
diff -N patches/patch-audio_meson_build
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-audio_meson_build 26 Mar 2021 12:22:29 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+sndio module
+
+Index: audio/meson.build
+--- audio/meson.build.orig
++++ audio/meson.build
+@@ -17,6 +17,7 @@ foreach m : [
+ ['CONFIG_AUDIO_OSS', 'oss', oss, 'ossaudio.c'],
+ ['CONFIG_AUDIO_PA', 'pa', pulse, 'paaudio.c'],
+ ['CONFIG_AUDIO_SDL', 'sdl', sdl, 'sdlaudio.c'],
++ ['CONFIG_AUDIO_SNDIO', 'sndio', sndio, 'sndioaudio.c'],
+ ['CONFIG_AUDIO_JACK', 'jack', jack, 'jackaudio.c'],
+ ['CONFIG_SPICE', 'spice', spice, 'spiceaudio.c']
+ ]
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/emulators/qemu/patches/patch-configure,v
retrieving revision 1.66
diff -u -p -r1.66 patch-configure
--- patches/patch-configure 17 Aug 2020 09:58:44 -0000 1.66
+++ patches/patch-configure 26 Mar 2021 12:22:29 -0000
@@ -5,7 +5,7 @@ sndio module
Index: configure
--- configure.orig
+++ configure
-@@ -857,8 +857,8 @@ NetBSD)
+@@ -756,8 +756,8 @@ NetBSD)
OpenBSD)
bsd="yes"
make="${MAKE-gmake}"
@@ -13,10 +13,10 @@ Index: configure
- audio_possible_drivers="sdl"
+ audio_drv_list="sndio"
+ audio_possible_drivers="sndio"
- HOST_VARIANT_DIR="openbsd"
- supported_os="yes"
;;
-@@ -3690,6 +3690,24 @@ fi
+ Darwin)
+ bsd="yes"
+@@ -3328,6 +3328,24 @@ fi
##########################################
# Sound support libraries probe

@@ -41,7 +41,7 @@ Index: configure
audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g')
for drv in $audio_drv_list; do
case $drv in
-@@ -3739,6 +3757,23 @@ for drv in $audio_drv_list; do
+@@ -3381,6 +3399,23 @@ for drv in $audio_drv_list; do
fi
;;

@@ -65,31 +65,19 @@ Index: configure
coreaudio)
coreaudio_libs="-framework CoreAudio"
;;
-@@ -6524,10 +6559,6 @@ write_c_skeleton
+@@ -5667,7 +5702,6 @@ write_c_skeleton
if test "$gcov" = "yes" ; then
- QEMU_CFLAGS="-fprofile-arcs -ftest-coverage -g $QEMU_CFLAGS"
- QEMU_LDFLAGS="-fprofile-arcs -ftest-coverage $QEMU_LDFLAGS"
--elif test "$fortify_source" = "yes" ; then
-- CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
--elif test "$debug" = "no"; then
-- CFLAGS="-O2 $CFLAGS"
+ :
+ elif test "$fortify_source" = "yes" ; then
+- QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
+ debug=no
fi

- if test "$have_asan" = "yes"; then
-@@ -7182,7 +7213,7 @@ echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config
- for drv in $audio_drv_list; do
- def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
- case "$drv" in
-- alsa | oss | pa | sdl)
-+ alsa | oss | pa | sdl | sndio)
- echo "$def=m" >> $config_host_mak ;;
- *)
- echo "$def=y" >> $config_host_mak ;;
-@@ -7193,6 +7224,7 @@ echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak
+@@ -6028,6 +6062,7 @@ echo "PULSE_CFLAGS=$pulse_cflags" >> $config_host_mak
echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak
echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak
echo "OSS_LIBS=$oss_libs" >> $config_host_mak
+echo "SNDIO_LIBS=$sndio_libs" >> $config_host_mak
- echo "JACK_LIBS=$jack_libs" >> $config_host_mak
- if test "$audio_win_int" = "yes" ; then
- echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
+ if test "$libjack" = "yes" ; then
+ echo "CONFIG_LIBJACK=y" >> $config_host_mak
+ fi
Index: patches/patch-hw_hppa_lasi_c
===================================================================
RCS file: patches/patch-hw_hppa_lasi_c
diff -N patches/patch-hw_hppa_lasi_c
--- patches/patch-hw_hppa_lasi_c 7 Oct 2020 19:55:57 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,33 +0,0 @@
-$OpenBSD: patch-hw_hppa_lasi_c,v 1.1 2020/10/07 19:55:57 cwen Exp $
-
-From upstream commit b899fe41:
-
-OpenBSD initializes the LASI IMR value with 0xffffffff to disable all LASI
-interrupts. This triggered an assert() and stopped the emulation. By replacing
-the check with a warning in the guest log we now allow OpenBSD to boot again.
-
-Index: hw/hppa/lasi.c
---- hw/hppa/lasi.c.orig
-+++ hw/hppa/lasi.c
-@@ -11,6 +11,7 @@
-
- #include "qemu/osdep.h"
- #include "qemu/units.h"
-+#include "qemu/log.h"
- #include "qapi/error.h"
- #include "cpu.h"
- #include "trace.h"
-@@ -172,8 +173,11 @@ static MemTxResult lasi_chip_write_with_attrs(void *op
- /* read-only. */
- break;
- case LASI_IMR:
-- s->imr = val; /* 0x20 ?? */
-- assert((val & LASI_IRQ_BITS) == val);
-+ s->imr = val;
-+ if (((val & LASI_IRQ_BITS) != val) && (val != 0xffffffff))
-+ qemu_log_mask(LOG_GUEST_ERROR,
-+ "LASI: tried to set invalid %lx IMR value.\n",
-+ (unsigned long) val);
- break;
- case LASI_IPR:
- /* Any write to IPR clears the register. */
Index: patches/patch-meson_build
===================================================================
RCS file: patches/patch-meson_build
diff -N patches/patch-meson_build
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-meson_build 26 Mar 2021 12:22:29 -0000
@@ -0,0 +1,28 @@
+$OpenBSD$
+
+- Fix curses build on OpenBSD
+- sndio module
+
+Index: meson.build
+--- meson.build.orig
++++ meson.build
+@@ -509,7 +509,7 @@ if have_system and not get_option('curses').disabled()
+ endif
+ endif
+ if not curses.found()
+- curses_compile_args = ['-DNCURSES_WIDECHAR']
++ curses_compile_args = ['-D_XOPEN_SOURCE_EXTENDED -DNCURSES_WIDECHAR']
+ has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
+ if targetos != 'windows' and not has_curses_h
+ message('Trying with /usr/include/ncursesw')
+@@ -621,6 +621,10 @@ endif
+ dsound = not_found
+ if 'CONFIG_AUDIO_DSOUND' in config_host
+ dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split())
++endif
++sndio = not_found
++if 'CONFIG_AUDIO_SNDIO' in config_host
++ sndio = declare_dependency(link_args: config_host['SNDIO_LIBS'].split())
+ endif
+ coreaudio = not_found
+ if 'CONFIG_AUDIO_COREAUDIO' in config_host
Index: patches/patch-qapi_audio_json
===================================================================
RCS file: /cvs/ports/emulators/qemu/patches/patch-qapi_audio_json,v
retrieving revision 1.4
diff -u -p -r1.4 patch-qapi_audio_json
--- patches/patch-qapi_audio_json 17 Aug 2020 09:58:44 -0000 1.4
+++ patches/patch-qapi_audio_json 26 Mar 2021 12:22:29 -0000
@@ -3,7 +3,7 @@ $OpenBSD: patch-qapi_audio_json,v 1.4 20
Index: qapi/audio.json
--- qapi/audio.json.orig
+++ qapi/audio.json
-@@ -102,6 +102,28 @@
+@@ -106,6 +106,28 @@
'*threshold': 'uint32' } }

##
@@ -32,7 +32,7 @@ Index: qapi/audio.json
# @AudiodevCoreaudioPerDirectionOptions:
#
# Options of the Core Audio backend that are used for both playback and
-@@ -352,7 +374,7 @@
+@@ -356,7 +378,7 @@
##
{ 'enum': 'AudiodevDriver',
'data': [ 'none', 'alsa', 'coreaudio', 'dsound', 'jack', 'oss', 'pa',
@@ -41,7 +41,7 @@ Index: qapi/audio.json

##
# @Audiodev:
-@@ -382,5 +404,6 @@
+@@ -386,5 +408,6 @@
'oss': 'AudiodevOssOptions',
'pa': 'AudiodevPaOptions',
'sdl': 'AudiodevGenericOptions',
Index: patches/patch-qemu-options_hx
===================================================================
RCS file: /cvs/ports/emulators/qemu/patches/patch-qemu-options_hx,v
retrieving revision 1.7
diff -u -p -r1.7 patch-qemu-options_hx
--- patches/patch-qemu-options_hx 17 Aug 2020 09:58:44 -0000 1.7
+++ patches/patch-qemu-options_hx 26 Mar 2021 12:22:29 -0000
@@ -3,7 +3,7 @@ $OpenBSD: patch-qemu-options_hx,v 1.7 20
Index: qemu-options.hx
--- qemu-options.hx.orig
+++ qemu-options.hx
-@@ -590,6 +590,9 @@ DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev,
+@@ -582,6 +582,9 @@ DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev,
#ifdef CONFIG_AUDIO_SDL
"-audiodev sdl,id=id[,prop[=value][,...]]\n"

No comments:

Post a Comment