diff -Nru virtualbox-hwe-5.2.32-dfsg/Config.kmk virtualbox-hwe-5.2.34-dfsg/Config.kmk --- virtualbox-hwe-5.2.32-dfsg/Config.kmk 2019-07-12 08:42:10.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/Config.kmk 2019-10-10 18:06:26.000000000 +0000 @@ -6257,7 +6257,7 @@ TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \ -g $(VBOX_GCC_pipe) $(filter-out -Wno-unused,$(VBOX_GCC_WARN)) -frtti -fno-exceptions \ -Wno-long-long -fshort-wchar -fno-strict-aliasing \ - $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_Wno-ignored-qualifiers) \ + $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_Wno-multistatement-macros) $(VBOX_GCC_Wno-ignored-qualifiers) \ $(VBOX_GCC_Wno-return-type-c-linkage) $(VBOX_GCC_std) $(VBOX_GCC_IPRT_FMT_CHECK) ifdef VBOX_WITH_NO_GCC_WARNING_POLICY TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += $(VBOX_GCC_WERR) @@ -7279,7 +7279,7 @@ SVN ?= svn$(HOSTSUFF_EXE) VBOX_SVN_REV_KMK = $(PATH_OUT)/revision.kmk ifndef VBOX_SVN_REV - VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 132056 $ ) + VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 133883 $ ) VBOX_SVN_DEP := $(firstword $(wildcard $(PATH_ROOT)/.svn/wc.db $(abspath $(PATH_ROOT)/../.svn/wc.db) $(abspath $(PATH_ROOT)/../../.svn/wc.db) $(PATH_ROOT)/.svn/entries)) ifeq ($(which $(SVN)),) VBOX_SVN_DEP := diff -Nru virtualbox-hwe-5.2.32-dfsg/configure virtualbox-hwe-5.2.34-dfsg/configure --- virtualbox-hwe-5.2.32-dfsg/configure 2019-07-12 08:42:10.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/configure 2019-10-10 18:06:26.000000000 +0000 @@ -241,6 +241,11 @@ echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g' } +L_to_PATH() +{ + echo "$1"|$KBUILD_SED 's|-L\([^ ]\+\)|\1|g; s|^-[^L][^ ]*||g; s| -[^L][^ ]*||g; s|^ ||; s| *$||g; s| |:|g' +} + strip_I() { echo "$1"|$KBUILD_SED 's|-I\([^ ]\+\)|\1|g; s|^-[^I][^ ]*||g; s| -[^I][^ ]*||g; s|^ ||; s| *$||g' @@ -1512,7 +1517,7 @@ TOOLQT5=`pkg-config Qt5Core --variable=prefix` TOOLQT5BIN=`pkg-config Qt5Core --variable=host_bins` if test_compile "$LIBQT5 $LIBPTHREAD $FLGQT5" qt5 qt5 nofatal; then - test_execute_path "`strip_L "$LIBQT5"`" nofatal && foundqt5=3 # pkg-config + test_execute_path "`L_to_PATH "$LIBQT5"`" nofatal && foundqt5=3 # pkg-config fi fi else @@ -1530,13 +1535,13 @@ LIBQT5="-L$q/lib -lQt5CoreVBox" TOOLQT5="$q" if test_compile "$LIBQT5 $LIBPTHREAD $I_INCQT5 $FLGQT5" qt5 qt5 nofatal && - test_execute_path "`strip_L "$LIBQT5"`" nofatal; then + test_execute_path "`L_to_PATH "$LIBQT5"`" nofatal; then foundqt5=2 # internal break; fi LIBQT5="-L$q/lib -lQt5Core" if test_compile "$LIBQT5 $LIBPTHREAD $I_INCQT5 $FLGQT5" qt5 qt5 nofatal && - test_execute_path "`strip_L "$LIBQT5"`" nofatal; then + test_execute_path "`L_to_PATH "$LIBQT5"`" nofatal; then foundqt5=1 # no pkg-config, Qt directory break; fi @@ -1566,7 +1571,7 @@ EOF [ -n "$INCQT5" ] && I_INCQT5=`prefix_I "$INCQT5"` if test_compile "$LIBQT5 $LIBPTHREAD $I_INCQT5 $FLGQT5" qt5 qt5 nofatal; then - if test_execute_path "`strip_L "$LIBQT5"`"; then + if test_execute_path "`L_to_PATH "$LIBQT5"`"; then if [ "$OS" = "darwin" ]; then # Successful build & run the test application so add the necessary # params to AutoConfig.kmk: diff -Nru virtualbox-hwe-5.2.32-dfsg/debian/changelog virtualbox-hwe-5.2.34-dfsg/debian/changelog --- virtualbox-hwe-5.2.32-dfsg/debian/changelog 2019-07-13 13:53:11.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/debian/changelog 2019-10-23 15:55:25.000000000 +0000 @@ -1,3 +1,15 @@ +virtualbox-hwe (5.2.34-dfsg-0~ubuntu18.04.1) bionic; urgency=medium + + * SRU latest upstream release to bionic + + -- Gianfranco Costamagna Wed, 23 Oct 2019 17:55:25 +0200 + +virtualbox (5.2.34-dfsg-0~ubuntu18.04.1) bionic; urgency=medium + + * SRU the latest package for bionic (LP: #1847662) + + -- Gianfranco Costamagna Wed, 23 Oct 2019 15:26:08 +0200 + virtualbox-hwe (5.2.32-dfsg-0~ubuntu18.04.1) bionic; urgency=medium * SRU latest upstream release to bionic diff -Nru virtualbox-hwe-5.2.32-dfsg/debian/patches/01-build-arch.patch virtualbox-hwe-5.2.34-dfsg/debian/patches/01-build-arch.patch --- virtualbox-hwe-5.2.32-dfsg/debian/patches/01-build-arch.patch 2019-07-13 13:53:11.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/debian/patches/01-build-arch.patch 2019-10-23 15:55:06.000000000 +0000 @@ -5,7 +5,7 @@ =================================================================== --- virtualbox.orig/configure 2013-11-19 03:40:50.133475296 -0500 +++ virtualbox/configure 2013-11-19 03:40:50.129475296 -0500 -@@ -349,7 +349,7 @@ +@@ -354,7 +354,7 @@ check_environment() { test_header environment diff -Nru virtualbox-hwe-5.2.32-dfsg/debian/patches/37-python-3.7-support.patch virtualbox-hwe-5.2.34-dfsg/debian/patches/37-python-3.7-support.patch --- virtualbox-hwe-5.2.32-dfsg/debian/patches/37-python-3.7-support.patch 2019-07-13 13:53:11.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/debian/patches/37-python-3.7-support.patch 2019-10-23 15:55:06.000000000 +0000 @@ -6,7 +6,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/configure +++ b/configure -@@ -1963,7 +1963,7 @@ +@@ -1968,7 +1968,7 @@ } EOF found= diff -Nru virtualbox-hwe-5.2.32-dfsg/debian/patches/python3.7-fix.patch virtualbox-hwe-5.2.34-dfsg/debian/patches/python3.7-fix.patch --- virtualbox-hwe-5.2.32-dfsg/debian/patches/python3.7-fix.patch 2019-07-13 13:53:11.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/debian/patches/python3.7-fix.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Origin: upstream ---- virtualbox-5.2.14-dfsg.orig/src/libs/xpcom18a4/python/src/ErrorUtils.cpp -+++ virtualbox-5.2.14-dfsg/src/libs/xpcom18a4/python/src/ErrorUtils.cpp -@@ -440,7 +440,7 @@ char *PyTraceback_AsString(PyObject *exc - #if PY_MAJOR_VERSION <= 2 - char *tempResult = PyString_AsString(obResult); - #else -- char *tempResult = PyUnicode_AsUTF8(obResult); -+ const char *tempResult = (const char *)PyUnicode_AsUTF8(obResult); - #endif - result = (char *)PyMem_Malloc(strlen(tempResult)+1); - if (result==NULL) diff -Nru virtualbox-hwe-5.2.32-dfsg/debian/patches/series virtualbox-hwe-5.2.34-dfsg/debian/patches/series --- virtualbox-hwe-5.2.32-dfsg/debian/patches/series 2019-07-13 13:53:11.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/debian/patches/series 2019-10-23 15:55:06.000000000 +0000 @@ -14,7 +14,6 @@ 35-libvdeplug-soname.patch 36-fix-vnc-version-string.patch 37-python-3.7-support.patch -python3.7-fix.patch do-not-run-if-not-in-vm.patch java11.patch java11-upstream.patch diff -Nru virtualbox-hwe-5.2.32-dfsg/debian/patches/ubuntu-0006-fixup-vboxvideo-module-include.patch virtualbox-hwe-5.2.34-dfsg/debian/patches/ubuntu-0006-fixup-vboxvideo-module-include.patch --- virtualbox-hwe-5.2.32-dfsg/debian/patches/ubuntu-0006-fixup-vboxvideo-module-include.patch 2019-07-13 13:53:11.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/debian/patches/ubuntu-0006-fixup-vboxvideo-module-include.patch 2019-10-23 15:55:06.000000000 +0000 @@ -24,8 +24,8 @@ MOD_OBJS = hgsmi_base.o \ modesetting.o vbox_drv.o vbox_fb.o vbox_irq.o vbox_main.o \ vbox_mode.o vbox_ttm.o vbva_base.o vbox_prime.o vbox_hgsmi.o --MOD_INCL = -I$(KBUILD_EXTMOD) -Iinclude/drm -+MOD_INCL = -I$(VBOXDRM_DIR) -Iinclude/drm +-MOD_INCL = -I$(KBUILD_EXTMOD) -I$(KERN_INCL)/drm ++MOD_INCL = -I$(VBOXDRM_DIR) -I$(KERN_INCL)/drm include $(obj)/Makefile.include.footer diff -Nru virtualbox-hwe-5.2.32-dfsg/doc/manual/en_US/user_AdvancedTopics.xml virtualbox-hwe-5.2.34-dfsg/doc/manual/en_US/user_AdvancedTopics.xml --- virtualbox-hwe-5.2.32-dfsg/doc/manual/en_US/user_AdvancedTopics.xml 2019-07-12 08:42:11.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/doc/manual/en_US/user_AdvancedTopics.xml 2019-10-10 18:06:27.000000000 +0000 @@ -3886,6 +3886,15 @@ limitation may be addressed in a future VirtualBox version. + + + The disk encryption feature can protect the content of the + disks configured for a VM only. It does not cover any other + data related to a VM, including saved state or the + configuration file itself. + + + diff -Nru virtualbox-hwe-5.2.32-dfsg/doc/manual/en_US/user_BasicConcepts.xml virtualbox-hwe-5.2.34-dfsg/doc/manual/en_US/user_BasicConcepts.xml --- virtualbox-hwe-5.2.32-dfsg/doc/manual/en_US/user_BasicConcepts.xml 2019-07-12 08:42:11.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/doc/manual/en_US/user_BasicConcepts.xml 2019-10-10 18:06:27.000000000 +0000 @@ -475,6 +475,36 @@ To insert a line break into the description text field, press Shift+Enter. + + + + Disk Encryption Tab + + + The Disk Encryption tab enables + you to encrypt disks that are attached to the virtual machine. + + + + To enable disk encryption, select the + Enable Disk Encryption check + box. + + + + Settings are available to configure the cipher used for + encryption and the encryption password. + + + + + All files related to the virtual machine except disk images are + stored unencrypted. + + + + + diff -Nru virtualbox-hwe-5.2.32-dfsg/doc/manual/en_US/user_Security.xml virtualbox-hwe-5.2.34-dfsg/doc/manual/en_US/user_Security.xml --- virtualbox-hwe-5.2.32-dfsg/doc/manual/en_US/user_Security.xml 2019-07-12 08:42:11.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/doc/manual/en_US/user_Security.xml 2019-10-10 18:06:27.000000000 +0000 @@ -380,7 +380,22 @@ provides a secure connection. Standard RDP Security (RDP4 and RDP5.1) is vulnerable to a man-in-the-middle attack. + + + + When using the VirtualBox Extension Pack provided by + Oracle for disk encryption, the data stored in disk images can + optionally be encrypted. See . + This feature covers disk image content only. All other data + for a virtual machine is stored unencrypted, including the VM's + memory and device state which is stored as part of a saved + state, both when created explicitly or part of a snapshot of a + running VM. + + + + diff -Nru virtualbox-hwe-5.2.32-dfsg/doc/manual/user_ChangeLogImpl.xml virtualbox-hwe-5.2.34-dfsg/doc/manual/user_ChangeLogImpl.xml --- virtualbox-hwe-5.2.32-dfsg/doc/manual/user_ChangeLogImpl.xml 2019-07-12 08:42:11.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/doc/manual/user_ChangeLogImpl.xml 2019-10-10 18:06:27.000000000 +0000 @@ -27,7 +27,102 @@ - + + + Version 5.2.33 (2019-xx-xx) + + This is a maintenance release. The following items were fixed and/or + added: + + + + + Virtualization core: some fixes for systems with lots of + processors + + + + Audio: relaxed VRM / VRA (variable rate audio) bit checks to + provide more compatibility for guests running ALSA setups with the + AC'97 emulation + + + + Audio: Fixed "double buffering" size of a stream's internal ring + buffer, adjusted logging). + + + + USB: made device capturing for passthrough more accurate and + reliable on Windows host + + + + Network: fixed potential issue with interrupt signalling for + network adapters in UEFI guests + + + + 3D: fixed crash with some applications when using VBoxSVGA or + VMSVGA graphics adapter (bug #18638) + + + + 3D: fixed state saving and loading when the VBoxVGA graphics + adapter is used with 3D enabled (bug #18802, 5.2.32 regression) + + + + Multiple fixes in 3D/Graphics including Chromium + + + + macOS host: fix crash of GUI VM process which showed up + frequently with 10.15 Catalina (bug #18990) + + + + Windows host: fixed crashes on startup with software trying to + inject code into a VM process + + + + Linux host: improve python version detection during rpm + package creation, can change package dependencies and fix some + installation problems + + + + VBoxManage: copyto --target-directory now requires an ending + slash for guests (bug #18724) + + + + Windows host installer: Fixes for access permissions for installed files + + + + Linux host and guest: fix kernel module build for SLES 12 SP4 kernel + + + + Windows guests: fixed mouse cursor visibility updating + + + + Linux guests: VBox Guest Additions fail to compile on Red + Hat/CentOS/OL 7.7 and Red Hat 8.1 Beta (bug #18917) + + + + Linux guests: improve compatibility of vboxvideo.ko kernel module + build logic (bug #18869) + + + + + + Version 5.2.32 (2019-07-16) diff -Nru virtualbox-hwe-5.2.32-dfsg/include/iprt/nt/nt.h virtualbox-hwe-5.2.34-dfsg/include/iprt/nt/nt.h --- virtualbox-hwe-5.2.32-dfsg/include/iprt/nt/nt.h 2019-07-12 08:42:19.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/include/iprt/nt/nt.h 2019-10-10 18:06:35.000000000 +0000 @@ -1518,6 +1518,8 @@ NTSYSAPI NTSTATUS NTAPI NtFlushVirtualMemory(HANDLE, PVOID *, PSIZE_T, PIO_STATUS_BLOCK); NTSYSAPI NTSTATUS NTAPI NtUnmapViewOfSection(HANDLE, PVOID); +NTSYSAPI NTSTATUS NTAPI NtTestAlert(void); + #ifdef IPRT_NT_USE_WINTERNL typedef struct _FILE_FS_ATTRIBUTE_INFORMATION { diff -Nru virtualbox-hwe-5.2.32-dfsg/include/VBox/sup.h virtualbox-hwe-5.2.34-dfsg/include/VBox/sup.h --- virtualbox-hwe-5.2.32-dfsg/include/VBox/sup.h 2019-07-12 08:42:14.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/include/VBox/sup.h 2019-10-10 18:06:30.000000000 +0000 @@ -1130,6 +1130,8 @@ /** The binary is located in the testcase directory instead of the * default application binary directory. */ #define SUPSECMAIN_FLAGS_LOC_TESTCASE UINT32_C(0x00000010) +/** The first process. */ +#define SUPSECMAIN_FLAGS_FIRST_PROCESS UINT32_C(0x00000020) /** @} */ /** diff -Nru virtualbox-hwe-5.2.32-dfsg/include/VBox/usblib-win.h virtualbox-hwe-5.2.34-dfsg/include/VBox/usblib-win.h --- virtualbox-hwe-5.2.32-dfsg/include/VBox/usblib-win.h 2019-07-12 08:42:14.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/include/VBox/usblib-win.h 2019-10-10 18:06:30.000000000 +0000 @@ -108,7 +108,7 @@ #define SUPUSBFLT_IOCTL_CAPTURE_DEVICE CTL_CODE(FILE_DEVICE_UNKNOWN, 0x613, METHOD_BUFFERED, FILE_WRITE_ACCESS) #define SUPUSBFLT_IOCTL_RELEASE_DEVICE CTL_CODE(FILE_DEVICE_UNKNOWN, 0x614, METHOD_BUFFERED, FILE_WRITE_ACCESS) #define SUPUSBFLT_IOCTL_RUN_FILTERS CTL_CODE(FILE_DEVICE_UNKNOWN, 0x615, METHOD_BUFFERED, FILE_WRITE_ACCESS) -#define SUPUSBFLT_IOCTL_SET_NOTIFY_EVENT CTL_CODE(FILE_DEVICE_UNKNOWN, 0x616, METHOD_BUFFERED, FILE_WRITE_ACCESS) +/* Used to be SUPUSBFLT_IOCTL_SET_NOTIFY_EVENT, 0x616 */ #define SUPUSBFLT_IOCTL_GET_DEVICE CTL_CODE(FILE_DEVICE_UNKNOWN, 0x617, METHOD_BUFFERED, FILE_WRITE_ACCESS) #pragma pack(4) diff -Nru virtualbox-hwe-5.2.32-dfsg/src/bldprogs/scmsubversion.cpp virtualbox-hwe-5.2.34-dfsg/src/bldprogs/scmsubversion.cpp --- virtualbox-hwe-5.2.32-dfsg/src/bldprogs/scmsubversion.cpp 2019-07-12 08:50:51.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/bldprogs/scmsubversion.cpp 2019-10-10 18:15:08.000000000 +0000 @@ -714,6 +714,13 @@ # else { "../lib/lib", ".so" }, { "../lib/lib", "-1.so" }, +# if ARCH_BITS == 32 + { "../lib32/lib", ".so" }, + { "../lib32/lib", "-1.so" }, +# else + { "../lib64/lib", ".so" }, + { "../lib64/lib", "-1.so" }, +# endif # ifdef RT_ARCH_X86 { "../lib/i386-linux-gnu/lib", ".so" }, { "../lib/i386-linux-gnu/lib", "-1.so" }, diff -Nru virtualbox-hwe-5.2.32-dfsg/src/libs/Makefile.kmk virtualbox-hwe-5.2.34-dfsg/src/libs/Makefile.kmk --- virtualbox-hwe-5.2.32-dfsg/src/libs/Makefile.kmk 2019-07-12 08:50:51.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/libs/Makefile.kmk 2019-10-10 18:15:08.000000000 +0000 @@ -54,7 +54,7 @@ if !defined(VBOX_ONLY_SDK) \ && ( "$(SDK_VBOX_OPENSSL_INCS)" == "$(SDK_VBOX_OPENSSL_VBOX_DEFAULT_INCS)" \ || defined(VBOX_WITH_EXTPACK_PUEL_BUILD)) - include $(PATH_SUB_CURRENT)/openssl-1.1.1c/Makefile.kmk + include $(PATH_SUB_CURRENT)/openssl-1.1.1d/Makefile.kmk endif # libjpeg for VRDP video redirection and ExtPack's DrvHostWebcam diff -Nru virtualbox-hwe-5.2.32-dfsg/src/libs/xpcom18a4/python/src/ErrorUtils.cpp virtualbox-hwe-5.2.34-dfsg/src/libs/xpcom18a4/python/src/ErrorUtils.cpp --- virtualbox-hwe-5.2.32-dfsg/src/libs/xpcom18a4/python/src/ErrorUtils.cpp 2019-07-12 08:51:25.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/libs/xpcom18a4/python/src/ErrorUtils.cpp 2019-10-10 18:15:42.000000000 +0000 @@ -440,7 +440,8 @@ #if PY_MAJOR_VERSION <= 2 char *tempResult = PyString_AsString(obResult); #else - char *tempResult = PyUnicode_AsUTF8(obResult); + /* PyUnicode_AsUTF8() is const char * as of Python 3.7, char * earlier. */ + const char *tempResult = (const char *)PyUnicode_AsUTF8(obResult); #endif result = (char *)PyMem_Malloc(strlen(tempResult)+1); if (result==NULL) diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/Makefile.module.kms virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/Makefile.module.kms --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/Makefile.module.kms 2019-07-12 08:42:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/Makefile.module.kms 2019-10-10 18:06:52.000000000 +0000 @@ -38,7 +38,7 @@ MOD_OBJS = hgsmi_base.o \ modesetting.o vbox_drv.o vbox_fb.o vbox_irq.o vbox_main.o \ vbox_mode.o vbox_ttm.o vbva_base.o vbox_prime.o vbox_hgsmi.o -MOD_INCL = -I$(KBUILD_EXTMOD) -Iinclude/drm +MOD_INCL = -I$(KBUILD_EXTMOD) -I$(KERN_INCL)/drm include $(obj)/Makefile.include.footer diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/vbox_drv.c virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/vbox_drv.c --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/vbox_drv.c 2019-07-12 08:42:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/vbox_drv.c 2019-10-10 18:06:52.000000000 +0000 @@ -46,7 +46,7 @@ int vbox_modeset = -1; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) || defined(RHEL_81) #include #endif @@ -260,7 +260,7 @@ static struct drm_driver driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ | -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) && !defined(RHEL_81) DRIVER_IRQ_SHARED | #endif DRIVER_PRIME, diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/vbox_drv.h virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/vbox_drv.h --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/vbox_drv.h 2019-07-12 08:42:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/vbox_drv.h 2019-10-10 18:06:52.000000000 +0000 @@ -49,6 +49,15 @@ #include #if defined(RHEL_MAJOR) && defined(RHEL_MINOR) +# if RHEL_MAJOR == 8 && RHEL_MINOR >= 1 +# define RHEL_81 +# endif +# if RHEL_MAJOR == 8 && RHEL_MINOR >= 0 +# define RHEL_80 +# endif +# if RHEL_MAJOR == 7 && RHEL_MINOR >= 7 +# define RHEL_77 +# endif # if RHEL_MAJOR == 7 && RHEL_MINOR >= 6 # define RHEL_76 # endif @@ -178,7 +187,7 @@ int fb_mtrr; struct { -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(RHEL_77) && !defined(RHEL_81) struct drm_global_reference mem_global_ref; struct ttm_bo_global_ref bo_global_ref; #endif diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/vbox_irq.c virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/vbox_irq.c --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/vbox_irq.c 2019-07-12 08:42:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/vbox_irq.c 2019-10-10 18:06:52.000000000 +0000 @@ -36,6 +36,9 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) #include +# if defined(RHEL_81) +# include +# endif #else #include #endif diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/vbox_main.c virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/vbox_main.c --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/vbox_main.c 2019-07-12 08:42:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/vbox_main.c 2019-10-10 18:06:52.000000000 +0000 @@ -587,7 +587,7 @@ } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0) && !defined(OPENSUSE_151) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0) && !defined(OPENSUSE_151) && !defined(RHEL_77) && !defined(RHEL_81) static void ttm_bo_put(struct ttm_buffer_object *bo) { ttm_bo_unref(&bo); diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/vbox_mode.c virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/vbox_mode.c --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/vbox_mode.c 2019-07-12 08:42:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/vbox_mode.c 2019-10-10 18:06:52.000000000 +0000 @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2013-2017 Oracle Corporation + * Copyright (C) 2013-2019 Oracle Corporation * This file is based on ast_mode.c * Copyright 2012 Red Hat Inc. * Parts based on xf86-video-ast @@ -42,7 +42,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_72) #include #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) || defined(RHEL_81) #include #endif @@ -176,15 +176,16 @@ if (single_framebuffer) { list_for_each_entry(crtci, &vbox->dev->mode_config.crtc_list, head) { - if (to_vbox_crtc(crtci)->crtc_id == 0) { - vbox->single_framebuffer = true; - vbox->input_mapping_width = - CRTC_FB(crtci)->width; - vbox->input_mapping_height = - CRTC_FB(crtci)->height; - return old_single_framebuffer != - vbox->single_framebuffer; - } + if (to_vbox_crtc(crtci)->crtc_id != 0) + continue; + + if (!CRTC_FB(crtci)) + break; + vbox->single_framebuffer = true; + vbox->input_mapping_width = CRTC_FB(crtci)->width; + vbox->input_mapping_height = CRTC_FB(crtci)->height; + return old_single_framebuffer != + vbox->single_framebuffer; } } /* Otherwise calculate the total span of all screens. */ @@ -496,7 +497,7 @@ for (i = 0; i < EDID_SIZE - 1; ++i) sum += edid[i]; edid[EDID_SIZE - 1] = (0x100 - (sum & 0xFF)) & 0xFF; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || defined(OPENSUSE_151) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || defined(OPENSUSE_151) || defined(RHEL_77) || defined(RHEL_81) drm_connector_update_edid_property(connector, (struct edid *)edid); #else drm_mode_connector_update_edid_property(connector, (struct edid *)edid); @@ -671,7 +672,7 @@ drm_connector_register(connector); #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || defined(OPENSUSE_151) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || defined(OPENSUSE_151) || defined(RHEL_77) || defined(RHEL_81) drm_connector_attach_encoder(connector, encoder); #else drm_mode_connector_attach_encoder(connector, encoder); diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/vbox_ttm.c virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/vbox_ttm.c --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Additions/linux/drm/vbox_ttm.c 2019-07-12 08:42:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Additions/linux/drm/vbox_ttm.c 2019-10-10 18:06:52.000000000 +0000 @@ -46,7 +46,7 @@ return container_of(bd, struct vbox_private, ttm.bdev); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(RHEL_77) && !defined(RHEL_81) static int vbox_ttm_mem_global_init(struct drm_global_reference *ref) { return ttm_mem_global_init(ref->object); @@ -297,13 +297,13 @@ struct drm_device *dev = vbox->dev; struct ttm_bo_device *bdev = &vbox->ttm.bdev; -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(RHEL_77) && !defined(RHEL_81) ret = vbox_ttm_global_init(vbox); if (ret) return ret; #endif ret = ttm_bo_device_init(&vbox->ttm.bdev, -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(RHEL_77) && !defined(RHEL_81) vbox->ttm.bo_global_ref.ref.object, #endif &vbox_bo_driver, @@ -349,7 +349,7 @@ return; ttm_bo_device_release(&vbox->ttm.bdev); -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && !defined(RHEL_77) && !defined(RHEL_81) vbox_ttm_global_release(vbox); #endif diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/AudioMixer.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/AudioMixer.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/AudioMixer.cpp 2019-07-12 08:45:14.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/AudioMixer.cpp 2019-10-10 18:09:31.000000000 +0000 @@ -134,14 +134,20 @@ char *pszFlags = NULL; int rc2 = VINF_SUCCESS; - do + if (fStatus == AUDMIXSINK_STS_NONE) /* This is special, as this is value 0. */ { - APPEND_FLAG_TO_STR(NONE); - APPEND_FLAG_TO_STR(RUNNING); - APPEND_FLAG_TO_STR(PENDING_DISABLE); - APPEND_FLAG_TO_STR(DIRTY); + rc2 = RTStrAAppend(&pszFlags, "NONE"); + } + else + { + do + { + APPEND_FLAG_TO_STR(RUNNING); + APPEND_FLAG_TO_STR(PENDING_DISABLE); + APPEND_FLAG_TO_STR(DIRTY); - } while (0); + } while (0); + } if ( RT_FAILURE(rc2) && pszFlags) @@ -1506,6 +1512,15 @@ LogFunc(("[%s] Recording source is now '%s', rc=%Rrc\n", pSink->pszName, pSink->In.pStreamRecSource ? pSink->In.pStreamRecSource->pszName : "", rc)); + if (RT_SUCCESS(rc)) + { + LogRel(("Mixer: Setting recording source of sink '%s' to '%s'\n", + pSink->pszName, pSink->In.pStreamRecSource ? pSink->In.pStreamRecSource->pszName : "")); + } + else + LogRel(("Mixer: Setting recording source of sink '%s' to '%s' failed with %Rrc\n", + pSink->pszName, pSink->In.pStreamRecSource ? pSink->In.pStreamRecSource->pszName : "", rc)); + return rc; } diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/DevHDACommon.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/DevHDACommon.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/DevHDACommon.cpp 2019-07-12 08:45:14.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/DevHDACommon.cpp 2019-10-10 18:09:31.000000000 +0000 @@ -22,6 +22,8 @@ #include #include +#include + #define LOG_GROUP LOG_GROUP_DEV_HDA #include @@ -264,7 +266,7 @@ if (uSD >= HDA_MAX_STREAMS) { - AssertMsgFailed(("Invalid / non-handled SD%RU8\n", uSD)); + ASSERT_GUEST_LOGREL_MSG_FAILED(("Stream #%RU8 is invalid\n", uSD)); return NULL; } diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/DevHDA.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/DevHDA.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/DevHDA.cpp 2019-07-12 08:45:14.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/DevHDA.cpp 2019-10-10 18:09:31.000000000 +0000 @@ -386,8 +386,8 @@ { offset + 0x4, 0x00004, 0xFFFFFFFF, 0x00000000, HDA_RD_FLAG_NONE, hdaRegReadLPIB, hdaRegWriteU32 , HDA_REG_IDX_STRM(name, LPIB) , #name " Link Position In Buffer" }, \ /* Offset 0x88 (SD0) */ \ { offset + 0x8, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteSDCBL , HDA_REG_IDX_STRM(name, CBL) , #name " Cyclic Buffer Length" }, \ - /* Offset 0x8C (SD0) */ \ - { offset + 0xC, 0x00002, 0x0000FFFF, 0x0000FFFF, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteSDLVI , HDA_REG_IDX_STRM(name, LVI) , #name " Last Valid Index" }, \ + /* Offset 0x8C (SD0) -- upper 8 bits are reserved */ \ + { offset + 0xC, 0x00002, 0x0000FFFF, 0x000000FF, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteSDLVI , HDA_REG_IDX_STRM(name, LVI) , #name " Last Valid Index" }, \ /* Reserved: FIFO Watermark. ** @todo Document this! */ \ { offset + 0xE, 0x00002, 0x00000007, 0x00000007, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteSDFIFOW, HDA_REG_IDX_STRM(name, FIFOW), #name " FIFO Watermark" }, \ /* Offset 0x90 (SD0) */ \ @@ -1305,13 +1305,18 @@ { LogFunc(("[SD%RU8] Warning: Invalid stream tag %RU8 specified!\n", uSD, uTag)); - int rc = hdaRegWriteU24(pThis, iReg, u32Value); DEVHDA_UNLOCK_BOTH(pThis, uSD); - return rc; + return VINF_SUCCESS; /* Always return success to the MMIO handler. */ } PHDASTREAM pStream = hdaGetStreamFromSD(pThis, uSD); - AssertPtr(pStream); + if (!pStream) + { + ASSERT_GUEST_LOGREL_MSG_FAILED(("Guest tried writing SDCTL (0x%x) to unhandled stream #%RU8\n", u32Value, uSD)); + + DEVHDA_UNLOCK_BOTH(pThis, uSD); + return VINF_SUCCESS; /* Always return success to the MMIO handler. */ + } if (fInReset) { @@ -1360,7 +1365,7 @@ hdaR3StreamLock(pStream); - int rc2; + int rc2 = VINF_SUCCESS; # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO if (fRun) @@ -1412,38 +1417,42 @@ } } - /* Enable/disable the stream. */ - rc2 = hdaR3StreamEnable(pStream, fRun /* fEnable */); - AssertRC(rc2); - - if (fRun) + if (RT_SUCCESS(rc2)) { - /* Keep track of running streams. */ - pThis->cStreamsActive++; + /* Enable/disable the stream. */ + rc2 = hdaR3StreamEnable(pStream, fRun /* fEnable */); + AssertRC(rc2); - /* (Re-)init the stream's period. */ - hdaR3StreamPeriodInit(&pStream->State.Period, - pStream->u8SD, pStream->u16LVI, pStream->u32CBL, &pStream->State.Cfg); + if (fRun) + { + /* Keep track of running streams. */ + pThis->cStreamsActive++; - /* Begin a new period for this stream. */ - rc2 = hdaR3StreamPeriodBegin(&pStream->State.Period, hdaWalClkGetCurrent(pThis)/* Use current wall clock time */); - AssertRC(rc2); + /* (Re-)init the stream's period. */ + hdaR3StreamPeriodInit(&pStream->State.Period, + pStream->u8SD, pStream->u16LVI, pStream->u32CBL, &pStream->State.Cfg); - rc2 = hdaR3TimerSet(pThis, pStream, TMTimerGet(pThis->pTimer[pStream->u8SD]) + pStream->State.cTransferTicks, false /* fForce */); - AssertRC(rc2); - } - else - { - /* Keep track of running streams. */ - Assert(pThis->cStreamsActive); - if (pThis->cStreamsActive) - pThis->cStreamsActive--; + /* Begin a new period for this stream. */ + rc2 = hdaR3StreamPeriodBegin(&pStream->State.Period, hdaWalClkGetCurrent(pThis)/* Use current wall clock time */); + AssertRC(rc2); - /* Make sure to (re-)schedule outstanding (delayed) interrupts. */ - hdaR3ReschedulePendingInterrupts(pThis); + rc2 = hdaR3TimerSet(pThis, pStream, TMTimerGet(pThis->pTimer[pStream->u8SD]) + pStream->State.cTransferTicks, + false /* fForce */); + AssertRC(rc2); + } + else + { + /* Keep track of running streams. */ + Assert(pThis->cStreamsActive); + if (pThis->cStreamsActive) + pThis->cStreamsActive--; + + /* Make sure to (re-)schedule outstanding (delayed) interrupts. */ + hdaR3ReschedulePendingInterrupts(pThis); - /* Reset the period. */ - hdaR3StreamPeriodReset(&pStream->State.Period); + /* Reset the period. */ + hdaR3StreamPeriodReset(&pStream->State.Period); + } } # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO @@ -1475,12 +1484,9 @@ PHDASTREAM pStream = hdaGetStreamFromSD(pThis, uSD); if (!pStream) { - AssertMsgFailed(("[SD%RU8] Warning: Writing SDSTS on non-attached stream (0x%x)\n", - HDA_SD_NUM_FROM_REG(pThis, STS, iReg), u32Value)); - - int rc = hdaRegWriteU16(pThis, iReg, u32Value); + ASSERT_GUEST_LOGREL_MSG_FAILED(("Guest tried writing SDSTS (0x%x) to unhandled stream #%RU8\n", u32Value, uSD)); DEVHDA_UNLOCK_BOTH(pThis, uSD); - return rc; + return VINF_SUCCESS; /* Always return success to the MMIO handler. */ } hdaR3StreamLock(pStream); @@ -1593,9 +1599,9 @@ { DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE); -#ifdef HDA_USE_DMA_ACCESS_HANDLER - uint8_t uSD = HDA_SD_NUM_FROM_REG(pThis, LVI, iReg); + const uint8_t uSD = HDA_SD_NUM_FROM_REG(pThis, LVI, iReg); +#ifdef HDA_USE_DMA_ACCESS_HANDLER if (hdaGetDirFromSD(uSD) == PDMAUDIODIR_OUT) { PHDASTREAM pStream = hdaGetStreamFromSD(pThis, uSD); @@ -1610,6 +1616,9 @@ } #endif + ASSERT_GUEST_LOGREL_MSG(u32Value <= UINT8_MAX, /* Should be covered by the register write mask, but just to make sure. */ + ("LVI for stream #%RU8 must not be bigger than %RU8\n", uSD, UINT8_MAX - 1)); + int rc2 = hdaRegWriteU16(pThis, iReg, u32Value); AssertRC(rc2); @@ -1638,11 +1647,8 @@ PHDASTREAM pStream = hdaGetStreamFromSD(pThis, HDA_SD_NUM_FROM_REG(pThis, FIFOW, iReg)); if (!pStream) { - AssertMsgFailed(("[SD%RU8] Warning: Changing FIFOW on non-attached stream (0x%x)\n", uSD, u32Value)); - - int rc = hdaRegWriteU16(pThis, iReg, u32Value); DEVHDA_UNLOCK(pThis); - return rc; + return VINF_SUCCESS; /* Always return success to the MMIO handler. */ } uint32_t u32FIFOW = 0; @@ -1655,7 +1661,7 @@ u32FIFOW = u32Value; break; default: - ASSERT_GUEST_LOGREL_MSG_FAILED(("Guest tried write unsupported FIFOW (0x%x) to stream #%RU8, defaulting to 32 bytes\n", + ASSERT_GUEST_LOGREL_MSG_FAILED(("Guest tried writing unsupported FIFOW (0x%x) to stream #%RU8, defaulting to 32 bytes\n", u32Value, uSD)); u32FIFOW = HDA_SDFIFOW_32B; break; @@ -1685,8 +1691,7 @@ if (hdaGetDirFromSD(uSD) != PDMAUDIODIR_OUT) /* FIFOS for output streams only. */ { - LogRel(("HDA: Warning: Guest tried to write read-only FIFOS to input stream #%RU8, ignoring\n", uSD)); - + ASSERT_GUEST_LOGREL_MSG_FAILED(("Guest tried writing read-only FIFOS to input stream #%RU8, ignoring\n", uSD)); DEVHDA_UNLOCK(pThis); return VINF_SUCCESS; } @@ -1705,7 +1710,7 @@ break; default: - ASSERT_GUEST_LOGREL_MSG_FAILED(("Guest tried write unsupported FIFOS (0x%x) to stream #%RU8, defaulting to 192 bytes\n", + ASSERT_GUEST_LOGREL_MSG_FAILED(("Guest tried writing unsupported FIFOS (0x%x) to stream #%RU8, defaulting to 192 bytes\n", u32Value, uSD)); u32FIFOS = HDA_SDOFIFO_192B; break; @@ -5411,4 +5416,3 @@ #endif /* IN_RING3 */ #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */ - diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/DevIchAc97.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/DevIchAc97.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/DevIchAc97.cpp 2019-07-12 08:45:14.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/DevIchAc97.cpp 2019-10-10 18:09:31.000000000 +0000 @@ -660,8 +660,8 @@ #ifdef IN_RING3 static int ichac97R3StreamCreate(PAC97STATE pThis, PAC97STREAM pStream, uint8_t u8Strm); static void ichac97R3StreamDestroy(PAC97STATE pThis, PAC97STREAM pStream); -static int ichac97R3StreamOpen(PAC97STATE pThis, PAC97STREAM pStream); -static int ichac97R3StreamReOpen(PAC97STATE pThis, PAC97STREAM pStream); +static int ichac97R3StreamOpen(PAC97STATE pThis, PAC97STREAM pStream, bool fForce); +static int ichac97R3StreamReOpen(PAC97STATE pThis, PAC97STREAM pStream, bool fForce); static int ichac97R3StreamClose(PAC97STATE pThis, PAC97STREAM pStream); static void ichac97R3StreamReset(PAC97STATE pThis, PAC97STREAM pStream); static void ichac97R3StreamLock(PAC97STREAM pStream); @@ -894,7 +894,7 @@ if (pStream->State.pCircBuf) RTCircBufReset(pStream->State.pCircBuf); - rc = ichac97R3StreamOpen(pThis, pStream); + rc = ichac97R3StreamOpen(pThis, pStream, false /* fForce */); if (pStream->Dbg.Runtime.fEnabled) { @@ -1633,6 +1633,10 @@ { AssertMsgReturnVoid(uMixerIdx + 2U <= sizeof(pThis->mixer_data), ("Index %RU8 out of bounds (%zu)\n", uMixerIdx, sizeof(pThis->mixer_data))); + + LogRel2(("AC97: Setting mixer index #%RU8 to %RU16 (%RU8 %RU8)\n", + uMixerIdx, uVal, RT_HI_U8(uVal), RT_LO_U8(uVal))); + pThis->mixer_data[uMixerIdx + 0] = RT_LO_U8(uVal); pThis->mixer_data[uMixerIdx + 1] = RT_HI_U8(uVal); } @@ -2008,8 +2012,10 @@ * @returns IPRT status code. * @param pThis AC'97 device state. * @param pStream AC'97 stream to open. + * @param fForce Whether to force re-opening the stream or not. + * Otherwise re-opening only will happen if the PCM properties have changed. */ -static int ichac97R3StreamOpen(PAC97STATE pThis, PAC97STREAM pStream) +static int ichac97R3StreamOpen(PAC97STATE pThis, PAC97STREAM pStream, bool fForce) { int rc = VINF_SUCCESS; @@ -2070,8 +2076,12 @@ { /* Only (re-)create the stream (and driver chain) if we really have to. * Otherwise avoid this and just reuse it, as this costs performance. */ - if (!DrvAudioHlpPCMPropsAreEqual(&Cfg.Props, &pStream->State.Cfg.Props)) + if ( !DrvAudioHlpPCMPropsAreEqual(&Cfg.Props, &pStream->State.Cfg.Props) + || fForce) { + LogRel2(("AC97: (Re-)Opening stream '%s' (%RU32Hz, %RU8 channels, %s%RU8)\n", + Cfg.szName, Cfg.Props.uHz, Cfg.Props.cChannels, Cfg.Props.fSigned ? "S" : "U", Cfg.Props.cBytes * 8)); + LogFlowFunc(("[SD%RU8] uHz=%RU32\n", pStream->u8SD, Cfg.Props.uHz)); if (Cfg.Props.uHz) @@ -2143,14 +2153,16 @@ * @returns IPRT status code. * @param pThis AC'97 device state. * @param pStream AC'97 stream to re-open. + * @param fForce Whether to force re-opening the stream or not. + * Otherwise re-opening only will happen if the PCM properties have changed. */ -static int ichac97R3StreamReOpen(PAC97STATE pThis, PAC97STREAM pStream) +static int ichac97R3StreamReOpen(PAC97STATE pThis, PAC97STREAM pStream, bool fForce) { LogFlowFunc(("[SD%RU8]\n", pStream->u8SD)); int rc = ichac97R3StreamClose(pThis, pStream); if (RT_SUCCESS(rc)) - rc = ichac97R3StreamOpen(pThis, pStream); + rc = ichac97R3StreamOpen(pThis, pStream, fForce); return rc; } @@ -2483,10 +2495,15 @@ { uint8_t rs = val & AC97_REC_MASK; uint8_t ls = (val >> 8) & AC97_REC_MASK; - PDMAUDIORECSOURCE ars = ichac97R3IdxToRecSource(rs); - PDMAUDIORECSOURCE als = ichac97R3IdxToRecSource(ls); + + const PDMAUDIORECSOURCE ars = ichac97R3IdxToRecSource(rs); + const PDMAUDIORECSOURCE als = ichac97R3IdxToRecSource(ls); + rs = ichac97R3RecSourceToIdx(ars); ls = ichac97R3RecSourceToIdx(als); + + LogRel(("AC97: Record select to left=%s, right=%s\n", DrvAudioHlpRecSrcToStr(ars), DrvAudioHlpRecSrcToStr(als))); + ichac97MixerSet(pThis, AC97_Record_Select, rs | (ls << 8)); } @@ -2520,24 +2537,18 @@ ichac97MixerSet(pThis, AC97_Powerdown_Ctrl_Stat , 0x000f); /* Configure Extended Audio ID (EAID) + Control & Status (EACS) registers. */ - uint16_t fEAID = AC97_EAID_REV1; /* Our hardware is AC'97 rev2.3 compliant. */ - uint16_t fEACS = 0; -#ifdef VBOX_WITH_AC97_VRA - fEAID |= AC97_EAID_VRA; /* Variable Rate PCM Audio capable. */ - fEACS |= AC97_EACS_VRA; /* Ditto. */ -#endif -#ifdef VBOX_WITH_AC97_VRM - fEAID |= AC97_EAID_VRM; /* Variable Rate Mic-In Audio capable. */ - fEACS |= AC97_EACS_VRM; /* Ditto. */ -#endif + const uint16_t fEAID = AC97_EAID_REV1 | AC97_EACS_VRA | AC97_EACS_VRM; /* Our hardware is AC'97 rev2.3 compliant. */ + const uint16_t fEACS = AC97_EACS_VRA | AC97_EACS_VRM; /* Variable Rate PCM Audio (VRA) + Mic-In (VRM) capable. */ + + LogRel(("AC97: Mixer reset (EAID=0x%x, EACS=0x%x)\n", fEAID, fEACS)); ichac97MixerSet(pThis, AC97_Extended_Audio_ID, fEAID); ichac97MixerSet(pThis, AC97_Extended_Audio_Ctrl_Stat, fEACS); - ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate , 0xbb80); - ichac97MixerSet(pThis, AC97_PCM_Surround_DAC_Rate , 0xbb80); - ichac97MixerSet(pThis, AC97_PCM_LFE_DAC_Rate , 0xbb80); - ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate , 0xbb80); - ichac97MixerSet(pThis, AC97_MIC_ADC_Rate , 0xbb80); + ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate , 0xbb80 /* 48000 Hz by default */); + ichac97MixerSet(pThis, AC97_PCM_Surround_DAC_Rate , 0xbb80 /* 48000 Hz by default */); + ichac97MixerSet(pThis, AC97_PCM_LFE_DAC_Rate , 0xbb80 /* 48000 Hz by default */); + ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate , 0xbb80 /* 48000 Hz by default */); + ichac97MixerSet(pThis, AC97_MIC_ADC_Rate , 0xbb80 /* 48000 Hz by default */); if (pThis->uCodecModel == AC97_CODEC_AD1980) { @@ -3488,72 +3499,79 @@ break; case AC97_Extended_Audio_Ctrl_Stat: #ifdef IN_RING3 - if (!(u32Val & AC97_EACS_VRA)) + /* + * Handle VRA bits. + */ + if (!(u32Val & AC97_EACS_VRA)) /* Check if VRA bit is not set. */ { - ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate, 48000); - ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX]); + ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate, 0xbb80); /* Set default (48000 Hz). */ + ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX], true /* fForce */); - ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate, 48000); - ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX]); + ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate, 0xbb80); /* Set default (48000 Hz). */ + ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX], true /* fForce */); } else LogRel2(("AC97: Variable rate audio (VRA) is not supported\n")); - if (!(u32Val & AC97_EACS_VRM)) + /* + * Handle VRM bits. + */ + if (!(u32Val & AC97_EACS_VRM)) /* Check if VRM bit is not set. */ { - ichac97MixerSet(pThis, AC97_MIC_ADC_Rate, 48000); - ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX]); + ichac97MixerSet(pThis, AC97_MIC_ADC_Rate, 0xbb80); /* Set default (48000 Hz). */ + ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX], true /* fForce */); } else LogRel2(("AC97: Variable rate microphone audio (VRM) is not supported\n")); - LogFunc(("Setting extended audio control to %#x\n", u32Val)); + LogRel2(("AC97: Setting extended audio control to %#x\n", u32Val)); ichac97MixerSet(pThis, AC97_Extended_Audio_Ctrl_Stat, u32Val); -#else +#else /* !IN_RING3 */ rc = VINF_IOM_R3_IOPORT_WRITE; #endif break; - case AC97_PCM_Front_DAC_Rate: + case AC97_PCM_Front_DAC_Rate: /* Output slots 3, 4, 6. */ +#ifdef IN_RING3 if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRA) { -#ifdef IN_RING3 + LogRel2(("AC97: Setting front DAC rate to 0x%x\n", u32Val)); ichac97MixerSet(pThis, uPortIdx, u32Val); - LogFunc(("Set front DAC rate to %RU32\n", u32Val)); - ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX]); -#else - rc = VINF_IOM_R3_IOPORT_WRITE; -#endif + ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX], true /* fForce */); } else - LogRel2(("AC97: Setting Front DAC rate when VRA is not set is forbidden, ignoring\n")); + LogRel2(("AC97: Setting front DAC rate (0x%x) when VRA is not set is forbidden, ignoring\n", u32Val)); +#else + rc = VINF_IOM_R3_IOPORT_WRITE; +#endif break; - case AC97_MIC_ADC_Rate: + case AC97_MIC_ADC_Rate: /* Input slot 6. */ +#ifdef IN_RING3 if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRM) { -#ifdef IN_RING3 + LogRel2(("AC97: Setting microphone ADC rate to 0x%x\n", u32Val)); ichac97MixerSet(pThis, uPortIdx, u32Val); - LogFunc(("Set MIC ADC rate to %RU32\n", u32Val)); - ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX]); -#else - rc = VINF_IOM_R3_IOPORT_WRITE; -#endif + ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX], true /* fForce */); } else - LogRel2(("AC97: Setting MIC ADC rate when VRM is not set is forbidden, ignoring\n")); + LogRel2(("AC97: Setting microphone ADC rate (0x%x) when VRM is not set is forbidden, ignoring\n", + u32Val)); +#else + rc = VINF_IOM_R3_IOPORT_WRITE; +#endif break; - case AC97_PCM_LR_ADC_Rate: + case AC97_PCM_LR_ADC_Rate: /* Input slots 3, 4. */ +#ifdef IN_RING3 if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRA) { -#ifdef IN_RING3 + LogRel2(("AC97: Setting line-in ADC rate to 0x%x\n", u32Val)); ichac97MixerSet(pThis, uPortIdx, u32Val); - LogFunc(("Set front LR ADC rate to %RU32\n", u32Val)); - ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX]); -#else - rc = VINF_IOM_R3_IOPORT_WRITE; -#endif + ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX], true /* fForce */); } else - LogRel2(("AC97: Setting LR ADC rate when VRA is not set is forbidden, ignoring\n")); + LogRel2(("AC97: Setting line-in ADC rate (0x%x) when VRA is not set is forbidden, ignoring\n", u32Val)); +#else + rc = VINF_IOM_R3_IOPORT_WRITE; +#endif break; default: LogRel2(("AC97: Warning: Unimplemented NAMWrite (%u byte) port=%#x, idx=0x%x <- %#x\n", cbVal, uPort, uPortIdx, u32Val)); diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/DrvHostDSound.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/DrvHostDSound.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/DrvHostDSound.cpp 2019-07-12 08:45:14.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/DrvHostDSound.cpp 2019-10-10 18:09:31.000000000 +0000 @@ -745,7 +745,7 @@ */ pStreamDS->cbBufSize = bc.dwBufferBytes; - rc = RTCircBufCreate(&pStreamDS->pCircBuf, pStreamDS->cbBufSize) * 2; /* Use "double buffering" */ + rc = RTCircBufCreate(&pStreamDS->pCircBuf, pStreamDS->cbBufSize * 2 /* Use "double buffering" */); AssertRC(rc); pThis->pDSStrmOut = pStreamDS; @@ -1224,9 +1224,11 @@ uint32_t cbFree = (uint32_t)RTCircBufFree(pCircBuf); if ( !cbFree - || pStreamDS->In.cOverruns < 32) /** @todo Make this configurable. */ + && pStreamDS->In.cOverruns < 32) /** @todo Make this configurable. */ { - DSLOG(("DSound: Warning: Capture buffer full, skipping to record data (%RU32 bytes)\n", cbUsed)); + DSLOG(("DSound: Warning: Internal buffer full (size is %zu bytes), skipping to record data (overflow #%RU32)\n", + RTCircBufSize(pCircBuf), pStreamDS->In.cOverruns)); + DSLOG(("DSound: Warning: DSound capture buffer currently uses %RU32/%RU32 bytes\n", cbUsed, pStreamDS->cbBufSize)); pStreamDS->In.cOverruns++; } @@ -1489,7 +1491,7 @@ pStreamDS->In.offReadPos = 0; pStreamDS->cbBufSize = bc.dwBufferBytes; - rc = RTCircBufCreate(&pStreamDS->pCircBuf, pStreamDS->cbBufSize) * 2; /* Use "double buffering". */ + rc = RTCircBufCreate(&pStreamDS->pCircBuf, pStreamDS->cbBufSize * 2 /* Use "double buffering" */); AssertRC(rc); pThis->pDSStrmIn = pStreamDS; diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/HDACodec.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/HDACodec.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/HDACodec.cpp 2019-07-12 08:45:14.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/HDACodec.cpp 2019-10-10 18:09:32.000000000 +0000 @@ -23,6 +23,7 @@ * Header Files * *********************************************************************************************************************************/ #define LOG_GROUP LOG_GROUP_DEV_HDA_CODEC +#include #include #include #include @@ -2368,6 +2369,9 @@ LogFlowFunc(("[NID0x%02x] Setting to stream ID=%RU8, channel=%RU8\n", CODEC_NID(cmd), uSD, uChannel)); + ASSERT_GUEST_LOGREL_MSG_RETURN(uSD < HDA_MAX_STREAMS, + ("Setting stream ID #%RU8 is invalid\n", uSD), VERR_INVALID_PARAMETER); + PDMAUDIODIR enmDir; uint32_t *pu32Addr = NULL; if (hdaCodecIsDacNode(pThis, CODEC_NID(cmd))) diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/HDAStream.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/HDAStream.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Audio/HDAStream.cpp 2019-07-12 08:45:14.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Audio/HDAStream.cpp 2019-10-10 18:09:32.000000000 +0000 @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -238,6 +239,10 @@ rc = hdaR3StreamMapInit(&pStream->State.Mapping, &Props); AssertRCReturn(rc, rc); + ASSERT_GUEST_LOGREL_MSG_RETURN(u32CBL % pStream->State.Mapping.cbFrameSize == 0, + ("CBL for stream #%RU8 does not align to frame size\n", pStream->u8SD), + VERR_INVALID_PARAMETER); + /* * Set the stream's timer Hz rate, based on the stream channel count. * Currently this is just a rough guess and we might want to optimize this further. @@ -343,10 +348,6 @@ LogFunc(("[SD%RU8] DMA @ 0x%x (%RU32 bytes), LVI=%RU16, FIFOS=%RU16\n", pStream->u8SD, pStream->u64BDLBase, pStream->u32CBL, pStream->u16LVI, pStream->u16FIFOS)); - /* Make sure that mandatory parameters are set up correctly. */ - AssertStmt(pStream->u32CBL % pStream->State.Mapping.cbFrameSize == 0, rc = VERR_INVALID_PARAMETER); - AssertStmt(pStream->u16LVI >= 1, rc = VERR_INVALID_PARAMETER); - if (RT_SUCCESS(rc)) { /* Make sure that the chosen Hz rate dividable by the stream's rate. */ @@ -356,7 +357,6 @@ /* Figure out how many transfer fragments we're going to use for this stream. */ /** @todo Use a more dynamic fragment size? */ - Assert(pStream->u16LVI <= UINT8_MAX - 1); uint8_t cFragments = pStream->u16LVI + 1; if (cFragments <= 1) cFragments = 2; /* At least two fragments (BDLEs) must be present. */ @@ -445,38 +445,47 @@ pStream->State.cbTransferSize = pStream->u32CBL / cFragments; Assert(pStream->State.cbTransferSize); Assert(pStream->State.cbTransferSize % pStream->State.Mapping.cbFrameSize == 0); + ASSERT_GUEST_LOGREL_MSG_STMT(pStream->State.cbTransferSize, + ("Transfer size for stream #%RU8 is invalid\n", pStream->u8SD), rc = VERR_INVALID_PARAMETER); + if (RT_SUCCESS(rc)) + { + /* Calculate the bytes we need to transfer to / from the stream's DMA per iteration. + * This is bound to the device's Hz rate and thus to the (virtual) timing the device expects. */ + pStream->State.cbTransferChunk = (pStream->State.Cfg.Props.uHz / pStream->State.uTimerHz) * pStream->State.Mapping.cbFrameSize; + Assert(pStream->State.cbTransferChunk); + Assert(pStream->State.cbTransferChunk % pStream->State.Mapping.cbFrameSize == 0); + ASSERT_GUEST_LOGREL_MSG_STMT(pStream->State.cbTransferChunk, + ("Transfer chunk for stream #%RU8 is invalid\n", pStream->u8SD), + rc = VERR_INVALID_PARAMETER); + if (RT_SUCCESS(rc)) + { + /* Make sure that the transfer chunk does not exceed the overall transfer size. */ + if (pStream->State.cbTransferChunk > pStream->State.cbTransferSize) + pStream->State.cbTransferChunk = pStream->State.cbTransferSize; + + const uint64_t cTicksPerHz = TMTimerGetFreq(pStream->pTimer) / pStream->State.uTimerHz; + + /* Calculate the timer ticks per byte for this stream. */ + pStream->State.cTicksPerByte = cTicksPerHz / pStream->State.cbTransferChunk; + Assert(pStream->State.cTicksPerByte); + + /* Calculate timer ticks per transfer. */ + pStream->State.cTransferTicks = pStream->State.cbTransferChunk * pStream->State.cTicksPerByte; + Assert(pStream->State.cTransferTicks); + + LogFunc(("[SD%RU8] Timer %uHz (%RU64 ticks per Hz), cTicksPerByte=%RU64, cbTransferChunk=%RU32, " \ + "cTransferTicks=%RU64, cbTransferSize=%RU32\n", + pStream->u8SD, pStream->State.uTimerHz, cTicksPerHz, pStream->State.cTicksPerByte, + pStream->State.cbTransferChunk, pStream->State.cTransferTicks, pStream->State.cbTransferSize)); - /* Calculate the bytes we need to transfer to / from the stream's DMA per iteration. - * This is bound to the device's Hz rate and thus to the (virtual) timing the device expects. */ - pStream->State.cbTransferChunk = (pStream->State.Cfg.Props.uHz / pStream->State.uTimerHz) * pStream->State.Mapping.cbFrameSize; - Assert(pStream->State.cbTransferChunk); - Assert(pStream->State.cbTransferChunk % pStream->State.Mapping.cbFrameSize == 0); - - /* Make sure that the transfer chunk does not exceed the overall transfer size. */ - if (pStream->State.cbTransferChunk > pStream->State.cbTransferSize) - pStream->State.cbTransferChunk = pStream->State.cbTransferSize; - - const uint64_t cTicksPerHz = TMTimerGetFreq(pStream->pTimer) / pStream->State.uTimerHz; - - /* Calculate the timer ticks per byte for this stream. */ - pStream->State.cTicksPerByte = cTicksPerHz / pStream->State.cbTransferChunk; - Assert(pStream->State.cTicksPerByte); - - /* Calculate timer ticks per transfer. */ - pStream->State.cTransferTicks = pStream->State.cbTransferChunk * pStream->State.cTicksPerByte; - Assert(pStream->State.cTransferTicks); - - LogFunc(("[SD%RU8] Timer %uHz (%RU64 ticks per Hz), cTicksPerByte=%RU64, cbTransferChunk=%RU32, cTransferTicks=%RU64, " \ - "cbTransferSize=%RU32\n", - pStream->u8SD, pStream->State.uTimerHz, cTicksPerHz, pStream->State.cTicksPerByte, - pStream->State.cbTransferChunk, pStream->State.cTransferTicks, pStream->State.cbTransferSize)); - - /* Make sure to also update the stream's DMA counter (based on its current LPIB value). */ - hdaR3StreamSetPosition(pStream, HDA_STREAM_REG(pThis, LPIB, pStream->u8SD)); + /* Make sure to also update the stream's DMA counter (based on its current LPIB value). */ + hdaR3StreamSetPosition(pStream, HDA_STREAM_REG(pThis, LPIB, pStream->u8SD)); #ifdef LOG_ENABLED - hdaR3BDLEDumpAll(pThis, pStream->u64BDLBase, pStream->u16LVI + 1); + hdaR3BDLEDumpAll(pThis, pStream->u64BDLBase, pStream->u16LVI + 1); #endif + } + } } if (RT_FAILURE(rc)) diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative286.asm virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative286.asm --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative286.asm 2019-07-12 08:47:37.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative286.asm 2019-10-10 18:11:54.000000000 +0000 @@ -7395,7 +7395,7 @@ section _DATA progbits vstart=0x4600 align=1 ; size=0x3727 class=DATA group=DGROUP _msg_vga_init: ; 0xc4600 LB 0x2f - db 'Oracle VM VirtualBox Version 5.2.32 VGA BIOS', 00dh, 00ah, 000h + db 'Oracle VM VirtualBox Version 5.2.33 VGA BIOS', 00dh, 00ah, 000h _vga_modes: ; 0xc462f LB 0x80 db 000h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h, 001h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h db 002h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h, 003h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h @@ -8292,7 +8292,7 @@ _vbebios_product_name: ; 0xc7c8e LB 0x21 db 'Oracle VM VirtualBox VBE Adapter', 000h _vbebios_product_revision: ; 0xc7caf LB 0x24 - db 'Oracle VM VirtualBox Version 5.2.32', 000h + db 'Oracle VM VirtualBox Version 5.2.33', 000h _vbebios_info_string: ; 0xc7cd3 LB 0x2b db 'VirtualBox VBE Display Adapter enabled', 00dh, 00ah, 00dh, 00ah, 000h _no_vbebios_info_string: ; 0xc7cfe LB 0x29 @@ -8306,13 +8306,13 @@ section CONST2 progbits vstart=0x7d28 align=1 ; size=0x0 class=DATA group=DGROUP ; Padding 0x2d8 bytes at 0xc7d28 - db 000h, 000h, 000h, 000h, 001h, 000h, 000h, 000h, 000h, 000h, 000h, 02fh, 068h, 06fh, 06dh, 065h - db 02fh, 06dh, 069h, 063h, 068h, 061h, 065h, 06ch, 02fh, 076h, 062h, 06fh, 078h, 02fh, 062h, 072h - db 061h, 06eh, 063h, 068h, 065h, 073h, 02fh, 056h, 042h, 06fh, 078h, 02dh, 035h, 02eh, 032h, 02fh - db 06fh, 075h, 074h, 02fh, 06ch, 069h, 06eh, 075h, 078h, 02eh, 061h, 06dh, 064h, 036h, 034h, 02fh - db 072h, 065h, 06ch, 065h, 061h, 073h, 065h, 02fh, 06fh, 062h, 06ah, 02fh, 056h, 042h, 06fh, 078h - db 056h, 067h, 061h, 042h, 069h, 06fh, 073h, 032h, 038h, 036h, 02fh, 056h, 042h, 06fh, 078h, 056h - db 067h, 061h, 042h, 069h, 06fh, 073h, 032h, 038h, 036h, 02eh, 073h, 079h, 06dh, 000h, 000h, 000h + db 000h, 000h, 000h, 000h, 001h, 000h, 000h, 000h, 000h, 000h, 000h, 044h, 03ah, 05ch, 052h, 065h + db 070h, 06fh, 073h, 069h, 074h, 06fh, 072h, 079h, 05ch, 062h, 072h, 061h, 06eh, 063h, 068h, 065h + db 073h, 05ch, 056h, 042h, 06fh, 078h, 02dh, 035h, 02eh, 032h, 05ch, 06fh, 075h, 074h, 05ch, 077h + db 069h, 06eh, 02eh, 061h, 06dh, 064h, 036h, 034h, 05ch, 072h, 065h, 06ch, 065h, 061h, 073h, 065h + db 05ch, 06fh, 062h, 06ah, 05ch, 056h, 042h, 06fh, 078h, 056h, 067h, 061h, 042h, 069h, 06fh, 073h + db 032h, 038h, 036h, 05ch, 056h, 042h, 06fh, 078h, 056h, 067h, 061h, 042h, 069h, 06fh, 073h, 032h + db 038h, 036h, 02eh, 073h, 079h, 06dh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h @@ -8351,4 +8351,4 @@ db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h - db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 037h + db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 05dh diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative286.md5sum virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative286.md5sum --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative286.md5sum 2019-07-12 08:47:37.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative286.md5sum 2019-10-10 18:11:54.000000000 +0000 @@ -1 +1 @@ -a915da14e96bbe07f8854cd5e1ccea3b *VBoxVgaBios286.rom +fa79b1a065fd7ed911c80a4a66a1ff7e *VBoxVgaBios286.rom diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative386.asm virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative386.asm --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative386.asm 2019-07-12 08:47:37.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative386.asm 2019-10-10 18:11:54.000000000 +0000 @@ -6867,7 +6867,7 @@ section _DATA progbits vstart=0x4600 align=1 ; size=0x3727 class=DATA group=DGROUP _msg_vga_init: ; 0xc4600 LB 0x2f - db 'Oracle VM VirtualBox Version 5.2.32 VGA BIOS', 00dh, 00ah, 000h + db 'Oracle VM VirtualBox Version 5.2.33 VGA BIOS', 00dh, 00ah, 000h _vga_modes: ; 0xc462f LB 0x80 db 000h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h, 001h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h db 002h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h, 003h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h @@ -7764,7 +7764,7 @@ _vbebios_product_name: ; 0xc7c8e LB 0x21 db 'Oracle VM VirtualBox VBE Adapter', 000h _vbebios_product_revision: ; 0xc7caf LB 0x24 - db 'Oracle VM VirtualBox Version 5.2.32', 000h + db 'Oracle VM VirtualBox Version 5.2.33', 000h _vbebios_info_string: ; 0xc7cd3 LB 0x2b db 'VirtualBox VBE Display Adapter enabled', 00dh, 00ah, 00dh, 00ah, 000h _no_vbebios_info_string: ; 0xc7cfe LB 0x29 @@ -7778,13 +7778,13 @@ section CONST2 progbits vstart=0x7d28 align=1 ; size=0x0 class=DATA group=DGROUP ; Padding 0x2d8 bytes at 0xc7d28 - db 000h, 000h, 000h, 000h, 001h, 000h, 000h, 000h, 000h, 000h, 000h, 02fh, 068h, 06fh, 06dh, 065h - db 02fh, 06dh, 069h, 063h, 068h, 061h, 065h, 06ch, 02fh, 076h, 062h, 06fh, 078h, 02fh, 062h, 072h - db 061h, 06eh, 063h, 068h, 065h, 073h, 02fh, 056h, 042h, 06fh, 078h, 02dh, 035h, 02eh, 032h, 02fh - db 06fh, 075h, 074h, 02fh, 06ch, 069h, 06eh, 075h, 078h, 02eh, 061h, 06dh, 064h, 036h, 034h, 02fh - db 072h, 065h, 06ch, 065h, 061h, 073h, 065h, 02fh, 06fh, 062h, 06ah, 02fh, 056h, 042h, 06fh, 078h - db 056h, 067h, 061h, 042h, 069h, 06fh, 073h, 033h, 038h, 036h, 02fh, 056h, 042h, 06fh, 078h, 056h - db 067h, 061h, 042h, 069h, 06fh, 073h, 033h, 038h, 036h, 02eh, 073h, 079h, 06dh, 000h, 000h, 000h + db 000h, 000h, 000h, 000h, 001h, 000h, 000h, 000h, 000h, 000h, 000h, 044h, 03ah, 05ch, 052h, 065h + db 070h, 06fh, 073h, 069h, 074h, 06fh, 072h, 079h, 05ch, 062h, 072h, 061h, 06eh, 063h, 068h, 065h + db 073h, 05ch, 056h, 042h, 06fh, 078h, 02dh, 035h, 02eh, 032h, 05ch, 06fh, 075h, 074h, 05ch, 077h + db 069h, 06eh, 02eh, 061h, 06dh, 064h, 036h, 034h, 05ch, 072h, 065h, 06ch, 065h, 061h, 073h, 065h + db 05ch, 06fh, 062h, 06ah, 05ch, 056h, 042h, 06fh, 078h, 056h, 067h, 061h, 042h, 069h, 06fh, 073h + db 033h, 038h, 036h, 05ch, 056h, 042h, 06fh, 078h, 056h, 067h, 061h, 042h, 069h, 06fh, 073h, 033h + db 038h, 036h, 02eh, 073h, 079h, 06dh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h @@ -7823,4 +7823,4 @@ db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h - db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0ach + db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0d2h diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative386.md5sum virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative386.md5sum --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative386.md5sum 2019-07-12 08:47:37.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative386.md5sum 2019-10-10 18:11:54.000000000 +0000 @@ -1 +1 @@ -2c842e3229ce570bbe7a680a8489ba6a *VBoxVgaBios386.rom +a2e3375cf6a83ede3b1e6fc4068e8870 *VBoxVgaBios386.rom diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative8086.asm virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative8086.asm --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative8086.asm 2019-07-12 08:47:37.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative8086.asm 2019-10-10 18:11:54.000000000 +0000 @@ -7514,7 +7514,7 @@ section _DATA progbits vstart=0x4600 align=1 ; size=0x3727 class=DATA group=DGROUP _msg_vga_init: ; 0xc4600 LB 0x2f - db 'Oracle VM VirtualBox Version 5.2.32 VGA BIOS', 00dh, 00ah, 000h + db 'Oracle VM VirtualBox Version 5.2.33 VGA BIOS', 00dh, 00ah, 000h _vga_modes: ; 0xc462f LB 0x80 db 000h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h, 001h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h db 002h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h, 003h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h @@ -8411,7 +8411,7 @@ _vbebios_product_name: ; 0xc7c8e LB 0x21 db 'Oracle VM VirtualBox VBE Adapter', 000h _vbebios_product_revision: ; 0xc7caf LB 0x24 - db 'Oracle VM VirtualBox Version 5.2.32', 000h + db 'Oracle VM VirtualBox Version 5.2.33', 000h _vbebios_info_string: ; 0xc7cd3 LB 0x2b db 'VirtualBox VBE Display Adapter enabled', 00dh, 00ah, 00dh, 00ah, 000h _no_vbebios_info_string: ; 0xc7cfe LB 0x29 @@ -8425,13 +8425,13 @@ section CONST2 progbits vstart=0x7d28 align=1 ; size=0x0 class=DATA group=DGROUP ; Padding 0x2d8 bytes at 0xc7d28 - db 000h, 000h, 000h, 000h, 001h, 000h, 000h, 000h, 000h, 000h, 000h, 02fh, 068h, 06fh, 06dh, 065h - db 02fh, 06dh, 069h, 063h, 068h, 061h, 065h, 06ch, 02fh, 076h, 062h, 06fh, 078h, 02fh, 062h, 072h - db 061h, 06eh, 063h, 068h, 065h, 073h, 02fh, 056h, 042h, 06fh, 078h, 02dh, 035h, 02eh, 032h, 02fh - db 06fh, 075h, 074h, 02fh, 06ch, 069h, 06eh, 075h, 078h, 02eh, 061h, 06dh, 064h, 036h, 034h, 02fh - db 072h, 065h, 06ch, 065h, 061h, 073h, 065h, 02fh, 06fh, 062h, 06ah, 02fh, 056h, 042h, 06fh, 078h - db 056h, 067h, 061h, 042h, 069h, 06fh, 073h, 038h, 030h, 038h, 036h, 02fh, 056h, 042h, 06fh, 078h - db 056h, 067h, 061h, 042h, 069h, 06fh, 073h, 038h, 030h, 038h, 036h, 02eh, 073h, 079h, 06dh, 000h + db 000h, 000h, 000h, 000h, 001h, 000h, 000h, 000h, 000h, 000h, 000h, 044h, 03ah, 05ch, 052h, 065h + db 070h, 06fh, 073h, 069h, 074h, 06fh, 072h, 079h, 05ch, 062h, 072h, 061h, 06eh, 063h, 068h, 065h + db 073h, 05ch, 056h, 042h, 06fh, 078h, 02dh, 035h, 02eh, 032h, 05ch, 06fh, 075h, 074h, 05ch, 077h + db 069h, 06eh, 02eh, 061h, 06dh, 064h, 036h, 034h, 05ch, 072h, 065h, 06ch, 065h, 061h, 073h, 065h + db 05ch, 06fh, 062h, 06ah, 05ch, 056h, 042h, 06fh, 078h, 056h, 067h, 061h, 042h, 069h, 06fh, 073h + db 038h, 030h, 038h, 036h, 05ch, 056h, 042h, 06fh, 078h, 056h, 067h, 061h, 042h, 069h, 06fh, 073h + db 038h, 030h, 038h, 036h, 02eh, 073h, 079h, 06dh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h @@ -8470,4 +8470,4 @@ db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h - db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 09bh + db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0c1h diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative8086.md5sum virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative8086.md5sum --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative8086.md5sum 2019-07-12 08:47:37.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative8086.md5sum 2019-10-10 18:11:54.000000000 +0000 @@ -1 +1 @@ -e85ee20a1429a67a8a3dfbea2c778591 *VBoxVgaBios8086.rom +b2eb704d0d474996dc43aaef159cee9a *VBoxVgaBios8086.rom diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp 2019-07-12 08:47:37.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp 2019-10-10 18:11:55.000000000 +0000 @@ -4958,15 +4958,13 @@ AssertReturn(pState, VERR_NO_MEMORY); Log(("vmsvga3dSetLightEnabled %x %d -> %d\n", cid, index, enabled)); + AssertReturn(index < SVGA3D_MAX_LIGHTS, VERR_INVALID_PARAMETER); int rc = vmsvga3dContextFromCid(pState, cid, &pContext); AssertRCReturn(rc, rc); /* Store for vm state save/restore */ - if (index < SVGA3D_MAX_LIGHTS) - pContext->state.aLightData[index].fEnabled = !!enabled; - else - AssertFailed(); + pContext->state.aLightData[index].fEnabled = !!enabled; hr = pContext->pDevice->LightEnable(index, (BOOL)enabled); AssertMsgReturn(hr == D3D_OK, ("LightEnable failed with %x\n", hr), VERR_INTERNAL_ERROR); diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp 2019-07-12 08:47:37.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp 2019-10-10 18:11:54.000000000 +0000 @@ -3224,7 +3224,7 @@ { STAM_REL_COUNTER_INC(&pSVGAState->StatFifoErrors); LogRelMax(8, ("vmsvgaFIFOLoop: Misaligned offCurrentCmd=%#x?\n", offCurrentCmd)); - offCurrentCmd = ~UINT32_C(3); + offCurrentCmd &= ~UINT32_C(3); } /** @def VMSVGAFIFO_GET_CMD_BUFFER_BREAK @@ -3829,9 +3829,10 @@ * header. Will break out of the switch if it doesn't. */ # define VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(a_cbMin) \ - do { AssertMsgBreak(pHdr->size >= (a_cbMin), ("size=%#x a_cbMin=%#zx\n", pHdr->size, (size_t)(a_cbMin))); \ + if (1) { \ + AssertMsgBreak(pHdr->size >= (a_cbMin), ("size=%#x a_cbMin=%#zx\n", pHdr->size, (size_t)(a_cbMin))); \ RT_UNTRUSTED_VALIDATED_FENCE(); \ - } while (0) + } else do {} while (0) switch ((int)enmCmdId) { case SVGA_3D_CMD_SURFACE_DEFINE: diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/shaderlib/shader.c virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/shaderlib/shader.c --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Graphics/shaderlib/shader.c 2019-07-12 08:47:38.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Graphics/shaderlib/shader.c 2019-10-10 18:11:56.000000000 +0000 @@ -334,7 +334,7 @@ bitmap[idx] |= (1 << shift); } -static void shader_record_register_usage(IWineD3DBaseShaderImpl *shader, struct shader_reg_maps *reg_maps, +static HRESULT shader_record_register_usage(IWineD3DBaseShaderImpl *shader, struct shader_reg_maps *reg_maps, const struct wined3d_shader_register *reg, enum wined3d_shader_type shader_type) { switch (reg->type) @@ -364,7 +364,15 @@ } else { - ((IWineD3DPixelShaderImpl *)shader)->input_reg_used[reg->idx] = TRUE; + unsigned int reg_idx = reg->idx; + + if (reg_idx >= MAX_REG_INPUT) + { + ERR("Invalid input register index %d.\n", reg_idx); + return E_INVALIDARG; + } + + ((IWineD3DPixelShaderImpl *)shader)->input_reg_used[reg_idx] = TRUE; } } else reg_maps->input_registers |= 1 << reg->idx; @@ -420,6 +428,8 @@ TRACE("Not recording register of type %#x and idx %u\n", reg->type, reg->idx); break; } + + return S_OK; } static unsigned int get_instr_extra_regcount(enum WINED3D_SHADER_INSTRUCTION_HANDLER instr, unsigned int param) @@ -659,10 +669,16 @@ { struct wined3d_shader_src_param dst_rel_addr; struct wined3d_shader_dst_param dst_param; + HRESULT hr; fe->shader_read_dst_param(fe_data, &ptr, &dst_param, &dst_rel_addr); - shader_record_register_usage(shader, reg_maps, &dst_param.reg, shader_version.type); + hr = shader_record_register_usage(shader, reg_maps, &dst_param.reg, shader_version.type); + if (FAILED(hr)) + { + ERR("shader_record_register_usage failed.\n"); + return hr; + } /* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and * is used in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Network/DevE1000.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Network/DevE1000.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Network/DevE1000.cpp 2019-07-12 08:47:56.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Network/DevE1000.cpp 2019-10-10 18:12:13.000000000 +0000 @@ -1637,6 +1637,14 @@ static void e1kHardReset(PE1KSTATE pThis) { E1kLog(("%s Hard reset triggered\n", pThis->szPrf)); + /* No interrupts should survive device reset, see @bugref(9556). */ + if (pThis->fIntRaised) + { + /* Lower(0) INTA(0) */ + PDMDevHlpPCISetIrq(pThis->CTX_SUFF(pDevIns), 0, 0); + pThis->fIntRaised = false; + E1kLog(("%s e1kHardReset: Lowered IRQ: ICR=%08x\n", pThis->szPrf, ICR)); + } memset(pThis->auRegs, 0, sizeof(pThis->auRegs)); memset(pThis->aRecAddr.au32, 0, sizeof(pThis->aRecAddr.au32)); #ifdef E1K_INIT_RA0 @@ -2396,7 +2404,8 @@ E1kLog3(("%s Added FCS (cb=%u)\n", pThis->szPrf, cb)); } /* Compute checksum of complete packet */ - uint16_t checksum = e1kCSum16(rxPacket + GET_BITS(RXCSUM, PCSS), cb); + size_t cbCSumStart = RT_MIN(GET_BITS(RXCSUM, PCSS), cb); + uint16_t checksum = e1kCSum16(rxPacket + cbCSumStart, cb - cbCSumStart); e1kRxChecksumOffload(pThis, rxPacket, cb, &status); /* Update stats */ @@ -4208,7 +4217,7 @@ E1kLog3(("%s e1kFallbackAddSegment: Length=%x, remaining payload=%x, header=%x, send=%RTbool\n", pThis->szPrf, u16Len, pThis->u32PayRemain, pThis->u16HdrRemain, fSend)); - Assert(pThis->u32PayRemain + pThis->u16HdrRemain > 0); + AssertReturn(pThis->u32PayRemain + pThis->u16HdrRemain > 0, VINF_SUCCESS); if (pThis->u16TxPktLen + u16Len <= sizeof(pThis->aTxPacketFallback)) PDMDevHlpPhysRead(pThis->CTX_SUFF(pDevIns), PhysAddr, @@ -4247,7 +4256,10 @@ } } - pThis->u32PayRemain -= u16Len; + if (u16Len > pThis->u32PayRemain) + pThis->u32PayRemain = 0; + else + pThis->u32PayRemain -= u16Len; if (fSend) { @@ -4415,6 +4427,9 @@ #endif uint16_t u16MaxPktLen = pThis->contextTSE.dw3.u8HDRLEN + pThis->contextTSE.dw3.u16MSS; + /* We cannot produce empty packets, ignore all TX descriptors (see @bugref{9571}) */ + if (u16MaxPktLen == 0) + return VINF_SUCCESS; /* * Carve out segments. diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Network/DevPCNet.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Network/DevPCNet.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Network/DevPCNet.cpp 2019-07-12 08:47:56.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Network/DevPCNet.cpp 2019-10-10 18:12:13.000000000 +0000 @@ -3242,6 +3242,13 @@ int i; uint16_t checksum; + /* Lower any raised interrupts, see @bugref(9556) */ + if (RT_UNLIKELY(pThis->iISR)) + { + pThis->iISR = 0; + Log(("#%d INTA=%d\n", PCNET_INST_NR, pThis->iISR)); + PDMDevHlpPCISetIrq(PCNETSTATE_2_DEVINS(pThis), 0, pThis->iISR); + } /* Initialize the PROM */ Assert(sizeof(pThis->MacConfigured) == 6); memcpy(pThis->aPROM, &pThis->MacConfigured, sizeof(pThis->MacConfigured)); diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Network/slirp/ip_output.c virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Network/slirp/ip_output.c --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/Network/slirp/ip_output.c 2019-07-12 08:48:01.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/Network/slirp/ip_output.c 2019-10-10 18:12:18.000000000 +0000 @@ -231,7 +231,7 @@ { error = -1; ipstat.ips_odropped++; - goto send_or_free; + goto exit_drop_package; } m->m_data += if_maxlinkhdr; mhip = mtod(m, struct ip *); @@ -290,7 +290,6 @@ ip->ip_sum = 0; ip->ip_sum = cksum(m, mhlen); -send_or_free: if (!(m->m_flags & M_SKIP_FIREWALL)){ /** @todo We can't alias all fragments because the way libalias processing * the fragments brake the sequence. libalias put alias_address to the source diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative286.asm virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative286.asm --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative286.asm 2019-07-12 08:48:02.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative286.asm 2019-10-10 18:12:19.000000000 +0000 @@ -1172,7 +1172,7 @@ section CONST2 progbits vstart=0xd8e align=1 ; size=0x3fa class=DATA group=DGROUP _bios_cvs_version_string: ; 0xf0d8e LB 0x12 - db 'VirtualBox 5.2.32', 000h + db 'VirtualBox 5.2.33', 000h _bios_prefix_string: ; 0xf0da0 LB 0x8 db 'BIOS: ', 000h, 000h _isotag: ; 0xf0da8 LB 0x6 @@ -17867,4 +17867,4 @@ db 'XM' cpu_reset: ; 0xffff0 LB 0x10 jmp far 0f000h:0e05bh ; ea 5b e0 00 f0 - db 030h, 036h, 02fh, 032h, 033h, 02fh, 039h, 039h, 000h, 0fch, 0a0h + db 030h, 036h, 02fh, 032h, 033h, 02fh, 039h, 039h, 000h, 0fch, 09fh diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative286.md5sum virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative286.md5sum --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative286.md5sum 2019-07-12 08:48:02.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative286.md5sum 2019-10-10 18:12:19.000000000 +0000 @@ -1 +1 @@ -6aa66eb68d727446071b9de8f6acccc5 *VBoxPcBios286.rom +bea9663cfb36b1f04d071dc27b83ce3e *VBoxPcBios286.rom diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative386.asm virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative386.asm --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative386.asm 2019-07-12 08:48:02.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative386.asm 2019-10-10 18:12:19.000000000 +0000 @@ -1136,7 +1136,7 @@ section CONST2 progbits vstart=0xda0 align=1 ; size=0x3fa class=DATA group=DGROUP _bios_cvs_version_string: ; 0xf0da0 LB 0x12 - db 'VirtualBox 5.2.32', 000h + db 'VirtualBox 5.2.33', 000h _bios_prefix_string: ; 0xf0db2 LB 0x8 db 'BIOS: ', 000h, 000h _isotag: ; 0xf0dba LB 0x6 @@ -17365,4 +17365,4 @@ db 'XM' cpu_reset: ; 0xffff0 LB 0x10 jmp far 0f000h:0e05bh ; ea 5b e0 00 f0 - db 030h, 036h, 02fh, 032h, 033h, 02fh, 039h, 039h, 000h, 0fch, 0edh + db 030h, 036h, 02fh, 032h, 033h, 02fh, 039h, 039h, 000h, 0fch, 0ech diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative386.md5sum virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative386.md5sum --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative386.md5sum 2019-07-12 08:48:02.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative386.md5sum 2019-10-10 18:12:19.000000000 +0000 @@ -1 +1 @@ -9e64c985fb03fc515fcc711268be352e *VBoxPcBios386.rom +236582a9df25fa3c9c02814fd57ccb3e *VBoxPcBios386.rom diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative8086.asm virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative8086.asm --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative8086.asm 2019-07-12 08:48:02.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative8086.asm 2019-10-10 18:12:20.000000000 +0000 @@ -1172,7 +1172,7 @@ section CONST2 progbits vstart=0xd8e align=1 ; size=0x3fa class=DATA group=DGROUP _bios_cvs_version_string: ; 0xf0d8e LB 0x12 - db 'VirtualBox 5.2.32', 000h + db 'VirtualBox 5.2.33', 000h _bios_prefix_string: ; 0xf0da0 LB 0x8 db 'BIOS: ', 000h, 000h _isotag: ; 0xf0da8 LB 0x6 @@ -18294,4 +18294,4 @@ db 'XM' cpu_reset: ; 0xffff0 LB 0x10 jmp far 0f000h:0e05bh ; ea 5b e0 00 f0 - db 030h, 036h, 02fh, 032h, 033h, 02fh, 039h, 039h, 000h, 0fbh, 007h + db 030h, 036h, 02fh, 032h, 033h, 02fh, 039h, 039h, 000h, 0fbh, 006h diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative8086.md5sum virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative8086.md5sum --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative8086.md5sum 2019-07-12 08:48:02.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative8086.md5sum 2019-10-10 18:12:20.000000000 +0000 @@ -1 +1 @@ -8e4c8ec6591e7d38d4f81db685283c7e *VBoxPcBios8086.rom +7ac68991c477c246455e2ff48d87944c *VBoxPcBios8086.rom diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/USB/DevOHCI.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/USB/DevOHCI.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/USB/DevOHCI.cpp 2019-07-12 08:48:29.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/USB/DevOHCI.cpp 2019-10-10 18:12:47.000000000 +0000 @@ -1220,6 +1220,7 @@ * any more when a reset has been signaled. */ pThis->RootHub.pIRhConn->pfnCancelAllUrbs(pThis->RootHub.pIRhConn); + Assert(pThis->cInFlight == 0); /* * Reset the hardware registers. @@ -2838,7 +2839,9 @@ ohciR3Lock(pThis); - /* Do nothing if the HC encountered an unrecoverable error. */ + int cFmAge = ohci_in_flight_remove_urb(pThis, pUrb); + + /* Do nothing requiring memory access if the HC encountered an unrecoverable error. */ if (!(pThis->intr_status & OHCI_INTR_UNRECOVERABLE_ERROR)) { pThis->fIdle = false; /* Mark as active */ @@ -2857,7 +2860,6 @@ * be updated but not yet written. We will delay the writing till we're done * with the data copying, buffer pointer advancing and error handling. */ - int cFmAge = ohci_in_flight_remove_urb(pThis, pUrb); if (pUrb->enmStatus == VUSBSTATUS_UNDO) { /* Leave the TD alone - the HCD doesn't want us talking to the device. */ @@ -3072,8 +3074,8 @@ /* Failure cleanup. Can happen if we're still resetting the device or out of resources. */ Log(("ohciServiceTd: failed submitting TdAddr=%#010x EdAddr=%#010x pUrb=%p!!\n", TdAddr, EdAddr, pUrb)); - VUSBIRhFreeUrb(pThis->RootHub.pIRhConn, pUrb); ohci_in_flight_remove(pThis, TdAddr); + VUSBIRhFreeUrb(pThis->RootHub.pIRhConn, pUrb); return false; } @@ -3243,8 +3245,7 @@ /* Failure cleanup. Can happen if we're still resetting the device or out of resources. */ Log(("ohciServiceTdMultiple: failed submitting pUrb=%p cbData=%#x EdAddr=%#010x cTds=%d TdAddr0=%#010x - rc=%Rrc\n", pUrb, cbTotal, EdAddr, cTds, TdAddr, rc)); - for (struct OHCITDENTRY *pCur = &Head; pCur; pCur = pCur->pNext, iTd++) - ohci_in_flight_remove(pThis, pCur->TdAddr); + ohci_in_flight_remove_urb(pThis, pUrb); VUSBIRhFreeUrb(pThis->RootHub.pIRhConn, pUrb); return false; } @@ -3474,7 +3475,7 @@ /* * Submit the URB. */ - ohci_in_flight_add_urb(pThis, pUrb); + ohci_in_flight_add(pThis, ITdAddr, pUrb); Log(("%s: ohciServiceIsochronousTd: submitting cbData=%#x cIsocPkts=%d EdAddr=%#010x TdAddr=%#010x SF=%#x (%#x)\n", pUrb->pszDesc, pUrb->cbData, pUrb->cIsocPkts, EdAddr, ITdAddr, pITd->HwInfo & ITD_HWINFO_SF, pThis->HcFmNumber)); ohciR3Unlock(pThis); @@ -3666,6 +3667,11 @@ while (EdAddr) { OHCIED Ed; + + /* Bail if previous processing ended up in the unrecoverable error state. */ + if (pThis->intr_status & OHCI_INTR_UNRECOVERABLE_ERROR) + break; + ohciReadEd(pThis, EdAddr, &Ed); Assert(!(Ed.hwinfo & ED_HWINFO_ISO)); /* the guest is screwing us */ if (ohciIsEdReady(&Ed)) @@ -3807,6 +3813,11 @@ while (EdAddr) { OHCIED Ed; + + /* Bail if previous processing ended up in the unrecoverable error state. */ + if (pThis->intr_status & OHCI_INTR_UNRECOVERABLE_ERROR) + break; + ohciReadEd(pThis, EdAddr, &Ed); Assert(!(Ed.hwinfo & ED_HWINFO_ISO)); /* the guest is screwing us */ if (ohciIsEdReady(&Ed)) @@ -3879,6 +3890,10 @@ { OHCIED Ed; + /* Bail if previous processing ended up in the unrecoverable error state. */ + if (pThis->intr_status & OHCI_INTR_UNRECOVERABLE_ERROR) + break; + ohciReadEd(pThis, EdAddr, &Ed); if (ohciIsEdReady(&Ed)) { diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/VirtIO/Virtio.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/VirtIO/Virtio.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Devices/VirtIO/Virtio.cpp 2019-07-12 08:48:30.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Devices/VirtIO/Virtio.cpp 2019-10-10 18:12:47.000000000 +0000 @@ -308,17 +308,6 @@ vqueueNotify(pState, pQueue); } -void vpciReset(PVPCISTATE pState) -{ - pState->uGuestFeatures = 0; - pState->uQueueSelector = 0; - pState->uStatus = 0; - pState->uISR = 0; - - for (unsigned i = 0; i < pState->nQueues; i++) - vqueueReset(&pState->Queues[i]); -} - /** * Raise interrupt. @@ -355,6 +344,23 @@ PDMDevHlpPCISetIrq(pState->CTX_SUFF(pDevIns), 0, 0); } + +void vpciReset(PVPCISTATE pState) +{ + /* No interrupts should survive device reset, see @bugref(9556). */ + if (pState->uISR) + vpciLowerInterrupt(pState); + + pState->uGuestFeatures = 0; + pState->uQueueSelector = 0; + pState->uStatus = 0; + pState->uISR = 0; + + for (unsigned i = 0; i < pState->nQueues; i++) + vqueueReset(&pState->Queues[i]); +} + + DECLINLINE(uint32_t) vpciGetHostFeatures(PVPCISTATE pState, PFNGETHOSTFEATURES pfnGetHostFeatures) { diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp 2019-07-12 08:49:05.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp 2019-10-10 18:13:23.000000000 +0000 @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010-2017 Oracle Corporation + * Copyright (C) 2010-2019 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -183,6 +183,24 @@ ComPtr pGuestSession; /** The guest session ID. */ ULONG uSessionID; + /** Path style, gotten lazily. */ + PathStyle_T enmPathStyle; + + /** Gets the path style. */ + PathStyle_T getPathStyle() + { + if (enmPathStyle == (PathStyle_T)0) + { + HRESULT hrc = pGuestSession->COMGETTER(PathStyle)(&enmPathStyle); + if (FAILED(hrc)) +#if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS + enmPathStyle = PathStyle_DOS; +#else + enmPathStyle = PathStyle_UNIX; +#endif + } + return enmPathStyle; + } } GCTLCMDCTX, *PGCTLCMDCTX; @@ -2670,6 +2688,7 @@ RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST); Utf8Str strSource; + bool fDstMustBeDir = false; const char *pszDst = NULL; enum gctlCopyFlags enmFlags = kGctlCopyFlags_None; /*bool fCopyRecursive = false; - unused */ @@ -2700,13 +2719,14 @@ case GETOPTDEF_COPY_TARGETDIR: pszDst = ValueUnion.psz; + fDstMustBeDir = true; break; case VINF_GETOPT_NOT_OPTION: /* Last argument and no destination specified with * --target-directory yet? Then use the current * (= last) argument as destination. */ - if ( pCtx->pArg->argc == GetState.iNext + if ( GetState.argc == GetState.iNext && pszDst == NULL) pszDst = ValueUnion.psz; else @@ -2763,6 +2783,23 @@ return RTEXITCODE_FAILURE; } + /* If --target-directory was used, make sure it ends with a slash or the + API may treat it as the destination file: */ + Utf8Str strDstBuf; + if (fDstMustBeDir) + { + size_t cchDst = strlen(pszDst); + if ( cchDst == 0 + || ( pszDst[cchDst - 1] != '/' + && ( pCtx->getPathStyle() != PathStyle_DOS + || (pszDst[cchDst - 1] != '\\' && pszDst[cchDst - 1] != ':')))) + { + strDstBuf = pszDst; + strDstBuf.append(pCtx->getPathStyle() == PathStyle_DOS ? '\\' : '/'); + pszDst = strDstBuf.c_str(); + } + } + /** @todo r=bird: RTPathFilename and RTPathStripFilename won't work * correctly on non-windows hosts when the guest is from the DOS world (Windows, * OS/2, DOS). The host doesn't know about DOS slashes, only UNIX slashes and diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.cpp 2019-07-12 08:49:18.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.cpp 2019-10-10 18:13:35.000000000 +0000 @@ -1309,19 +1309,16 @@ /** Get state of a particular led. */ static int darwinLedElementGetValue(IOHIDDeviceRef hidDevice, IOHIDElementRef element, bool *fEnabled) { - IOHIDValueRef valueRef; - IOReturn rc; - CFIndex integerValue; - /* Try to resume suspended keyboard devices. Abort if failed in order to avoid GUI freezes. */ int rc1 = SUPR3ResumeSuspendedKeyboards(); if (RT_FAILURE(rc1)) return rc1; - rc = IOHIDDeviceGetValue(hidDevice, element, &valueRef); + IOHIDValueRef valueRef; + IOReturn rc = IOHIDDeviceGetValue(hidDevice, element, &valueRef); if (rc == kIOReturnSuccess) { - integerValue = IOHIDValueGetIntegerValue(valueRef); + CFIndex integerValue = IOHIDValueGetIntegerValue(valueRef); switch (integerValue) { case 0: @@ -1334,7 +1331,7 @@ rc = kIOReturnError; } - CFRelease(valueRef); + /*CFRelease(valueRef); - IOHIDDeviceGetValue does not return a reference, so no need to release it. */ } return rc; diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp 2019-07-12 08:49:15.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp 2019-10-10 18:13:32.000000000 +0000 @@ -2566,6 +2566,7 @@ int VBoxVHWAImage::vhwaSurfaceDestroy(struct VBOXVHWACMD_SURF_DESTROY RT_UNTRUSTED_VOLATILE_GUEST *pCmd) { VBoxVHWASurfaceBase *pSurf = handle2Surface(pCmd->u.in.hSurf); + AssertReturn(pSurf, VERR_INVALID_PARAMETER); VBoxVHWASurfList *pList = pSurf->getComplexList(); Assert(pSurf->handle() != VBOXVHWA_SURFHANDLE_INVALID); @@ -2644,7 +2645,9 @@ int VBoxVHWAImage::vhwaSurfaceLock(struct VBOXVHWACMD_SURF_LOCK RT_UNTRUSTED_VOLATILE_GUEST *pCmd) { VBoxVHWASurfaceBase *pSurf = handle2Surface(pCmd->u.in.hSurf); + AssertReturn(pSurf, VERR_INVALID_PARAMETER); VBOXQGLLOG_ENTER(("pSurf (0x%x)\n",pSurf)); + vboxCheckUpdateAddress (pSurf, pCmd->u.in.offSurface); if (pCmd->u.in.rectValid) { @@ -2657,6 +2660,7 @@ int VBoxVHWAImage::vhwaSurfaceUnlock(struct VBOXVHWACMD_SURF_UNLOCK RT_UNTRUSTED_VOLATILE_GUEST *pCmd) { VBoxVHWASurfaceBase *pSurf = handle2Surface(pCmd->u.in.hSurf); + AssertReturn(pSurf, VERR_INVALID_PARAMETER); #ifdef DEBUG_misha /* for performance reasons we should receive unlock for visible surfaces only * other surfaces receive unlock only once becoming visible, e.g. on DdFlip @@ -2704,8 +2708,10 @@ int VBoxVHWAImage::vhwaSurfaceFlip(struct VBOXVHWACMD_SURF_FLIP RT_UNTRUSTED_VOLATILE_GUEST *pCmd) { VBoxVHWASurfaceBase *pTargSurf = handle2Surface(pCmd->u.in.hTargSurf); + AssertReturn(pTargSurf, VERR_INVALID_PARAMETER); VBoxVHWASurfaceBase *pCurrSurf = handle2Surface(pCmd->u.in.hCurrSurf); - VBOXQGLLOG_ENTER(("pTargSurf (0x%x), pCurrSurf (0x%x)\n",pTargSurf,pCurrSurf)); + AssertReturn(pCurrSurf, VERR_INVALID_PARAMETER); + VBOXQGLLOG_ENTER(("pTargSurf (0x%x), pCurrSurf (0x%x)\n", pTargSurf, pCurrSurf)); vboxCheckUpdateAddress (pCurrSurf, pCmd->u.in.offCurrSurface); vboxCheckUpdateAddress (pTargSurf, pCmd->u.in.offTargSurface); @@ -2815,6 +2821,7 @@ int VBoxVHWAImage::vhwaSurfaceOverlayUpdate(struct VBOXVHWACMD_SURF_OVERLAY_UPDATE RT_UNTRUSTED_VOLATILE_GUEST *pCmd) { VBoxVHWASurfaceBase *pSrcSurf = handle2Surface(pCmd->u.in.hSrcSurf); + AssertReturn(pSrcSurf, VERR_INVALID_PARAMETER); VBoxVHWASurfList *pList = pSrcSurf->getComplexList(); vboxCheckUpdateAddress (pSrcSurf, pCmd->u.in.offSrcSurface); VBOXQGLLOG(("OverlayUpdate: pSrcSurf (0x%x)\n",pSrcSurf)); @@ -2823,6 +2830,7 @@ if (pCmd->u.in.hDstSurf) { pDstSurf = handle2Surface(pCmd->u.in.hDstSurf); + AssertReturn(pDstSurf, VERR_INVALID_PARAMETER); vboxCheckUpdateAddress (pDstSurf, pCmd->u.in.offDstSurface); VBOXQGLLOG(("pDstSurf (0x%x)\n",pDstSurf)); #ifdef DEBUGVHWASTRICT @@ -2849,6 +2857,7 @@ } if (pCmd->u.in.xFlags & VBOXVHWACMD_SURF_OVERLAY_UPDATE_F_DSTMEMRECT) { + AssertReturn(pDstSurf, VERR_INVALID_PARAMETER); QRect r = VBOXVHWA_CONSTRUCT_QRECT_FROM_RECTL_WH(&pCmd->u.in.xUpdatedDstMemRect); pDstSurf->updatedMem(&r); } @@ -2882,7 +2891,9 @@ int VBoxVHWAImage::vhwaSurfaceOverlaySetPosition(struct VBOXVHWACMD_SURF_OVERLAY_SETPOSITION RT_UNTRUSTED_VOLATILE_GUEST *pCmd) { VBoxVHWASurfaceBase *pDstSurf = handle2Surface(pCmd->u.in.hDstSurf); + AssertReturn(pDstSurf, VERR_INVALID_PARAMETER); VBoxVHWASurfaceBase *pSrcSurf = handle2Surface(pCmd->u.in.hSrcSurf); + AssertReturn(pSrcSurf, VERR_INVALID_PARAMETER); VBOXQGLLOG_ENTER(("pDstSurf (0x%x), pSrcSurf (0x%x)\n",pDstSurf,pSrcSurf)); @@ -2923,6 +2934,7 @@ int VBoxVHWAImage::vhwaSurfaceColorkeySet(struct VBOXVHWACMD_SURF_COLORKEY_SET RT_UNTRUSTED_VOLATILE_GUEST *pCmd) { VBoxVHWASurfaceBase *pSurf = handle2Surface(pCmd->u.in.hSurf); + AssertReturn(pSurf, VERR_INVALID_PARAMETER); VBOXQGLLOG_ENTER(("pSurf (0x%x)\n", pSurf)); vboxCheckUpdateAddress (pSurf, pCmd->u.in.offSurface); diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/GuestHost/OpenGL/include/cr_unpack.h virtualbox-hwe-5.2.34-dfsg/src/VBox/GuestHost/OpenGL/include/cr_unpack.h --- virtualbox-hwe-5.2.32-dfsg/src/VBox/GuestHost/OpenGL/include/cr_unpack.h 2019-07-12 08:49:27.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/GuestHost/OpenGL/include/cr_unpack.h 2019-10-10 18:13:45.000000000 +0000 @@ -114,12 +114,21 @@ } \ while (0) +#define CHECK_ARRAY_SIZE_STATIC_UPDATE(a_pState, a_offAccessLast, a_cElements, a_cbType) \ + do \ + { \ + AssertReturnVoidStmt((size_t)(a_cElements) < (size_t)(UINT32_MAX / 4 / (a_cbType)), \ + (a_pState)->rcUnpack = VERR_OUT_OF_RANGE); \ + CHECK_BUFFER_SIZE_STATIC_UPDATE(a_pState, a_offAccessLast + (a_cElements) * (a_cbType)); \ + } while (0) + #define CHECK_BUFFER_SIZE_STATIC_UPDATE_LAST(a_pState, a_offAccessLast, a_Type) CHECK_BUFFER_SIZE_STATIC_UPDATE(a_pState, (a_offAccessLast) + sizeof( a_Type )) #define CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(a_pState, a_pArrayStart, a_cElements, a_Type) \ - CHECK_BUFFER_SIZE_STATIC_UPDATE(a_pState, ((const uint8_t *)a_pArrayStart - (a_pState)->pbUnpackData) + (a_cElements) * sizeof(a_Type)) + CHECK_ARRAY_SIZE_STATIC_UPDATE(a_pState, ((const uint8_t *)a_pArrayStart - (a_pState)->pbUnpackData), a_cElements, sizeof(a_Type)) + #define CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_SZ_LAST(a_pState, a_pArrayStart, a_cElements, a_cbType) \ - CHECK_BUFFER_SIZE_STATIC_UPDATE(a_pState, ((const uint8_t *)a_pArrayStart - (a_pState)->pbUnpackData) + (a_cElements) * (a_cbType)) + CHECK_ARRAY_SIZE_STATIC_UPDATE(a_pState, ((const uint8_t *)a_pArrayStart - (a_pState)->pbUnpackData), a_cElements, a_cbType) DECLINLINE(size_t) crUnpackAcccessChkStrUpdate(PCrUnpackerState pState, const char *psz, size_t *pcbVerified) diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c virtualbox-hwe-5.2.34-dfsg/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c --- virtualbox-hwe-5.2.32-dfsg/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c 2019-07-12 08:49:30.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c 2019-10-10 18:13:47.000000000 +0000 @@ -1527,7 +1527,7 @@ pProgram->pUniforms = NULL; pProgram->cUniforms = 0; - crHashtableWalk(pProgram->activeState.attachedShaders, crStateDetachShaderCB, pProgram); + crHashtableWalk(pProgram->activeState.attachedShaders, crStateDetachShaderCB, &Args); crHashtableWalk(pProgram->currentState.attachedShaders, crStateAttachShaderCB, &Args); } diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c virtualbox-hwe-5.2.34-dfsg/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c --- virtualbox-hwe-5.2.32-dfsg/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c 2019-07-12 08:49:30.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c 2019-10-10 18:13:48.000000000 +0000 @@ -1594,7 +1594,7 @@ ui32 = crHashtableNumElements(pContext->shared->textureTable); rc = SSMR3PutU32(pSSM, ui32); AssertRCReturn(rc, rc); - crHashtableWalk(pContext->shared->textureTable, crStateSaveSharedTextureCB, pSSM); + crHashtableWalk(pContext->shared->textureTable, crStateSaveSharedTextureCB, &Args); #ifdef CR_STATE_NO_TEXTURE_IMAGE_STORE /* Restore previous texture bindings via diff_api */ @@ -1787,11 +1787,11 @@ ui32 = crHashtableNumElements(pContext->glsl.shaders); rc = SSMR3PutU32(pSSM, ui32); AssertRCReturn(rc, rc); - crHashtableWalk(pContext->glsl.shaders, crStateSaveGLSLShaderCB, pSSM); + crHashtableWalk(pContext->glsl.shaders, crStateSaveGLSLShaderCB, &Args); ui32 = crHashtableNumElements(pContext->glsl.programs); rc = SSMR3PutU32(pSSM, ui32); AssertRCReturn(rc, rc); - crHashtableWalk(pContext->glsl.programs, crStateSaveGLSLProgramCB, pSSM); + crHashtableWalk(pContext->glsl.programs, crStateSaveGLSLProgramCB, &Args); rc = SSMR3PutU32(pSSM, pContext->glsl.activeProgram?pContext->glsl.activeProgram->id:0); AssertRCReturn(rc, rc); #endif @@ -1916,6 +1916,8 @@ if (!pTmpContext) return VERR_NO_MEMORY; + pTmpContext->pStateTracker = pState; + pTmpContext->bufferobject.pStateTracker = pState; CRASSERT(VBoxTlsRefIsFunctional(pContext)); if (u32Version <= SHCROGL_SSM_VERSION_WITH_INVALID_ERROR_STATE) @@ -2034,6 +2036,9 @@ AssertRCReturn(rc, rc); } + pTmpContext->pStateTracker = pState; /* Set to a valid pointer again. */ + pTmpContext->bufferobject.pStateTracker = pState; + /* preserve the error to restore it at the end of context creation, * it should not normally change, but just in case it it changed */ err = pTmpContext->error; diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/SUPDrvGip.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/SUPDrvGip.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/SUPDrvGip.cpp 2019-07-12 08:49:31.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/SUPDrvGip.cpp 2019-10-10 18:13:49.000000000 +0000 @@ -1875,10 +1875,15 @@ cbGipCpuGroups = 0; #endif cbGip = RT_UOFFSETOF_DYN(SUPGLOBALINFOPAGE, aCPUs[cCpus]) + cbGipCpuGroups; + if (cbGip > _64K) + { + SUPR0Printf("VBoxDrv: GIP too big: %#zx bytes, max 64KiB; cCpus=%u - upgrade to 6.1\n", cbGip, cCpus); + return VERR_TOO_MANY_CPUS; + } rc = RTR0MemObjAllocCont(&pDevExt->GipMemObj, cbGip, false /*fExecutable*/); if (RT_FAILURE(rc)) { - OSDBGPRINT(("supdrvGipCreate: failed to allocate the GIP page. rc=%d\n", rc)); + OSDBGPRINT(("supdrvGipCreate: failed to allocate the GIP pages. rc=%d cbGip=%#zx\n", rc, cbGip)); return rc; } pGip = (PSUPGLOBALINFOPAGE)RTR0MemObjAddress(pDevExt->GipMemObj); AssertPtr(pGip); diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp 2019-07-12 08:49:32.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp 2019-10-10 18:13:49.000000000 +0000 @@ -2504,7 +2504,7 @@ && supR3HardenedWinIsReSpawnNeeded(1 /*iWhich*/, argc, argv)) { SUP_DPRINTF(("SUPR3HardenedMain: Respawn #1\n")); - supR3HardenedWinInit(SUPSECMAIN_FLAGS_DONT_OPEN_DEV, false /*fAvastKludge*/); + supR3HardenedWinInit(SUPSECMAIN_FLAGS_DONT_OPEN_DEV | SUPSECMAIN_FLAGS_FIRST_PROCESS, false /*fAvastKludge*/); supR3HardenedVerifyAll(true /* fFatal */, pszProgName, g_szSupLibHardenedExePath, fFlags); return supR3HardenedWinReSpawn(1 /*iWhich*/); } diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/win/import-template-ntdll.h virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/win/import-template-ntdll.h --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/win/import-template-ntdll.h 2019-07-12 08:49:33.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/win/import-template-ntdll.h 2019-10-10 18:13:51.000000000 +0000 @@ -50,6 +50,7 @@ SUPHARNT_IMPORT_SYSCALL(NtSuspendThread, 8) SUPHARNT_IMPORT_SYSCALL(NtTerminateProcess, 8) SUPHARNT_IMPORT_SYSCALL(NtTerminateThread, 8) +SUPHARNT_IMPORT_SYSCALL(NtTestAlert, 0) SUPHARNT_IMPORT_SYSCALL(NtUnmapViewOfSection, 8) SUPHARNT_IMPORT_SYSCALL(NtWaitForMultipleObjects, 20) SUPHARNT_IMPORT_SYSCALL(NtWaitForSingleObject, 12) diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyProcess-win.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyProcess-win.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyProcess-win.cpp 2019-07-12 08:49:33.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyProcess-win.cpp 2019-10-10 18:13:51.000000000 +0000 @@ -488,7 +488,8 @@ #ifdef IN_RING3 if ( pThis->enmKind == SUPHARDNTVPKIND_CHILD_PURIFICATION - || pThis->enmKind == SUPHARDNTVPKIND_SELF_PURIFICATION) + || pThis->enmKind == SUPHARDNTVPKIND_SELF_PURIFICATION + || pThis->enmKind == SUPHARDNTVPKIND_SELF_PURIFICATION_LIMITED) { PVOID pvRestoreAddr = (uint8_t *)pImage->uImageBase + uRva; rcNt = supHardNtVpFileMemRestore(pThis, pvRestoreAddr, pbFile, cbThis, fCorrectProtection); @@ -528,7 +529,8 @@ if (!cb) return VINF_SUCCESS; if ( pThis->enmKind == SUPHARDNTVPKIND_CHILD_PURIFICATION - || pThis->enmKind == SUPHARDNTVPKIND_SELF_PURIFICATION) + || pThis->enmKind == SUPHARDNTVPKIND_SELF_PURIFICATION + || pThis->enmKind == SUPHARDNTVPKIND_SELF_PURIFICATION_LIMITED) return VINF_SUCCESS; for (uint32_t i = 0; i < pImage->cRegions; i++) @@ -869,7 +871,7 @@ * Figure out areas we should skip during comparison. */ uint32_t cSkipAreas = 0; - SUPHNTVPSKIPAREA aSkipAreas[5]; + SUPHNTVPSKIPAREA aSkipAreas[6]; if (pImage->fNtCreateSectionPatch) { RTLDRADDR uValue; @@ -897,6 +899,13 @@ aSkipAreas[cSkipAreas].uRva = (uint32_t)uValue; aSkipAreas[cSkipAreas++].cb = 14; + /* Ignore our patched KiUserApcDispatcher hack. */ + rc = RTLdrGetSymbolEx(pImage->pCacheEntry->hLdrMod, pbBits, 0, UINT32_MAX, "KiUserApcDispatcher", &uValue); + if (RT_FAILURE(rc)) + return supHardNtVpSetInfo2(pThis, rc, "%s: Failed to find 'KiUserApcDispatcher': %Rrc", pImage->pszName, rc); + aSkipAreas[cSkipAreas].uRva = (uint32_t)uValue; + aSkipAreas[cSkipAreas++].cb = 14; + /* LdrSystemDllInitBlock is filled in by the kernel. It mainly contains addresses of 32-bit ntdll method for wow64. */ rc = RTLdrGetSymbolEx(pImage->pCacheEntry->hLdrMod, pbBits, 0, UINT32_MAX, "LdrSystemDllInitBlock", &uValue); if (RT_SUCCESS(rc)) @@ -1300,6 +1309,12 @@ pThis->cFixes++; SUP_DPRINTF(("supHardNtVpScanVirtualMemory: NtUnmapViewOfSection(,%p) failed: %#x\n", pMemInfo->AllocationBase, rcNt)); } + else if (pThis->enmKind == SUPHARDNTVPKIND_SELF_PURIFICATION_LIMITED) + { + SUP_DPRINTF(("supHardNtVpScanVirtualMemory: Ignoring unknown mem at %p LB %#zx (base %p) - '%ls'\n", + pMemInfo->BaseAddress, pMemInfo->RegionSize, pMemInfo->AllocationBase, pwszFilename)); + return VINF_OBJECT_DESTROYED; + } #endif /* * Special error message if we can. @@ -1468,12 +1483,12 @@ /* * In the BSOD workaround mode, we need to make a copy of the memory before - * freeing it. + * freeing it. Bird abuses this code for logging purposes too. */ uintptr_t uCopySrc = (uintptr_t)pvFree; size_t cbCopy = 0; void *pvCopy = NULL; - if (pThis->fFlags & SUPHARDNTVP_F_EXEC_ALLOC_REPLACE_WITH_RW) + //if (pThis->fFlags & SUPHARDNTVP_F_EXEC_ALLOC_REPLACE_WITH_RW) { cbCopy = cbFree; pvCopy = RTMemAllocZ(cbCopy); @@ -1487,7 +1502,15 @@ if (!NT_SUCCESS(rcNt)) supHardNtVpSetInfo2(pThis, VERR_SUP_VP_REPLACE_VIRTUAL_MEMORY_FAILED, "Error reading data from original alloc: %#x (%p LB %#zx)", rcNt, uCopySrc, cbCopy, rcNt); - supR3HardenedLogFlush(); + for (size_t off = 0; off < cbCopy; off += 256) + { + size_t const cbChunk = RT_MIN(256, cbCopy - off); + void const *pvChunk = (uint8_t const *)pvCopy + off; + if (!ASMMemIsZero(pvChunk, cbChunk)) + SUP_DPRINTF(("%.*RhxD\n", cbChunk, pvChunk)); + } + if (pThis->fFlags & SUPHARDNTVP_F_EXEC_ALLOC_REPLACE_WITH_RW) + supR3HardenedLogFlush(); } /* @@ -1811,7 +1834,7 @@ MemInfo.Type, MemInfo.AllocationBase, MemInfo.BaseAddress, MemInfo.RegionSize); pThis->cFixes++; } - else + else if (pThis->enmKind != SUPHARDNTVPKIND_SELF_PURIFICATION_LIMITED) # endif /* IN_RING3 */ supHardNtVpSetInfo2(pThis, VERR_SUP_VP_FOUND_EXEC_MEMORY, "Found executable memory at %p (%p LB %#zx): type=%#x prot=%#x state=%#x aprot=%#x abase=%p", @@ -2372,7 +2395,8 @@ if (iNtDll == UINT32_MAX) return supHardNtVpSetInfo2(pThis, VERR_SUP_VP_NO_NTDLL_MAPPING, "The process has no NTDLL.DLL."); - if (iKernel32 == UINT32_MAX && pThis->enmKind == SUPHARDNTVPKIND_SELF_PURIFICATION) + if (iKernel32 == UINT32_MAX && ( pThis->enmKind == SUPHARDNTVPKIND_SELF_PURIFICATION + || pThis->enmKind == SUPHARDNTVPKIND_SELF_PURIFICATION_LIMITED)) return supHardNtVpSetInfo2(pThis, VERR_SUP_VP_NO_KERNEL32_MAPPING, "The process has no KERNEL32.DLL."); else if (iKernel32 != UINT32_MAX && pThis->enmKind == SUPHARDNTVPKIND_CHILD_PURIFICATION) @@ -2428,7 +2452,8 @@ * allocate any state memory for these. */ int rc = VINF_SUCCESS; - if (enmKind != SUPHARDNTVPKIND_CHILD_PURIFICATION) + if ( enmKind != SUPHARDNTVPKIND_CHILD_PURIFICATION + && enmKind != SUPHARDNTVPKIND_SELF_PURIFICATION_LIMITED) rc = supHardNtVpThread(hProcess, hThread, pErrInfo); if (RT_SUCCESS(rc)) rc = supHardNtVpDebugger(hProcess, pErrInfo); diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/win/SUPHardenedVerify-win.h virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/win/SUPHardenedVerify-win.h --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/win/SUPHardenedVerify-win.h 2019-07-12 08:49:33.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/win/SUPHardenedVerify-win.h 2019-10-10 18:13:51.000000000 +0000 @@ -51,6 +51,7 @@ SUPHARDNTVPKIND_VERIFY_ONLY = 1, SUPHARDNTVPKIND_CHILD_PURIFICATION, SUPHARDNTVPKIND_SELF_PURIFICATION, + SUPHARDNTVPKIND_SELF_PURIFICATION_LIMITED, SUPHARDNTVPKIND_32BIT_HACK = 0x7fffffff } SUPHARDNTVPKIND; /** @name SUPHARDNTVP_F_XXX - Flags for supHardenedWinVerifyProcess diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainA-win.asm virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainA-win.asm --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainA-win.asm 2019-07-12 08:49:33.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/win/SUPR3HardenedMainA-win.asm 2019-10-10 18:13:51.000000000 +0000 @@ -33,6 +33,7 @@ ; External code. extern NAME(supR3HardenedEarlyProcessInit) +extern NAME(supR3HardenedMonitor_KiUserApcDispatcher_C) BEGINCODE @@ -107,6 +108,81 @@ ENDPROC supR3HardenedEarlyProcessInitThunk +;; +; Hook for KiUserApcDispatcher that validates user APC calls during early process +; init to prevent calls going to or referring to executable memory we've freed +; already. +; +; We just call C code here, just like supR3HardenedEarlyProcessInitThunk does. +; +; @sa supR3HardenedMonitor_KiUserApcDispatcher_C +; +BEGINPROC supR3HardenedMonitor_KiUserApcDispatcher + ; + ; Prologue. + ; + + ; Reserve space for the "return" address. + push 0 + + ; Create a stack frame, saving xBP. + push xBP + SEH64_PUSH_xBP + mov xBP, xSP + SEH64_SET_FRAME_xBP 0 ; probably wrong... + + ; Save all volatile registers. + push xAX + push xCX + push xDX +%ifdef RT_ARCH_AMD64 + push r8 + push r9 + push r10 + push r11 +%endif + + ; Reserve spill space and align the stack. + sub xSP, 20h + and xSP, ~0fh + SEH64_END_PROLOGUE + + ; + ; Call the C/C++ code that does the actual work. This returns the + ; resume address in xAX, which we put in the "return" stack position. + ; + ; On AMD64, a CONTEXT structure is found at our RSP address when we're called. + ; On x86, there a 16 byte structure containing the two routines and their + ; arguments followed by a CONTEXT structure. + ; + lea xCX, [xBP + xCB + xCB] +%ifdef RT_ARCH_X86 + mov [xSP], xCX +%endif + call NAME(supR3HardenedMonitor_KiUserApcDispatcher_C) + mov [xBP + xCB], xAX + + ; + ; Restore volatile registers. + ; + mov xAX, [xBP - xCB*1] + mov xCX, [xBP - xCB*2] + mov xDX, [xBP - xCB*3] +%ifdef RT_ARCH_AMD64 + mov r8, [xBP - xCB*4] + mov r9, [xBP - xCB*5] + mov r10, [xBP - xCB*6] + mov r11, [xBP - xCB*7] +%endif + ; + ; Use the leave instruction to restore xBP and set up xSP to point at + ; the resume address. Then use the 'ret' instruction to execute the + ; original KiUserApcDispatcher code as if we've never been here... + ; + leave + ret +ENDPROC supR3HardenedMonitor_KiUserApcDispatcher + ;; ; Composes a standard call name. diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp 2019-07-12 08:49:33.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp 2019-10-10 18:13:51.000000000 +0000 @@ -290,7 +290,7 @@ * @{ */ /** Pointer to the bit of assembly code that will perform the original * NtCreateSection operation. */ -static NTSTATUS (NTAPI * g_pfnNtCreateSectionReal)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, +static NTSTATUS (NTAPI *g_pfnNtCreateSectionReal)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PLARGE_INTEGER, ULONG, ULONG, HANDLE); /** Pointer to the NtCreateSection function in NtDll (for patching purposes). */ static uint8_t *g_pbNtCreateSection; @@ -298,12 +298,24 @@ static uint8_t g_abNtCreateSectionPatch[16]; /** Pointer to the bit of assembly code that will perform the original * LdrLoadDll operation. */ -static NTSTATUS (NTAPI * g_pfnLdrLoadDllReal)(PWSTR, PULONG, PUNICODE_STRING, PHANDLE); +static NTSTATUS (NTAPI *g_pfnLdrLoadDllReal)(PWSTR, PULONG, PUNICODE_STRING, PHANDLE); /** Pointer to the LdrLoadDll function in NtDll (for patching purposes). */ static uint8_t *g_pbLdrLoadDll; /** The patched LdrLoadDll bytes (for restoring). */ static uint8_t g_abLdrLoadDllPatch[16]; +/** Pointer to the bit of assembly code that will perform the original + * KiUserApcDispatcher operation. */ +static VOID (NTAPI *g_pfnKiUserApcDispatcherReal)(void); +/** Pointer to the KiUserApcDispatcher function in NtDll (for patching + * purposes). */ +static uint8_t *g_pbKiUserApcDispatcher; +/** The patched KiUserApcDispatcher bytes (for restoring). */ +static uint8_t g_abKiUserApcDispatcherPatch[16]; +/** Pointer to the LdrInitializeThunk function in NtDll for + * supR3HardenedMonitor_KiUserApcDispatcher_C() to use for APC vetting. */ +static uintptr_t g_pfnLdrInitializeThunk; + /** The hash table of verifier cache . */ static PVERIFIERCACHEENTRY volatile g_apVerifierCache[128]; /** Queue of cached images which needs WinVerifyTrust to check them. */ @@ -377,6 +389,8 @@ #define SUPHARDNT_ADVERSARY_AVECTO RT_BIT_32(17) /** Sophos Endpoint Defense. */ #define SUPHARDNT_ADVERSARY_SOPHOS RT_BIT_32(18) +/** VMware horizon view agent. */ +#define SUPHARDNT_ADVERSARY_HORIZON_VIEW_AGENT RT_BIT_32(19) /** Unknown adversary detected while waiting on child. */ #define SUPHARDNT_ADVERSARY_UNKNOWN RT_BIT_32(31) /** @} */ @@ -391,6 +405,7 @@ static void supR3HardenedWinRegisterDllNotificationCallback(void); static void supR3HardenedWinReInstallHooks(bool fFirst); DECLASM(void) supR3HardenedEarlyProcessInitThunk(void); +DECLASM(void) supR3HardenedMonitor_KiUserApcDispatcher(void); #if 0 /* unused */ @@ -2459,6 +2474,64 @@ } +/** + * Dummy replacement routine we use for passifying unwanted user APC + * callbacks during early process initialization. + * + * @sa supR3HardenedMonitor_KiUserApcDispatcher_C + */ +static VOID NTAPI supR3HardenedWinDummyApcRoutine(PVOID pvArg1, PVOID pvArg2, PVOID pvArg3) +{ + SUP_DPRINTF(("supR3HardenedWinDummyApcRoutine: pvArg1=%p pvArg2=%p pvArg3=%p\n", pvArg1, pvArg2, pvArg3)); + RT_NOREF(pvArg1, pvArg2, pvArg3); +} + + +/** + * This is called when ntdll!KiUserApcDispatcher is invoked (via + * supR3HardenedMonitor_KiUserApcDispatcher). + * + * The parent process hooks KiUserApcDispatcher before the guest starts + * executing. There should only be one APC request dispatched while the process + * is being initialized, and that's the one calling ntdll!LdrInitializeThunk. + * + * @returns Where to go to run the original code. + * @param pvApcArgs The APC dispatcher arguments. + */ +DECLASM(uintptr_t) supR3HardenedMonitor_KiUserApcDispatcher_C(void *pvApcArgs) +{ +#ifdef RT_ARCH_AMD64 + PCONTEXT pCtx = (PCONTEXT)pvApcArgs; + uintptr_t *ppfnRoutine = (uintptr_t *)&pCtx->P4Home; +#else + struct X86APCCTX + { + uintptr_t pfnRoutine; + uintptr_t pvCtx; + uintptr_t pvUser1; + uintptr_t pvUser2; + CONTEXT Ctx; + } *pCtx = (struct X86APCCTX *)pvApcArgs; + uintptr_t *ppfnRoutine = &pCtx->pfnRoutine; +#endif + uintptr_t pfnRoutine = *ppfnRoutine; + + if (g_enmSupR3HardenedMainState < SUPR3HARDENEDMAINSTATE_HARDENED_MAIN_CALLED) + { + if (pfnRoutine == g_pfnLdrInitializeThunk) /* Note! we could use this to detect thread creation too. */ + SUP_DPRINTF(("supR3HardenedMonitor_KiUserApcDispatcher_C: pfnRoutine=%p enmState=%d - okay\n", + pfnRoutine, g_enmSupR3HardenedMainState)); + else + { + *ppfnRoutine = (uintptr_t)supR3HardenedWinDummyApcRoutine; + SUP_DPRINTF(("supR3HardenedMonitor_KiUserApcDispatcher_C: pfnRoutine=%p enmState=%d -> supR3HardenedWinDummyApcRoutine\n", + pfnRoutine, g_enmSupR3HardenedMainState)); + } + } + return (uintptr_t)g_pfnKiUserApcDispatcherReal; +} + + static void supR3HardenedWinHookFailed(const char *pszWhich, uint8_t const *pbPrologue) { supR3HardenedFatalMsg("supR3HardenedWinInstallHooks", kSupInitOp_Misc, VERR_NO_MEMORY, @@ -2620,8 +2693,9 @@ const char *pszName; } const s_aPatches[] = { - { sizeof(g_abNtCreateSectionPatch), g_abNtCreateSectionPatch, &g_pbNtCreateSection, "NtCreateSection" }, - { sizeof(g_abLdrLoadDllPatch), g_abLdrLoadDllPatch, &g_pbLdrLoadDll, "LdrLoadDll" }, + { sizeof(g_abNtCreateSectionPatch), g_abNtCreateSectionPatch, &g_pbNtCreateSection, "NtCreateSection" }, + { sizeof(g_abLdrLoadDllPatch), g_abLdrLoadDllPatch, &g_pbLdrLoadDll, "LdrLoadDll" }, + { sizeof(g_abKiUserApcDispatcherPatch), g_abKiUserApcDispatcherPatch, &g_pbKiUserApcDispatcher, "KiUserApcDispatcher" }, }; ULONG fAmIAlone = ~(ULONG)0; @@ -2730,6 +2804,11 @@ SUPR3HARDENED_ASSERT(pfnLdrLoadDll != NULL); //SUPR3HARDENED_ASSERT(pfnLdrLoadDll == (FARPROC)LdrLoadDll); + PFNRT pfnKiUserApcDispatcher = supR3HardenedWinGetRealDllSymbol("ntdll.dll", "KiUserApcDispatcher"); + SUPR3HARDENED_ASSERT(pfnKiUserApcDispatcher != NULL); + g_pfnLdrInitializeThunk = (uintptr_t)supR3HardenedWinGetRealDllSymbol("ntdll.dll", "LdrInitializeThunk"); + SUPR3HARDENED_ASSERT(g_pfnLdrInitializeThunk != NULL); + /* * Exec page setup & management. */ @@ -2888,6 +2967,94 @@ #endif /* + * Hook #3 - KiUserApcDispatcher + * Purpose: Prevent user APC to memory we (or our parent) has freed from + * crashing the process. Also ensures no code injection via user + * APC during process init given the way we're vetting the APCs. + * + * This differs from the first function in that is no a system call and + * we're at the mercy of the handwritten assembly. + * + * Note! We depend on all waits up past the patching to be non-altertable, + * otherwise an APC might slip by us. + */ + uint8_t * const pbKiUserApcDispatcher = (uint8_t *)(uintptr_t)pfnKiUserApcDispatcher; + g_pbKiUserApcDispatcher = pbKiUserApcDispatcher; + memcpy(g_abKiUserApcDispatcherPatch, pbKiUserApcDispatcher, sizeof(g_abKiUserApcDispatcherPatch)); + +#ifdef RT_ARCH_AMD64 + /* + * Patch 64-bit hosts. + */ + /* Just use the disassembler to skip 12 bytes or more. */ + offJmpBack = 0; + while (offJmpBack < 12) + { + cbInstr = 1; + int rc = DISInstr(pbKiUserApcDispatcher + offJmpBack, DISCPUMODE_64BIT, &Dis, &cbInstr); + if ( RT_FAILURE(rc) + || (Dis.pCurInstr->fOpType & (DISOPTYPE_CONTROLFLOW)) + || (Dis.ModRM.Bits.Mod == 0 && Dis.ModRM.Bits.Rm == 5 /* wrt RIP */) ) + supR3HardenedWinHookFailed("KiUserApcDispatcher", pbKiUserApcDispatcher); + offJmpBack += cbInstr; + } + + /* Assemble the code for resuming the call.*/ + *(PFNRT *)&g_pfnKiUserApcDispatcherReal = (PFNRT)(uintptr_t)&g_abSupHardReadWriteExecPage[offExecPage]; + + memcpy(&g_abSupHardReadWriteExecPage[offExecPage], pbKiUserApcDispatcher, offJmpBack); + offExecPage += offJmpBack; + + g_abSupHardReadWriteExecPage[offExecPage++] = 0xff; /* jmp qword [$+8 wrt RIP] */ + g_abSupHardReadWriteExecPage[offExecPage++] = 0x25; + *(uint32_t *)&g_abSupHardReadWriteExecPage[offExecPage] = RT_ALIGN_32(offExecPage + 4, 8) - (offExecPage + 4); + offExecPage = RT_ALIGN_32(offExecPage + 4, 8); + *(uint64_t *)&g_abSupHardReadWriteExecPage[offExecPage] = (uintptr_t)&pbKiUserApcDispatcher[offJmpBack]; + offExecPage = RT_ALIGN_32(offExecPage + 8, 16); + + /* Assemble the KiUserApcDispatcher patch. */ + Assert(offJmpBack >= 12); + g_abKiUserApcDispatcherPatch[0] = 0x48; /* mov rax, qword */ + g_abKiUserApcDispatcherPatch[1] = 0xb8; + *(uint64_t *)&g_abKiUserApcDispatcherPatch[2] = (uint64_t)supR3HardenedMonitor_KiUserApcDispatcher; + g_abKiUserApcDispatcherPatch[10] = 0xff; /* jmp rax */ + g_abKiUserApcDispatcherPatch[11] = 0xe0; + +#else + /* + * Patch 32-bit hosts. + */ + /* Just use the disassembler to skip 5 bytes or more. */ + offJmpBack = 0; + while (offJmpBack < 5) + { + cbInstr = 1; + int rc = DISInstr(pbKiUserApcDispatcher + offJmpBack, DISCPUMODE_32BIT, &Dis, &cbInstr); + if ( RT_FAILURE(rc) + || (Dis.pCurInstr->fOpType & (DISOPTYPE_CONTROLFLOW)) ) + supR3HardenedWinHookFailed("KiUserApcDispatcher", pbKiUserApcDispatcher); + offJmpBack += cbInstr; + } + + /* Assemble the code for resuming the call.*/ + *(PFNRT *)&g_pfnKiUserApcDispatcherReal = (PFNRT)(uintptr_t)&g_abSupHardReadWriteExecPage[offExecPage]; + + memcpy(&g_abSupHardReadWriteExecPage[offExecPage], pbKiUserApcDispatcher, offJmpBack); + offExecPage += offJmpBack; + + g_abSupHardReadWriteExecPage[offExecPage++] = 0xe9; /* jmp rel32 */ + *(uint32_t *)&g_abSupHardReadWriteExecPage[offExecPage] = (uintptr_t)&pbKiUserApcDispatcher[offJmpBack] + - (uintptr_t)&g_abSupHardReadWriteExecPage[offExecPage + 4]; + offExecPage = RT_ALIGN_32(offExecPage + 4, 16); + + /* Assemble the KiUserApcDispatcher patch. */ + memcpy(g_abKiUserApcDispatcherPatch, pbKiUserApcDispatcher, sizeof(g_abKiUserApcDispatcherPatch)); + Assert(offJmpBack >= 5); + g_abKiUserApcDispatcherPatch[0] = 0xe9; + *(uint32_t *)&g_abKiUserApcDispatcherPatch[1] = (uintptr_t)supR3HardenedMonitor_KiUserApcDispatcher - (uintptr_t)&pbKiUserApcDispatcher[1+4]; +#endif + + /* * Seal the rwx page. */ SUPR3HARDENED_ASSERT_NT_SUCCESS(supR3HardenedWinProtectMemory(g_abSupHardReadWriteExecPage, PAGE_SIZE, PAGE_EXECUTE_READ)); @@ -3016,7 +3183,7 @@ static int supR3HardNtEnableThreadCreationEx(HANDLE hProcess, void *pvLdrInitThunk, uint8_t const *pabBackup, size_t cbBackup, PRTERRINFO pErrInfo) { - SUP_DPRINTF(("supR3HardNtEnableThreadCreation:\n")); + SUP_DPRINTF(("supR3HardNtEnableThreadCreationEx:\n")); SUPR3HARDENED_ASSERT(cbBackup == 16); PVOID pvProt = pvLdrInitThunk; @@ -3025,13 +3192,13 @@ NTSTATUS rcNt = NtProtectVirtualMemory(hProcess, &pvProt, &cbProt, PAGE_EXECUTE_READWRITE, &fOldProt); if (!NT_SUCCESS(rcNt)) return RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, - "supR3HardNtDisableThreadCreationEx: NtProtectVirtualMemory/LdrInitializeThunk failed: %#x", rcNt); + "supR3HardNtEnableThreadCreationEx: NtProtectVirtualMemory/LdrInitializeThunk failed: %#x", rcNt); SIZE_T cbIgnored; rcNt = NtWriteVirtualMemory(hProcess, pvLdrInitThunk, pabBackup, cbBackup, &cbIgnored); if (!NT_SUCCESS(rcNt)) return RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, - "supR3HardNtEnableThreadCreation: NtWriteVirtualMemory/LdrInitializeThunk[restore] failed: %#x", + "supR3HardNtEnableThreadCreationEx: NtWriteVirtualMemory/LdrInitializeThunk[restore] failed: %#x", rcNt); pvProt = pvLdrInitThunk; @@ -3039,7 +3206,7 @@ rcNt = NtProtectVirtualMemory(hProcess, &pvProt, &cbProt, fOldProt, &fOldProt); if (!NT_SUCCESS(rcNt)) return RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, - "supR3HardNtEnableThreadCreation: NtProtectVirtualMemory/LdrInitializeThunk[restore] failed: %#x", + "supR3HardNtEnableThreadCreationEx: NtProtectVirtualMemory/LdrInitializeThunk[restore] failed: %#x", rcNt); return VINF_SUCCESS; @@ -4992,6 +5159,20 @@ */ supR3HardenedWinInstallHooks(); } + else if (fFlags & SUPSECMAIN_FLAGS_FIRST_PROCESS) + { + /* + * Try shake anyone (e.g. easyhook) patching process creation code in + * kernelbase, kernel32 or ntdll so they won't so easily cause the child + * to crash when we respawn and purify it. + */ + SUP_DPRINTF(("supR3HardenedWinInit: Performing a limited self purification...\n")); + uint32_t cFixes = 0; + rc = supHardenedWinVerifyProcess(NtCurrentProcess(), NtCurrentThread(), SUPHARDNTVPKIND_SELF_PURIFICATION_LIMITED, + 0 /*fFlags*/, &cFixes, NULL /*pErrInfo*/); + SUP_DPRINTF(("supR3HardenedWinInit: SUPHARDNTVPKIND_SELF_PURIFICATION_LIMITED -> %Rrc, cFixes=%d\n", rc, cFixes)); + RT_NOREF(rc); /* ignored on purpose */ + } #ifndef VBOX_WITH_VISTA_NO_SP /* @@ -5812,6 +5993,8 @@ { SUPHARDNT_ADVERSARY_AVECTO, "PGDriver" }, { SUPHARDNT_ADVERSARY_SOPHOS, "SophosED" }, /* Not verified. */ + + { SUPHARDNT_ADVERSARY_HORIZON_VIEW_AGENT, "vmwicpdr" }, }; static const struct @@ -5938,6 +6121,9 @@ { SUPHARDNT_ADVERSARY_AVECTO, L"\\SystemRoot\\System32\\drivers\\PGDriver.sys" }, { SUPHARDNT_ADVERSARY_SOPHOS, L"\\SystemRoot\\System32\\drivers\\SophosED.sys" }, // not verified + + { SUPHARDNT_ADVERSARY_HORIZON_VIEW_AGENT, L"\\SystemRoot\\System32\\drivers\\vmwicpdr.sys" }, + { SUPHARDNT_ADVERSARY_HORIZON_VIEW_AGENT, L"\\SystemRoot\\System32\\drivers\\ftsjail.sys" }, }; uint32_t fFound = 0; @@ -6206,6 +6392,12 @@ { supR3HardenedWinRegisterDllNotificationCallback(); supR3HardenedWinReInstallHooks(false /*fFirstCall */); + + /* + * Flush user APCs before the g_enmSupR3HardenedMainState changes + * and disables the APC restrictions. + */ + NtTestAlert(); } /* @@ -6325,7 +6517,7 @@ /* Wait up to 2 mins for the parent to exorcise evil. */ LARGE_INTEGER Timeout; Timeout.QuadPart = -1200000000; /* 120 second */ - rcNt = pfnNtWaitForSingleObject(hEvtChild, FALSE /*Alertable*/, &Timeout); + rcNt = pfnNtWaitForSingleObject(hEvtChild, FALSE /*Alertable (never alertable before hooking!) */, &Timeout); if (rcNt != STATUS_SUCCESS) return 0x34; /* crash */ diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c 2019-07-12 08:49:34.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c 2019-10-10 18:13:52.000000000 +0000 @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2017 Oracle Corporation + * Copyright (C) 2006-2019 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -2145,7 +2145,9 @@ #endif if (in_dev != NULL) { - for_ifa(in_dev) { + struct in_ifaddr *ifa; + + for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { if (VBOX_IPV4_IS_LOOPBACK(ifa->ifa_address)) return NOTIFY_OK; @@ -2159,7 +2161,7 @@ pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort, /* :fAdded */ true, kIntNetAddrType_IPv4, &ifa->ifa_address); - } endfor_ifa(in_dev); + } } /* diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/cmn/VBoxUsbTool.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/cmn/VBoxUsbTool.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/cmn/VBoxUsbTool.cpp 2019-07-12 08:49:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/cmn/VBoxUsbTool.cpp 2019-10-10 18:13:53.000000000 +0000 @@ -403,14 +403,14 @@ if (Status == STATUS_PENDING) { - LOG(("VBoxUsbToolIoInternalCtlSendAsync returned pending for pDevObj(0x%x)", pDevObj)); + LOG(("VBoxUsbToolIoInternalCtlSendAsync returned pending for pDevObj(0x%p)", pDevObj)); KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); Status = IoStatus.Status; - LOG(("Pending VBoxUsbToolIoInternalCtlSendAsync completed with Status (0x%x) for pDevObj(0x%x)", Status, pDevObj)); + LOG(("Pending VBoxUsbToolIoInternalCtlSendAsync completed with Status (0x%x) for pDevObj(0x%p)", Status, pDevObj)); } else { - LOG(("VBoxUsbToolIoInternalCtlSendAsync completed with Status (0x%x) for pDevObj(0x%x)", Status, pDevObj)); + LOG(("VBoxUsbToolIoInternalCtlSendAsync completed with Status (0x%x) for pDevObj(0x%p)", Status, pDevObj)); } return Status; diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp 2019-07-12 08:49:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp 2019-10-10 18:13:53.000000000 +0000 @@ -50,11 +50,10 @@ #include #include #include +#include -#define VBOX_USB_USE_DEVICE_NOTIFICATION - -#ifdef VBOX_USB_USE_DEVICE_NOTIFICATION -# include +#ifdef VBOX_WITH_NEW_USB_ENUM +# include #endif @@ -80,12 +79,10 @@ HANDLE hMonitor; HANDLE hNotifyEvent; HANDLE hInterruptEvent; -#ifdef VBOX_USB_USE_DEVICE_NOTIFICATION HANDLE hThread; HWND hWnd; HANDLE hTimerQueue; HANDLE hTimer; -#endif } VBOXUSBGLOBALSTATE, *PVBOXUSBGLOBALSTATE; typedef struct VBOXUSB_STRING_DR_ENTRY @@ -113,17 +110,19 @@ static VBOXUSBGLOBALSTATE g_VBoxUsbGlobal; -int usbLibVuDeviceValidate(PVBOXUSB_DEV pVuDev) +static int usbLibVuDeviceValidate(PVBOXUSB_DEV pVuDev) { - HANDLE hOut = INVALID_HANDLE_VALUE; + HANDLE hOut = INVALID_HANDLE_VALUE; + DWORD dwErr; hOut = CreateFile(pVuDev->szName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM, NULL); if (hOut == INVALID_HANDLE_VALUE) { - DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsgFailed(("CreateFile FAILED to open %s, dwErr (%d)\n", pVuDev->szName, dwErr)); + dwErr = GetLastError(); + AssertMsgFailed(("CreateFile FAILED to open %s, dwErr=%u\n", pVuDev->szName, dwErr)); + LogRelFunc(("Failed to open `%s' (dwErr=%u)!\n", pVuDev->szName, dwErr)); return VERR_GENERAL_FAILURE; } @@ -135,7 +134,9 @@ { if (!DeviceIoControl(hOut, SUPUSB_IOCTL_GET_VERSION, NULL, 0,&version, sizeof(version), &cbReturned, NULL)) { - AssertMsgFailed(("DeviceIoControl SUPUSB_IOCTL_GET_VERSION failed with LastError=%Rwa\n", GetLastError())); + dwErr = GetLastError(); + AssertMsgFailed(("DeviceIoControl SUPUSB_IOCTL_GET_VERSION failed with LastError=%Rwa\n", dwErr)); + LogRelFunc(("SUPUSB_IOCTL_GET_VERSION failed on `%s' (dwErr=%u)!\n", pVuDev->szName, dwErr)); break; } @@ -146,12 +147,15 @@ ) { AssertMsgFailed(("Invalid version %d:%d vs %d:%d\n", version.u32Major, version.u32Minor, USBDRV_MAJOR_VERSION, USBDRV_MINOR_VERSION)); + LogRelFunc(("Invalid version %d:%d (%s) vs %d:%d (library)!\n", version.u32Major, version.u32Minor, pVuDev->szName, USBDRV_MAJOR_VERSION, USBDRV_MINOR_VERSION)); break; } if (!DeviceIoControl(hOut, SUPUSB_IOCTL_IS_OPERATIONAL, NULL, 0, NULL, NULL, &cbReturned, NULL)) { - AssertMsgFailed(("DeviceIoControl SUPUSB_IOCTL_IS_OPERATIONAL failed with LastError=%Rwa\n", GetLastError())); + dwErr = GetLastError(); + AssertMsgFailed(("DeviceIoControl SUPUSB_IOCTL_IS_OPERATIONAL failed with LastError=%Rwa\n", dwErr)); + LogRelFunc(("SUPUSB_IOCTL_IS_OPERATIONAL failed on `%s' (dwErr=%u)!\n", pVuDev->szName, dwErr)); break; } @@ -216,6 +220,7 @@ } rc = usbLibVuDeviceValidate(pVuDev); + LogRelFunc(("Found VBoxUSB on `%s' (rc=%d)\n", pVuDev->szName, rc)); AssertRC(rc); } while (0); @@ -246,7 +251,7 @@ if (hDevInfo == INVALID_HANDLE_VALUE) { DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsgFailed(("SetupDiGetClassDevs, dwErr (%d)\n", dwErr)); + AssertMsgFailed(("SetupDiGetClassDevs, dwErr (%u)\n", dwErr)); return VERR_GENERAL_FAILURE; } @@ -264,7 +269,7 @@ if (dwErr == ERROR_NO_MORE_ITEMS) break; - AssertMsgFailed(("SetupDiEnumDeviceInterfaces, dwErr (%d), resuming\n", dwErr)); + AssertMsgFailed(("SetupDiEnumDeviceInterfaces, dwErr (%u), resuming\n", dwErr)); continue; } @@ -362,6 +367,7 @@ RTStrFree(lpszName); } +#ifndef VBOX_WITH_NEW_USB_ENUM static int usbLibDevStrDriverKeyGet(HANDLE hHub, ULONG iPort, LPSTR* plpszName) { USB_NODE_CONNECTION_DRIVERKEY_NAME Name; @@ -371,7 +377,7 @@ if (!DeviceIoControl(hHub, IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, &Name, sizeof (Name), &Name, sizeof (Name), &cbReturned, NULL)) { #ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS - AssertMsgFailed(("DeviceIoControl 1 fail dwErr (%d)\n", GetLastError())); + AssertMsgFailed(("DeviceIoControl 1 fail dwErr (%u)\n", GetLastError())); #endif return VERR_GENERAL_FAILURE; } @@ -401,12 +407,13 @@ else { DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsgFailed(("DeviceIoControl 2 fail dwErr (%d)\n", dwErr)); + AssertMsgFailed(("DeviceIoControl 2 fail dwErr (%u)\n", dwErr)); rc = VERR_GENERAL_FAILURE; } RTMemFree(pName); return rc; } +#endif static int usbLibDevStrHubNameGet(HANDLE hHub, ULONG iPort, LPSTR* plpszName) { @@ -480,7 +487,7 @@ return rc; } -static int usbLibDevCfgDrGet(HANDLE hHub, ULONG iPort, ULONG iDr, PUSB_CONFIGURATION_DESCRIPTOR *ppDr) +static int usbLibDevCfgDrGet(HANDLE hHub, LPCSTR lpcszHubName, ULONG iPort, ULONG iDr, PUSB_CONFIGURATION_DESCRIPTOR *ppDr) { *ppDr = NULL; @@ -499,7 +506,7 @@ &cbReturned, NULL)) { DWORD dwErr = GetLastError(); - LogRelFunc(("DeviceIoControl 1 fail dwErr (%d)\n", dwErr)); + LogRelFunc(("IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION #1 failed (dwErr=%u) on hub %s port %d\n", dwErr, lpcszHubName, iPort)); #ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS AssertFailed(); #endif @@ -536,7 +543,7 @@ &cbReturned, NULL)) { DWORD dwErr = GetLastError(); - LogRelFunc(("DeviceIoControl 2 fail dwErr (%d)\n", dwErr)); + LogRelFunc(("IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION #2 failed (dwErr=%u) on hub %s port %d\n", dwErr, lpcszHubName, iPort)); #ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS AssertFailed(); #endif @@ -570,7 +577,7 @@ RTMemFree(pRq); } -static int usbLibDevStrDrEntryGet(HANDLE hHub, ULONG iPort, ULONG iDr, USHORT idLang, PVBOXUSB_STRING_DR_ENTRY *ppList) +static int usbLibDevStrDrEntryGet(HANDLE hHub, LPCSTR lpcszHubName, ULONG iPort, ULONG iDr, USHORT idLang, PVBOXUSB_STRING_DR_ENTRY *ppList) { char szBuf[sizeof (USB_DESCRIPTOR_REQUEST) + MAXIMUM_USB_STRING_LENGTH]; RT_ZERO(szBuf); @@ -590,7 +597,7 @@ &cbReturned, NULL)) { DWORD dwErr = GetLastError(); - LogRel(("Getting USB descriptor (id %u) failed with error %ld\n", iDr, dwErr)); + LogRel(("Getting USB descriptor (id %u) failed (dwErr=%u) on hub %s port %d\n", iDr, dwErr, lpcszHubName, iPort)); return RTErrConvertFromWin32(dwErr); } @@ -639,19 +646,19 @@ } } -static int usbLibDevStrDrEntryGetForLangs(HANDLE hHub, ULONG iPort, ULONG iDr, ULONG cIdLang, const USHORT *pIdLang, PVBOXUSB_STRING_DR_ENTRY *ppList) +static int usbLibDevStrDrEntryGetForLangs(HANDLE hHub, LPCSTR lpcszHubName, ULONG iPort, ULONG iDr, ULONG cIdLang, const USHORT *pIdLang, PVBOXUSB_STRING_DR_ENTRY *ppList) { for (ULONG i = 0; i < cIdLang; ++i) { - usbLibDevStrDrEntryGet(hHub, iPort, iDr, pIdLang[i], ppList); + usbLibDevStrDrEntryGet(hHub, lpcszHubName, iPort, iDr, pIdLang[i], ppList); } return VINF_SUCCESS; } -static int usbLibDevStrDrEntryGetAll(HANDLE hHub, ULONG iPort, PUSB_DEVICE_DESCRIPTOR pDevDr, PUSB_CONFIGURATION_DESCRIPTOR pCfgDr, PVBOXUSB_STRING_DR_ENTRY *ppList) +static int usbLibDevStrDrEntryGetAll(HANDLE hHub, LPCSTR lpcszHubName, ULONG iPort, PUSB_DEVICE_DESCRIPTOR pDevDr, PUSB_CONFIGURATION_DESCRIPTOR pCfgDr, PVBOXUSB_STRING_DR_ENTRY *ppList) { /* Read string descriptor zero to determine what languages are available. */ - int rc = usbLibDevStrDrEntryGet(hHub, iPort, 0, 0, ppList); + int rc = usbLibDevStrDrEntryGet(hHub, lpcszHubName, iPort, 0, 0, ppList); if (RT_FAILURE(rc)) return rc; @@ -661,19 +668,19 @@ if (pDevDr->iManufacturer) { - rc = usbLibDevStrDrEntryGetForLangs(hHub, iPort, pDevDr->iManufacturer, cIdLang, pIdLang, ppList); + rc = usbLibDevStrDrEntryGetForLangs(hHub, lpcszHubName, iPort, pDevDr->iManufacturer, cIdLang, pIdLang, ppList); AssertRC(rc); } if (pDevDr->iProduct) { - rc = usbLibDevStrDrEntryGetForLangs(hHub, iPort, pDevDr->iProduct, cIdLang, pIdLang, ppList); + rc = usbLibDevStrDrEntryGetForLangs(hHub, lpcszHubName, iPort, pDevDr->iProduct, cIdLang, pIdLang, ppList); AssertRC(rc); } if (pDevDr->iSerialNumber) { - rc = usbLibDevStrDrEntryGetForLangs(hHub, iPort, pDevDr->iSerialNumber, cIdLang, pIdLang, ppList); + rc = usbLibDevStrDrEntryGetForLangs(hHub, lpcszHubName, iPort, pDevDr->iSerialNumber, cIdLang, pIdLang, ppList); AssertRC(rc); } @@ -704,7 +711,7 @@ PUSB_CONFIGURATION_DESCRIPTOR pCurCfgDr = (PUSB_CONFIGURATION_DESCRIPTOR)pCmnDr; if (!pCurCfgDr->iConfiguration) break; - rc = usbLibDevStrDrEntryGetForLangs(hHub, iPort, pCurCfgDr->iConfiguration, cIdLang, pIdLang, ppList); + rc = usbLibDevStrDrEntryGetForLangs(hHub, lpcszHubName, iPort, pCurCfgDr->iConfiguration, cIdLang, pIdLang, ppList); AssertRC(rc); break; } @@ -718,7 +725,7 @@ PUSB_INTERFACE_DESCRIPTOR pCurIfDr = (PUSB_INTERFACE_DESCRIPTOR)pCmnDr; if (!pCurIfDr->iInterface) break; - rc = usbLibDevStrDrEntryGetForLangs(hHub, iPort, pCurIfDr->iInterface, cIdLang, pIdLang, ppList); + rc = usbLibDevStrDrEntryGetForLangs(hHub, lpcszHubName, iPort, pCurIfDr->iInterface, cIdLang, pIdLang, ppList); AssertRC(rc); break; } @@ -732,6 +739,7 @@ return VINF_SUCCESS; } +#ifndef VBOX_WITH_NEW_USB_ENUM static int usbLibDevGetHubDevices(LPCSTR lpszName, PUSBDEVICE *ppDevs, uint32_t *pcDevs); static int usbLibDevGetHubPortDevices(HANDLE hHub, LPCSTR lpcszHubName, ULONG iPort, PUSBDEVICE *ppDevs, uint32_t *pcDevs) @@ -749,8 +757,8 @@ &cbReturned, NULL)) { DWORD dwErr = GetLastError(); NOREF(dwErr); - LogRel(("Getting USB connection information failed with error %ld\n", dwErr)); - AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed dwErr (%d)\n", dwErr)); + LogRel(("Getting USB connection information failed (dwErr=%u) on hub %s\n", dwErr, lpcszHubName)); + AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed (dwErr=%u)\n", dwErr)); return VERR_GENERAL_FAILURE; } @@ -762,13 +770,13 @@ if (pConInfo->DeviceIsHub) { - LPSTR lpszHubName = NULL; - rc = usbLibDevStrHubNameGet(hHub, iPort, &lpszHubName); + LPSTR lpszChildHubName = NULL; + rc = usbLibDevStrHubNameGet(hHub, iPort, &lpszChildHubName); AssertRC(rc); if (RT_SUCCESS(rc)) { - rc = usbLibDevGetHubDevices(lpszHubName, ppDevs, pcDevs); - usbLibDevStrFree(lpszHubName); + rc = usbLibDevGetHubDevices(lpszChildHubName, ppDevs, pcDevs); + usbLibDevStrFree(lpszChildHubName); AssertRC(rc); return rc; } @@ -783,16 +791,17 @@ Assert(!!lpszName == !!RT_SUCCESS(rc)); if (!lpszName) { + LogRelFunc(("No DriverKey on hub %s port %d\n", lpcszHubName, iPort)); lpszName = &nameEmptyBuf; fFreeNameBuf = false; } PUSB_CONFIGURATION_DESCRIPTOR pCfgDr = NULL; PVBOXUSB_STRING_DR_ENTRY pList = NULL; - rc = usbLibDevCfgDrGet(hHub, iPort, 0, &pCfgDr); + rc = usbLibDevCfgDrGet(hHub, lpcszHubName, iPort, 0, &pCfgDr); if (pCfgDr) { - rc = usbLibDevStrDrEntryGetAll(hHub, iPort, &pConInfo->DeviceDescriptor, pCfgDr, &pList); + rc = usbLibDevStrDrEntryGetAll(hHub, lpcszHubName, iPort, &pConInfo->DeviceDescriptor, pCfgDr, &pList); #ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS AssertRC(rc); // this can fail if device suspended #endif @@ -858,7 +867,7 @@ &NodeInfo, sizeof (NodeInfo), &cbReturned, NULL)) { - LogRel(("Getting USB node information failed with error %ld\n", GetLastError())); + LogRel(("Getting USB node information failed (dwErr=%u) on hub %s\n", GetLastError(), lpszName)); AssertFailed(); break; } @@ -877,7 +886,361 @@ return rc; } +#endif + +#ifdef VBOX_WITH_NEW_USB_ENUM + +/* Get a registry property for a device given its HDEVINFO + SP_DEVINFO_DATA. */ +static void *usbLibGetRegistryProperty(HDEVINFO InfoSet, const PSP_DEVINFO_DATA DevData, DWORD Property) +{ + BOOL rc; + DWORD dwReqLen; + void *PropertyData; + + /* How large a buffer do we need? */ + rc = SetupDiGetDeviceRegistryProperty(InfoSet, DevData, Property, + NULL, NULL, 0, &dwReqLen); + if (!rc && (GetLastError() != ERROR_INSUFFICIENT_BUFFER)) + { + LogRelFunc(("Failed to query buffer size, error %ld\n", GetLastError())); + return NULL; + } + + PropertyData = RTMemAlloc(dwReqLen); + if (!PropertyData) + return NULL; + + /* Get the actual property data. */ + rc = SetupDiGetDeviceRegistryProperty(InfoSet, DevData, Property, + NULL, (PBYTE)PropertyData, dwReqLen, &dwReqLen); + if (!rc) + { + LogRelFunc(("Failed to get property data, error %ld\n", GetLastError())); + RTMemFree(PropertyData); + return NULL; + } + return PropertyData; +} + +/* Given a HDEVINFO and SP_DEVICE_INTERFACE_DATA, get the interface detail data. */ +static PSP_DEVICE_INTERFACE_DETAIL_DATA usbLibGetDevDetail(HDEVINFO InfoSet, PSP_DEVICE_INTERFACE_DATA InterfaceData) +{ + BOOL rc; + DWORD dwReqLen; + PSP_DEVICE_INTERFACE_DETAIL_DATA DetailData; + + rc = SetupDiGetDeviceInterfaceDetail(InfoSet, InterfaceData, NULL, 0, &dwReqLen, NULL); + if (!rc && (GetLastError() != ERROR_INSUFFICIENT_BUFFER)) + { + LogRelFunc(("Failed to get interface detail size, error %ld\n", GetLastError())); + return NULL; + } + + DetailData = (PSP_DEVICE_INTERFACE_DETAIL_DATA)RTMemAlloc(dwReqLen); + if (!DetailData) + return NULL; + + memset(DetailData, 0, dwReqLen); + DetailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); + + rc = SetupDiGetDeviceInterfaceDetail(InfoSet, InterfaceData, DetailData, dwReqLen, &dwReqLen, NULL); + if (!rc) + { + LogRelFunc(("Failed to get interface detail, error %ld\n", GetLastError())); + RTMemFree(DetailData); + } + + return DetailData; +} + +/* Given a hub's PnP device instance, find its device path (file name). */ +static LPCSTR usbLibGetHubPathFromInstanceID(LPCSTR InstanceID) +{ + HDEVINFO InfoSet; + SP_DEVICE_INTERFACE_DATA InterfaceData; + PSP_DEVICE_INTERFACE_DETAIL_DATA DetailData; + BOOL rc; + LPSTR DevicePath = NULL; + + /* Enumerate the DevInst's USB hub interface. */ + InfoSet = SetupDiGetClassDevs(&GUID_DEVINTERFACE_USB_HUB, InstanceID, NULL, + DIGCF_DEVICEINTERFACE | DIGCF_PRESENT); + if (InfoSet == INVALID_HANDLE_VALUE) + { + LogRelFunc(("Failed to get interface for InstID %se, error %ld\n", InstanceID, GetLastError())); + return NULL; + } + + memset(&InterfaceData, 0, sizeof(InterfaceData)); + InterfaceData.cbSize = sizeof(InterfaceData); + rc = SetupDiEnumDeviceInterfaces(InfoSet, 0, &GUID_DEVINTERFACE_USB_HUB, 0, &InterfaceData); + if (!rc) + { + DWORD dwErr = GetLastError(); + + /* The parent device might not be a hub; that is valid, ignore such errors. */ + if (dwErr != ERROR_NO_MORE_ITEMS) + LogRelFunc(("Failed to get interface data for InstID %s, error %ld\n", InstanceID, dwErr)); + SetupDiDestroyDeviceInfoList(InfoSet); + return NULL; + } + + DetailData = usbLibGetDevDetail(InfoSet, &InterfaceData); + if (!DetailData) + { + SetupDiDestroyDeviceInfoList(InfoSet); + return NULL; + } + + /* Copy the device path out of the interface detail. */ + DevicePath = RTStrDup(DetailData->DevicePath); + RTMemFree(DetailData); + SetupDiDestroyDeviceInfoList(InfoSet); + + return DevicePath; +} + + +/* Use the Configuration Manager (CM) to get a devices's parent given its DEVINST and + * turn it into a PnP device instance ID string. + */ +static LPCSTR usbLibGetParentInstanceID(DEVINST DevInst) +{ + LPSTR InstanceID; + DEVINST ParentInst; + ULONG ulReqChars; + ULONG ulReqBytes; + CONFIGRET cr; + + /* First get the parent DEVINST. */ + cr = CM_Get_Parent(&ParentInst, DevInst, 0); + if (cr != CR_SUCCESS) + { + LogRelFunc(("Failed to get parent instance, error %ld\n", GetLastError())); + return NULL; + } + + /* Then convert it to the instance ID string. */ + cr = CM_Get_Device_ID_Size(&ulReqChars, ParentInst, 0); + if (cr != CR_SUCCESS) + { + LogRelFunc(("Failed to get device ID size (DevInst=%X), error %ld\n", DevInst, GetLastError())); + return NULL; + } + + /* CM_Get_Device_ID_Size gives us the size in characters without terminating null. */ + ulReqBytes = (ulReqChars + 1) * sizeof(char); + InstanceID = (LPSTR)RTMemAlloc(ulReqBytes); + if (!InstanceID) + return NULL; + + cr = CM_Get_Device_ID(ParentInst, InstanceID, ulReqBytes, 0); + if (cr != CR_SUCCESS) + { + LogRelFunc(("Failed to get device ID (DevInst=%X), error %ld\n", DevInst, GetLastError())); + RTMemFree(InstanceID); + return NULL; + } + + return InstanceID; +} + +/* Process a single USB device that's being enumerated and grab its hub-specific data. */ +static int usbLibDevGetDevice(LPCSTR lpcszHubFile, ULONG iPort, LPCSTR Location, PUSBDEVICE *ppDevs, uint32_t *pcDevs) +{ + HANDLE HubDevice; + BYTE abConBuf[sizeof(USB_NODE_CONNECTION_INFORMATION_EX)]; + PUSB_NODE_CONNECTION_INFORMATION_EX pConInfo = PUSB_NODE_CONNECTION_INFORMATION_EX(abConBuf); + int rc = VINF_SUCCESS; + DWORD cbReturned = 0; + + /* Validate inputs. */ + if ((iPort < 1) || (iPort > 255)) + { + LogRelFunc(("Port index out of range (%u)\n", iPort)); + return VERR_INVALID_PARAMETER; + } + if (!lpcszHubFile) + { + LogRelFunc(("Hub path is NULL!\n")); + return VERR_INVALID_PARAMETER; + } + + /* Try opening the hub file so we can send IOCTLs to it. */ + HubDevice = CreateFile(lpcszHubFile, GENERIC_WRITE, FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, 0, NULL); + if (HubDevice == INVALID_HANDLE_VALUE) + { + LogRelFunc(("Failed to open hub `%s' (dwErr=%u)\n", lpcszHubFile, GetLastError())); + return VERR_FILE_NOT_FOUND; + } + + /* The shenanigans with abConBuf are due to USB_NODE_CONNECTION_INFORMATION_EX + * containing a zero-sized array, triggering compiler warnings. + */ + memset(pConInfo, 0, sizeof(abConBuf)); + pConInfo->ConnectionIndex = iPort; + + /* We expect that IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX is always available + * on any supported Windows version and hardware. + * NB: IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX_V2 is Win8 and later only. + */ + if (!DeviceIoControl(HubDevice, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, + pConInfo, sizeof(abConBuf), pConInfo, sizeof(abConBuf), + &cbReturned, NULL)) + { + DWORD dwErr = GetLastError(); NOREF(dwErr); + LogRel(("IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX failed (dwErr=%u) on hub %s, port %d\n", dwErr, lpcszHubFile, iPort)); + AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed dwErr (%u)\n", dwErr)); + CloseHandle(HubDevice); + return VERR_GENERAL_FAILURE; + } + + if (pConInfo->ConnectionStatus != DeviceConnected) + { + /* Ignore this, can't do anything with it. */ + LogFunc(("Device is not connected, skipping.\n")); + CloseHandle(HubDevice); + return VINF_SUCCESS; + } + + if (pConInfo->DeviceIsHub) + { + /* We're ignoring hubs, just skip this. */ + LogFunc(("Device is a hub, skipping.\n")); + CloseHandle(HubDevice); + return VINF_SUCCESS; + } + + PUSB_CONFIGURATION_DESCRIPTOR pCfgDr = NULL; + PVBOXUSB_STRING_DR_ENTRY pList = NULL; + rc = usbLibDevCfgDrGet(HubDevice, lpcszHubFile, iPort, 0, &pCfgDr); + if (pCfgDr) + { + rc = usbLibDevStrDrEntryGetAll(HubDevice, lpcszHubFile, iPort, &pConInfo->DeviceDescriptor, pCfgDr, &pList); +#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS + AssertRC(rc); // this can fail if device suspended +#endif + } + + /* At this point we're done with the hub device. */ + CloseHandle(HubDevice); + + PUSBDEVICE pDev = (PUSBDEVICE)RTMemAllocZ(sizeof (*pDev)); + if (RT_LIKELY(pDev)) + { + rc = usbLibDevPopulate(pDev, pConInfo, iPort, Location, lpcszHubFile, pList); + if (RT_SUCCESS(rc)) + { + pDev->pNext = *ppDevs; + *ppDevs = pDev; + ++*pcDevs; + } + else + RTMemFree(pDev); + } + else + rc = VERR_NO_MEMORY; + + if (pCfgDr) + usbLibDevCfgDrFree(pCfgDr); + if (pList) + usbLibDevStrDrEntryFreeList(pList); + + return rc; +} + + +/* + * Enumerate the USB devices in the host system. Since we do not care about the hierarchical + * structure of root hubs, other hubs, and devices, we just ask the USB PnP enumerator to + * give us all it has. This includes hubs (though not root hubs), as well as multiple child + * interfaces of multi-interface USB devices, which we filter out. It also includes USB + * devices with no driver, which is notably something we cannot get by enumerating via + * GUID_DEVINTERFACE_USB_DEVICE. + * + * This approach also saves us some trouble relative to enumerating devices via hub IOCTLs and + * then hunting through the PnP manager to find them. Instead, we look up the device's parent + * which (for devices we're interested in) is always a hub, and that allows us to obtain + * USB-specific data (descriptors, speeds, etc.) when combined with the devices PnP "address" + * (USB port on parent hub). + * + * NB: Every USB device known to the Windows PnP Manager will have a device instance ID. Typically + * it also has a DriverKey but only if it has a driver installed. Hence we ignore the DriverKey, at + * least prior to capturing (once VBoxUSB.sys is installed, a DriverKey must by definition be + * present). Also note that the device instance ID changes for captured devices since we change + * their USB VID/PID, though it is unique at any given point. + * + * The location information should be a reliable way of identifying a device and does not change + * with driver installs, capturing, etc. USB device location information is only available on + * Windows Vista and later; earlier Windows version had no reliable way of cross-referencing the + * USB IOCTL and PnP Manager data. + */ +static int usbLibDevGetDevices(PUSBDEVICE *ppDevs, uint32_t *pcDevs) +{ + HDEVINFO InfoSet; + DWORD DeviceIndex; + LPDWORD Address; + SP_DEVINFO_DATA DeviceData; + LPCSTR ParentInstID; + LPCSTR HubPath = NULL; + LPCSTR Location; + + /* Ask for the USB PnP enumerator for all it has. */ + InfoSet = SetupDiGetClassDevs(NULL, "USB", NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT); + + memset(&DeviceData, 0, sizeof(DeviceData)); + DeviceData.cbSize = sizeof(DeviceData); + DeviceIndex = 0; + + /* Enumerate everything in the info set. */ + while (SetupDiEnumDeviceInfo(InfoSet, DeviceIndex, &DeviceData)) + { + /* Use the CM API to get the parent instance ID. */ + ParentInstID = usbLibGetParentInstanceID(DeviceData.DevInst); + + /* Now figure out the hub's file path fron the instance ID, if there is one. */ + if (ParentInstID) + HubPath = usbLibGetHubPathFromInstanceID(ParentInstID); + + /* If there's no hub interface on the parent, then this might be a child + * device of a multi-interface device. Either way, we're not interested. + */ + if (HubPath) + { + /* The location information uniquely identifies the USB device, (hub/port). */ + Location = (LPCSTR)usbLibGetRegistryProperty(InfoSet, &DeviceData, SPDRP_LOCATION_INFORMATION); + + /* The device's PnP Manager "address" is the port number on the parent hub. */ + Address = (LPDWORD)usbLibGetRegistryProperty(InfoSet, &DeviceData, SPDRP_ADDRESS); + if (Address && Location) + { + usbLibDevGetDevice(HubPath, *Address, Location, ppDevs, pcDevs); + } + RTMemFree((void *)HubPath); + + if (Location) + RTMemFree((void *)Location); + if (Address) + RTMemFree((void *)Address); + } + + /* Clean up after this device. */ + if (ParentInstID) + RTMemFree((void *)ParentInstID); + + ++DeviceIndex; + memset(&DeviceData, 0, sizeof(DeviceData)); + DeviceData.cbSize = sizeof(DeviceData); + } + + if (InfoSet) + SetupDiDestroyDeviceInfoList(InfoSet); + + return VINF_SUCCESS; +} +#else static int usbLibDevGetDevices(PUSBDEVICE *ppDevs, uint32_t *pcDevs) { char CtlName[16]; @@ -905,6 +1268,7 @@ } return VINF_SUCCESS; } +#endif #if 0 /* unused */ static PUSBSUP_GET_DEVICES usbLibMonGetDevRqAlloc(uint32_t cDevs, PDWORD pcbRq) @@ -956,14 +1320,14 @@ DWORD cbReturned = 0; if (!DeviceIoControl(hDev, SUPUSB_IOCTL_GET_DEVICE, &Dev, sizeof (Dev), &Dev, sizeof (Dev), &cbReturned, NULL)) { + DWORD dwErr = GetLastError(); #ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS - DWORD dwErr = GetLastError(); NOREF(dwErr); - /* ERROR_DEVICE_NOT_CONNECTED -> device was removed just now */ - AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed dwErr (%d)\n", dwErr)); + /* ERROR_DEVICE_NOT_CONNECTED -> device was removed just now */ + AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed dwErr (%u)\n", dwErr)); #endif - Log(("SUPUSB_IOCTL_GET_DEVICE: DeviceIoControl no longer connected\n")); - CloseHandle(hDev); - break; + LogRelFunc(("SUPUSB_IOCTL_GET_DEVICE failed on '%s' (dwErr=%u)!\n", pDevInfos->szName, dwErr)); + CloseHandle(hDev); + break; } /* we must not close the handle until we request for the device state from the monitor to ensure @@ -973,12 +1337,12 @@ HVBOXUSBDEVUSR hDevice = Dev.hDevice; if (!DeviceIoControl(pGlobal->hMonitor, SUPUSBFLT_IOCTL_GET_DEVICE, &hDevice, sizeof (hDevice), &MonInfo, sizeof (MonInfo), &cbReturned, NULL)) { - DWORD dwErr = GetLastError(); NOREF(dwErr); - /* ERROR_DEVICE_NOT_CONNECTED -> device was removed just now */ - AssertMsgFailed(("Monitor DeviceIoControl failed dwErr (%d)\n", dwErr)); - Log(("SUPUSBFLT_IOCTL_GET_DEVICE: DeviceIoControl no longer connected\n")); - CloseHandle(hDev); - break; + DWORD dwErr = GetLastError(); + /* ERROR_DEVICE_NOT_CONNECTED -> device was removed just now */ + AssertMsgFailed(("Monitor DeviceIoControl failed dwErr (%u)\n", dwErr)); + LogRelFunc(("SUPUSBFLT_IOCTL_GET_DEVICE failed for '%s' (hDevice=%p, dwErr=%u)!\n", pDevInfos->szName, hDevice, dwErr)); + CloseHandle(hDev); + break; } CloseHandle(hDev); @@ -1026,6 +1390,7 @@ *ppDevs = NULL; *pcDevs = 0; + LogRelFunc(("Starting USB device enumeration\n")); int rc = usbLibDevGetDevices(ppDevs, pcDevs); AssertRC(rc); if (RT_SUCCESS(rc)) @@ -1041,6 +1406,7 @@ usbLibVuFreeDevices(pDevInfos); } + LogRelFunc(("Found %u USB devices, %u captured\n", *pcDevs, cDevInfos)); return VINF_SUCCESS; } return rc; @@ -1065,7 +1431,7 @@ default: { DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsgFailed(("WaitForMultipleObjects failed, dwErr (%d)\n", dwErr)); + AssertMsgFailed(("WaitForMultipleObjects failed, dwErr (%u)\n", dwErr)); return VERR_GENERAL_FAILURE; } } @@ -1084,7 +1450,7 @@ if (!fRc) { DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsgFailed(("SetEvent failed, dwErr (%d)\n", dwErr)); + AssertMsgFailed(("SetEvent failed, dwErr (%u)\n", dwErr)); return VERR_GENERAL_FAILURE; } return VINF_SUCCESS; @@ -1132,16 +1498,26 @@ &FltAddRc, sizeof(FltAddRc), &cbReturned, NULL)) { - DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsgFailed(("DeviceIoControl failed with dwErr (%d(\n", dwErr)); + DWORD dwErr = GetLastError(); + AssertMsgFailed(("DeviceIoControl failed with dwErr (%u)\n", dwErr)); + LogRelFunc(("SUPUSBFLT_IOCTL_ADD_FILTER failed (dwErr=%u)!\n", dwErr)); return NULL; } if (RT_FAILURE(FltAddRc.rc)) { AssertMsgFailed(("Adding filter failed with %d\n", FltAddRc.rc)); + LogRelFunc(("Adding a USB filter failed with rc=%d!\n", FltAddRc.rc)); return NULL; } + + LogRel(("Added USB filter (ID=%u, type=%d) for device %04X:%04X rev %04X, c/s/p %02X/%02X/%02X, Manufacturer=`%s' Product=`%s' Serial=`%s'\n", FltAddRc.uId, USBFilterGetFilterType(pFilter), + USBFilterGetNum(pFilter, USBFILTERIDX_VENDOR_ID), USBFilterGetNum(pFilter, USBFILTERIDX_PRODUCT_ID), USBFilterGetNum(pFilter, USBFILTERIDX_DEVICE_REV), + USBFilterGetNum(pFilter, USBFILTERIDX_DEVICE_CLASS), USBFilterGetNum(pFilter, USBFILTERIDX_DEVICE_SUB_CLASS), USBFilterGetNum(pFilter, USBFILTERIDX_DEVICE_PROTOCOL), + USBFilterGetString(pFilter, USBFILTERIDX_MANUFACTURER_STR) ? USBFilterGetString(pFilter, USBFILTERIDX_MANUFACTURER_STR) : "", + USBFilterGetString(pFilter, USBFILTERIDX_PRODUCT_STR) ? USBFilterGetString(pFilter, USBFILTERIDX_PRODUCT_STR) : "", + USBFilterGetString(pFilter, USBFILTERIDX_SERIAL_NUMBER_STR) ? USBFilterGetString(pFilter, USBFILTERIDX_SERIAL_NUMBER_STR) : "")); + return (void *)FltAddRc.uId; } @@ -1163,7 +1539,13 @@ uId = (uintptr_t)pvId; if (!DeviceIoControl(g_VBoxUsbGlobal.hMonitor, SUPUSBFLT_IOCTL_REMOVE_FILTER, &uId, sizeof(uId), NULL, 0,&cbReturned, NULL)) - AssertMsgFailed(("DeviceIoControl failed with LastError=%Rwa\n", GetLastError())); + { + DWORD dwErr = GetLastError(); + AssertMsgFailed(("DeviceIoControl failed with LastError=%Rwa\n", dwErr)); + LogRelFunc(("SUPUSBFLT_IOCTL_REMOVE_FILTER failed (dwErr=%u)!\n", dwErr)); + } + else + LogRel(("Removed USB filter ID=%u\n", uId)); } USBLIB_DECL(int) USBLibRunFilters(void) @@ -1178,7 +1560,8 @@ &cbReturned, NULL)) { DWORD dwErr = GetLastError(); - AssertMsgFailed(("DeviceIoControl failed with dwErr (%d(\n", dwErr)); + AssertMsgFailed(("DeviceIoControl failed with dwErr (%u)\n", dwErr)); + LogRelFunc(("SUPUSBFLT_IOCTL_RUN_FILTERS failed (dwErr=%u)!\n", dwErr)); return RTErrConvertFromWin32(dwErr); } @@ -1186,8 +1569,6 @@ } -#ifdef VBOX_USB_USE_DEVICE_NOTIFICATION - static VOID CALLBACK usbLibTimerCallback(__in PVOID lpParameter, __in BOOLEAN TimerOrWaitFired) { RT_NOREF2(lpParameter, TimerOrWaitFired); @@ -1207,7 +1588,7 @@ if (!DeleteTimerQueueTimer(g_VBoxUsbGlobal.hTimerQueue, g_VBoxUsbGlobal.hTimer, NULL)) { DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsg(dwErr == ERROR_IO_PENDING, ("DeleteTimerQueueTimer failed, dwErr (%d)\n", dwErr)); + AssertMsg(dwErr == ERROR_IO_PENDING, ("DeleteTimerQueueTimer failed, dwErr (%u)\n", dwErr)); } } @@ -1219,7 +1600,7 @@ WT_EXECUTEONLYONCE)) { DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsgFailed(("CreateTimerQueueTimer failed, dwErr (%d)\n", dwErr)); + AssertMsgFailed(("CreateTimerQueueTimer failed, dwErr (%u)\n", dwErr)); /* call it directly */ usbLibTimerCallback(NULL, FALSE); @@ -1318,7 +1699,6 @@ return 0; } -#endif /* VBOX_USB_USE_DEVICE_NOTIFICATION */ /** * Initialize the USB library @@ -1339,11 +1719,7 @@ */ g_VBoxUsbGlobal.hNotifyEvent = CreateEvent(NULL, /* LPSECURITY_ATTRIBUTES lpEventAttributes */ FALSE, /* BOOL bManualReset */ -#ifndef VBOX_USB_USE_DEVICE_NOTIFICATION - TRUE, /* BOOL bInitialState */ -#else FALSE, /* set to false since it will be initially used for notification thread startup sync */ -#endif NULL /* LPCTSTR lpName */); if (g_VBoxUsbGlobal.hNotifyEvent) { @@ -1379,7 +1755,7 @@ if (g_VBoxUsbGlobal.hMonitor == INVALID_HANDLE_VALUE) { DWORD dwErr = GetLastError(); - LogRelFunc(("CreateFile failed dwErr(%d)\n", dwErr)); + LogRelFunc(("CreateFile failed (dwErr=%u) for `%s'\n", dwErr, USBMON_DEVICE_NAME)); rc = VERR_FILE_NOT_FOUND; } } @@ -1409,37 +1785,6 @@ #endif ) { -#ifndef VBOX_USB_USE_DEVICE_NOTIFICATION - /* - * Tell the monitor driver which event object to use - * for notifications. - */ - USBSUP_SET_NOTIFY_EVENT SetEvent = {0}; - Assert(g_VBoxUsbGlobal.hNotifyEvent); - SetEvent.u.hEvent = g_VBoxUsbGlobal.hNotifyEvent; - if (DeviceIoControl(g_VBoxUsbGlobal.hMonitor, SUPUSBFLT_IOCTL_SET_NOTIFY_EVENT, - &SetEvent, sizeof(SetEvent), - &SetEvent, sizeof(SetEvent), - &cbReturned, NULL)) - { - rc = SetEvent.u.rc; - if (RT_SUCCESS(rc)) - { - /* - * We're DONE! - */ - return VINF_SUCCESS; - } - - AssertMsgFailed(("SetEvent failed, %Rrc (%d)\n", rc, rc)); - } - else - { - DWORD dwErr = GetLastError(); - AssertMsgFailed(("SetEvent Ioctl failed, dwErr (%d)\n", dwErr)); - rc = VERR_VERSION_MISMATCH; - } -#else /* * We can not use USB Mon for reliable device add/remove tracking * since once USB Mon is notified about PDO creation and/or IRP_MN_START_DEVICE, @@ -1482,13 +1827,13 @@ Assert(dwResult == WAIT_OBJECT_0); BOOL fRc = CloseHandle(g_VBoxUsbGlobal.hThread); NOREF(fRc); DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsg(fRc, ("CloseHandle for hThread failed dwErr(%d)\n", dwErr)); + AssertMsg(fRc, ("CloseHandle for hThread failed (dwErr=%u)\n", dwErr)); g_VBoxUsbGlobal.hThread = INVALID_HANDLE_VALUE; } else { DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsgFailed(("CreateThread failed, dwErr (%d)\n", dwErr)); + AssertMsgFailed(("CreateThread failed, (dwErr=%u)\n", dwErr)); rc = VERR_GENERAL_FAILURE; } @@ -1498,9 +1843,8 @@ else { DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsgFailed(("CreateTimerQueue failed dwErr(%d)\n", dwErr)); + AssertMsgFailed(("CreateTimerQueue failed (dwErr=%u)\n", dwErr)); } -#endif } else { @@ -1515,7 +1859,8 @@ else { DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsgFailed(("DeviceIoControl failed dwErr(%d)\n", dwErr)); + LogRelFunc(("SUPUSBFLT_IOCTL_GET_VERSION failed (dwErr=%u)\n", dwErr)); + AssertFailed(); rc = VERR_VERSION_MISMATCH; } @@ -1536,8 +1881,7 @@ } else { - DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsgFailed(("CreateEvent for InterruptEvent failed dwErr(%d)\n", dwErr)); + AssertMsgFailed(("CreateEvent for InterruptEvent failed (dwErr=%u)\n", GetLastError())); rc = VERR_GENERAL_FAILURE; } @@ -1546,8 +1890,7 @@ } else { - DWORD dwErr = GetLastError(); NOREF(dwErr); - AssertMsgFailed(("CreateEvent for NotifyEvent failed dwErr(%d)\n", dwErr)); + AssertMsgFailed(("CreateEvent for NotifyEvent failed (dwErr=%u)\n", GetLastError())); rc = VERR_GENERAL_FAILURE; } @@ -1574,43 +1917,41 @@ } BOOL fRc; -#ifdef VBOX_USB_USE_DEVICE_NOTIFICATION fRc = PostMessage(g_VBoxUsbGlobal.hWnd, WM_CLOSE, 0, 0); - AssertMsg(fRc, ("PostMessage for hWnd failed dwErr(%d)\n", GetLastError())); + AssertMsg(fRc, ("PostMessage for hWnd failed (dwErr=%u)\n", GetLastError())); if (g_VBoxUsbGlobal.hThread != NULL) { DWORD dwResult = WaitForSingleObject(g_VBoxUsbGlobal.hThread, INFINITE); Assert(dwResult == WAIT_OBJECT_0); NOREF(dwResult); fRc = CloseHandle(g_VBoxUsbGlobal.hThread); - AssertMsg(fRc, ("CloseHandle for hThread failed dwErr(%d)\n", GetLastError())); + AssertMsg(fRc, ("CloseHandle for hThread failed (dwErr=%u)\n", GetLastError())); } if (g_VBoxUsbGlobal.hTimer) { fRc = DeleteTimerQueueTimer(g_VBoxUsbGlobal.hTimerQueue, g_VBoxUsbGlobal.hTimer, INVALID_HANDLE_VALUE); /* <-- to block until the timer is completed */ - AssertMsg(fRc, ("DeleteTimerQueueTimer failed dwErr(%d)\n", GetLastError())); + AssertMsg(fRc, ("DeleteTimerQueueTimer failed (dwErr=%u)\n", GetLastError())); } if (g_VBoxUsbGlobal.hTimerQueue) { fRc = DeleteTimerQueueEx(g_VBoxUsbGlobal.hTimerQueue, INVALID_HANDLE_VALUE); /* <-- to block until all timers are completed */ - AssertMsg(fRc, ("DeleteTimerQueueEx failed dwErr(%d)\n", GetLastError())); + AssertMsg(fRc, ("DeleteTimerQueueEx failed (dwErr=%u)\n", GetLastError())); } -#endif /* VBOX_USB_USE_DEVICE_NOTIFICATION */ fRc = CloseHandle(g_VBoxUsbGlobal.hMonitor); - AssertMsg(fRc, ("CloseHandle for hMonitor failed dwErr(%d)\n", GetLastError())); + AssertMsg(fRc, ("CloseHandle for hMonitor failed (dwErr=%u)\n", GetLastError())); g_VBoxUsbGlobal.hMonitor = INVALID_HANDLE_VALUE; fRc = CloseHandle(g_VBoxUsbGlobal.hInterruptEvent); - AssertMsg(fRc, ("CloseHandle for hInterruptEvent failed lasterr=%u\n", GetLastError())); + AssertMsg(fRc, ("CloseHandle for hInterruptEvent failed (dwErr=%u)\n", GetLastError())); g_VBoxUsbGlobal.hInterruptEvent = NULL; fRc = CloseHandle(g_VBoxUsbGlobal.hNotifyEvent); - AssertMsg(fRc, ("CloseHandle for hNotifyEvent failed dwErr(%d)\n", GetLastError())); + AssertMsg(fRc, ("CloseHandle for hNotifyEvent failed (dwErr=%u)\n", GetLastError())); g_VBoxUsbGlobal.hNotifyEvent = NULL; return VINF_SUCCESS; diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/Makefile.kmk virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/Makefile.kmk --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/Makefile.kmk 2019-07-12 08:49:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/Makefile.kmk 2019-10-10 18:13:53.000000000 +0000 @@ -137,12 +137,13 @@ # USBTest # USBTest_TEMPLATE = VBOXR3EXE -USBTest_DEFS = IN_RT_R3 +USBTest_DEFS = IN_RT_R3 IN_USBLIB USBTest_SDKS = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_NTDLL USBTest_CXXFLAGS = -Gz USBTest_CFLAGS = -Gz USBTest_SOURCES = \ - testcase/USBTest.cpp + testcase/USBTest.cpp \ + ../USBFilter.cpp USBTest_LIBS = \ $(PATH_SDK_$(VBOX_WINDDK)_LIB)/newdev.lib \ $(LIB_RUNTIME) \ diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp 2019-07-12 08:49:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp 2019-10-10 18:13:54.000000000 +0000 @@ -49,6 +49,11 @@ #include +/* We should be including ntifs.h but that's not as easy as it sounds. */ +extern "C" { +NTKERNELAPI PDEVICE_OBJECT IoGetDeviceAttachmentBaseRef(__in PDEVICE_OBJECT DeviceObject); +} + /* * state transitions: * @@ -96,6 +101,8 @@ uintptr_t uFltId; /* true iff device is filtered with a one-shot filter */ bool fIsFilterOneShot; + /* true if descriptors could not be read and only inferred from PnP Manager data */ + bool fInferredDesc; /* The device state. If the non-owner session is requesting the state while the device is grabbed, * the USBDEVICESTATE_USED_BY_HOST is returned. */ VBOXUSBFLT_DEVSTATE enmState; @@ -304,35 +311,6 @@ return NULL; } -PVBOXUSBFLT_DEVICE vboxUsbFltDevGet(PDEVICE_OBJECT pPdo) -{ - PVBOXUSBFLT_DEVICE pDevice; - - VBOXUSBFLT_LOCK_ACQUIRE(); - pDevice = vboxUsbFltDevGetLocked(pPdo); - /* - * Prevent a host crash when vboxUsbFltDevGetLocked fails to locate the matching PDO - * in g_VBoxUsbFltGlobals.DeviceList (see @bugref{6509}). - */ - if (pDevice == NULL) - { - WARN(("failed to get device for PDO(0x%p)", pPdo)); - } - else if (pDevice->enmState > VBOXUSBFLT_DEVSTATE_ADDED) - { - vboxUsbFltDevRetain(pDevice); - LOG(("found device (0x%p), state(%d) for PDO(0x%p)", pDevice, pDevice->enmState, pPdo)); - } - else - { - LOG(("found replugging device (0x%p), state(%d) for PDO(0x%p)", pDevice, pDevice->enmState, pPdo)); - pDevice = NULL; - } - VBOXUSBFLT_LOCK_RELEASE(); - - return pDevice; -} - static NTSTATUS vboxUsbFltPdoReplug(PDEVICE_OBJECT pDo) { LOG(("Replugging PDO(0x%p)", pDo)); @@ -368,12 +346,32 @@ USBFilterSetNumExact(&DevFlt, USBFILTERIDX_VENDOR_ID, pDevice->idVendor, true); USBFilterSetNumExact(&DevFlt, USBFILTERIDX_PRODUCT_ID, pDevice->idProduct, true); USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_REV, pDevice->bcdDevice, true); - USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_CLASS, pDevice->bClass, true); - USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_SUB_CLASS, pDevice->bSubClass, true); - USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_PROTOCOL, pDevice->bProtocol, true); - USBFilterSetStringExact(&DevFlt, USBFILTERIDX_MANUFACTURER_STR, pDevice->szMfgName, true /*fMustBePresent*/, true /*fPurge*/); - USBFilterSetStringExact(&DevFlt, USBFILTERIDX_PRODUCT_STR, pDevice->szProduct, true /*fMustBePresent*/, true /*fPurge*/); - USBFilterSetStringExact(&DevFlt, USBFILTERIDX_SERIAL_NUMBER_STR, pDevice->szSerial, true /*fMustBePresent*/, true /*fPurge*/); + + /* If we could not read a string descriptor, don't set the filter item at all. */ + if (pDevice->szMfgName[0]) + USBFilterSetStringExact(&DevFlt, USBFILTERIDX_MANUFACTURER_STR, pDevice->szMfgName, true /*fMustBePresent*/, true /*fPurge*/); + if (pDevice->szProduct[0]) + USBFilterSetStringExact(&DevFlt, USBFILTERIDX_PRODUCT_STR, pDevice->szProduct, true /*fMustBePresent*/, true /*fPurge*/); + if (pDevice->szSerial[0]) + USBFilterSetStringExact(&DevFlt, USBFILTERIDX_SERIAL_NUMBER_STR, pDevice->szSerial, true /*fMustBePresent*/, true /*fPurge*/); + + /* If device descriptor had to be inferred from PnP Manager data, the class/subclass/protocol may be wrong. + * When Windows reports CompatibleIDs 'USB\Class_03&SubClass_00&Prot_00', the device descriptor might be + * reporting class 3 (HID), *or* the device descriptor might be reporting class 0 (specified by interface) + * and the device's interface reporting class 3. Ignore the class/subclass/protocol in such case, since + * we are more or less guaranteed to rely on VID/PID anyway. + * See @bugref{9479}. + */ + if (pDevice->fInferredDesc) + { + LOG(("Device descriptor was not read, only inferred; ignoring class/subclass/protocol!")); + } + else + { + USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_CLASS, pDevice->bClass, true); + USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_SUB_CLASS, pDevice->bSubClass, true); + USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_PROTOCOL, pDevice->bProtocol, true); + } /* Run filters on the thing. */ PVBOXUSBFLTCTX pOwner = VBoxUSBFilterMatchEx(&DevFlt, puId, fRemoveFltIfOneShot, pfFilter, pfIsOneShot); @@ -419,6 +417,28 @@ return num; } +static uint8_t vboxUsbParseHexNumU8(WCHAR **ppStr) +{ + WCHAR *pStr = *ppStr; + WCHAR wc; + uint16_t num = 0; + unsigned u; + + for (int i = 0; i < 2; ++i) + { + if (!*pStr) /* Just in case the string is too short. */ + break; + + wc = *pStr; + u = wc >= 'A' ? wc - 'A' + 10 : wc - '0'; /* Hex digit to number. */ + num |= u << (4 - 4 * i); + pStr++; + } + *ppStr = pStr; + + return num; +} + static bool vboxUsbParseHardwareID(WCHAR *pchIdStr, uint16_t *pVid, uint16_t *pPid, uint16_t *pRev) { #define VID_PREFIX L"USB\\VID_" @@ -460,6 +480,46 @@ #undef REV_PREFIX } +static bool vboxUsbParseCompatibleIDs(WCHAR *pchIdStr, uint8_t *pClass, uint8_t *pSubClass, uint8_t *pProt) +{ +#define CLS_PREFIX L"USB\\Class_" +#define SUB_PREFIX L"&SubClass_" +#define PRO_PREFIX L"&Prot_" + + *pClass = *pSubClass = *pProt = 0xFF; + + /* The Compatible IDs string is in the format USB\Class_xx&SubClass_xx&Prot_xx, + * with 'xx' being 8-bit hexadecimal numbers. Since this string is provided by the + * PnP manager and USB devices always report these as part of the basic USB device + * descriptor, we assume all three must be present. + */ + + if (wcsncmp(pchIdStr, CLS_PREFIX, wcslen(CLS_PREFIX))) + return false; + /* Point to the start of the device class and parse it. */ + pchIdStr += wcslen(CLS_PREFIX); + *pClass = vboxUsbParseHexNumU8(&pchIdStr); + + if (wcsncmp(pchIdStr, SUB_PREFIX, wcslen(SUB_PREFIX))) + return false; + + /* Point to the start of the subclass and parse it. */ + pchIdStr += wcslen(SUB_PREFIX); + *pSubClass = vboxUsbParseHexNumU8(&pchIdStr); + + if (wcsncmp(pchIdStr, PRO_PREFIX, wcslen(PRO_PREFIX))) + return false; + + /* Point to the start of the protocol and parse it. */ + pchIdStr += wcslen(PRO_PREFIX); + *pProt = vboxUsbParseHexNumU8(&pchIdStr); + + return true; +#undef CLS_PREFIX +#undef SUB_PREFIX +#undef PRO_PREFIX +} + #define VBOXUSBMON_POPULATE_REQUEST_TIMEOUT_MS 10000 static NTSTATUS vboxUsbFltDevPopulate(PVBOXUSBFLT_DEVICE pDevice, PDEVICE_OBJECT pDo /*, BOOLEAN bPopulateNonFilterProps*/) @@ -480,6 +540,7 @@ do { + pDevice->fInferredDesc = false; Status = VBoxUsbToolGetDescriptor(pDo, pDevDr, sizeof(*pDevDr), USB_DEVICE_DESCRIPTOR_TYPE, 0, 0, VBOXUSBMON_POPULATE_REQUEST_TIMEOUT_MS); if (!NT_SUCCESS(Status)) { @@ -487,6 +548,7 @@ ULONG ulResultLen; bool rc; uint16_t vid, pid, rev; + uint8_t cls, sub, prt; WARN(("getting device descriptor failed, Status (0x%x); falling back to IoGetDeviceProperty", Status)); @@ -495,7 +557,7 @@ if (!NT_SUCCESS(Status)) { /* This just isn't our day. We have no idea what the device is. */ - WARN(("IoGetDeviceProperty failed, Status (0x%x)", Status)); + WARN(("IoGetDeviceProperty failed for DevicePropertyHardwareID, Status (0x%x)", Status)); break; } rc = vboxUsbParseHardwareID(wchPropBuf, &vid, &pid, &rev); @@ -506,19 +568,38 @@ break; } - LOG(("Parsed HardwareID: vid=%04X, pid=%04X, rev=%04X", vid, pid, rev)); + /* Now grab the Compatible IDs to get the class/subclass/protocol. */ + Status = IoGetDeviceProperty(pDo, DevicePropertyCompatibleIDs, sizeof(wchPropBuf), wchPropBuf, &ulResultLen); + if (!NT_SUCCESS(Status)) + { + /* We really kind of need these. */ + WARN(("IoGetDeviceProperty failed for DevicePropertyCompatibleIDs, Status (0x%x)", Status)); + break; + } + rc = vboxUsbParseCompatibleIDs(wchPropBuf, &cls, &sub, &prt); + if (!rc) + { + /* This *really* should not happen. */ + WARN(("Failed to parse Hardware ID")); + break; + } + + LOG(("Parsed HardwareID: vid=%04X, pid=%04X, rev=%04X, class=%02X, subcls=%02X, prot=%02X", vid, pid, rev, cls, sub, prt)); if (vid == 0xFFFF || pid == 0xFFFF) break; LOG(("Successfully fell back to IoGetDeviceProperty result")); - /* The vendor/product ID is what matters. */ pDevDr->idVendor = vid; pDevDr->idProduct = pid; pDevDr->bcdDevice = rev; - /* The rest we don't really know. */ - pDevDr->bDeviceClass = 0; - pDevDr->bDeviceSubClass = 0; - pDevDr->bDeviceProtocol = 0; + pDevDr->bDeviceClass = cls; + pDevDr->bDeviceSubClass = sub; + pDevDr->bDeviceProtocol = prt; + + /* The USB device class/subclass/protocol may not be accurate. We have to be careful when comparing + * and not take mismatches too seriously. + */ + pDevice->fInferredDesc = true; } if (vboxUsbFltBlDevMatchLocked(pDevDr->idVendor, pDevDr->idProduct, pDevDr->bcdDevice)) @@ -666,24 +747,6 @@ return Status; } -static void vboxUsbFltSignalChangeLocked() -{ - for (PLIST_ENTRY pEntry = g_VBoxUsbFltGlobals.ContextList.Flink; - pEntry != &g_VBoxUsbFltGlobals.ContextList; - pEntry = pEntry->Flink) - { - PVBOXUSBFLTCTX pCtx = PVBOXUSBFLTCTX_FROM_LE(pEntry); - /* the removed context can not be in a list */ - Assert(!pCtx->bRemoved); - if (pCtx->pChangeEvent) - { - KeSetEvent(pCtx->pChangeEvent, - 0, /* increment*/ - FALSE /* wait */); - } - } -} - static bool vboxUsbFltDevCheckReplugLocked(PVBOXUSBFLT_DEVICE pDevice, PVBOXUSBFLTCTX pContext) { ASSERT_WARN(pContext, ("context is NULL!")); @@ -864,20 +927,19 @@ PVBOXUSBFLTCTX pContext; } VBOXUSBFLTCHECKWALKER, *PVBOXUSBFLTCHECKWALKER; -static DECLCALLBACK(BOOLEAN) vboxUsbFltFilterCheckWalker(PFILE_OBJECT pFile, PDEVICE_OBJECT pTopDo, +static DECLCALLBACK(BOOLEAN) vboxUsbFltFilterCheckWalker(PFILE_OBJECT pHubFile, PDEVICE_OBJECT pHubDo, PVOID pvContext) { - RT_NOREF1(pHubDo); PVBOXUSBFLTCHECKWALKER pData = (PVBOXUSBFLTCHECKWALKER)pvContext; PVBOXUSBFLTCTX pContext = pData->pContext; - LOG(("Visiting pFile(0x%p), pTopDo(0x%p), pHubDo(0x%p), oContext(0x%p)", pFile, pTopDo, pHubDo, pContext)); + LOG(("Visiting pHubFile(0x%p), pHubDo(0x%p), oContext(0x%p)", pHubFile, pHubDo, pContext)); KIRQL Irql = KeGetCurrentIrql(); ASSERT_WARN(Irql == PASSIVE_LEVEL, ("unexpected IRQL (%d)", Irql)); PDEVICE_RELATIONS pDevRelations = NULL; - NTSTATUS Status = VBoxUsbMonQueryBusRelations(pTopDo, pFile, &pDevRelations); + NTSTATUS Status = VBoxUsbMonQueryBusRelations(pHubDo, pHubFile, &pDevRelations); if (Status == STATUS_SUCCESS && pDevRelations) { ULONG cReplugPdos = pDevRelations->Count; @@ -885,7 +947,15 @@ InitializeListHead(&ReplugDevList); for (ULONG k = 0; k < pDevRelations->Count; ++k) { - PDEVICE_OBJECT pDevObj = pDevRelations->Objects[k]; + PDEVICE_OBJECT pDevObj; + + /* Grab the PDO+reference. We won't need the upper layer device object + * anymore, so dereference that right here, and drop the PDO ref later. + */ + pDevObj = IoGetDeviceAttachmentBaseRef(pDevRelations->Objects[k]); + LOG(("DevObj=%p, PDO=%p\n", pDevRelations->Objects[k], pDevObj)); + ObDereferenceObject(pDevRelations->Objects[k]); + pDevRelations->Objects[k] = pDevObj; LOG(("Found existing USB PDO 0x%p", pDevObj)); VBOXUSBFLT_LOCK_ACQUIRE(); @@ -963,13 +1033,13 @@ continue; Status = vboxUsbFltPdoReplug(pDevRelations->Objects[k]); - ASSERT_WARN(Status == STATUS_SUCCESS, ("vboxUsbFltPdoReplug ailed Status(0x%x)", Status)); + ASSERT_WARN(Status == STATUS_SUCCESS, ("vboxUsbFltPdoReplug failed! Status(0x%x)", Status)); ObDereferenceObject(pDevRelations->Objects[k]); if (!--cReplugPdos) break; } - ASSERT_WARN(!cReplugPdos, ("cReplugPdosreached zero!")); + ASSERT_WARN(!cReplugPdos, ("cReplugPdos reached zero!")); } vboxUsbFltReplugList(&ReplugDevList); @@ -978,11 +1048,11 @@ } else { - WARN(("VBoxUsbMonQueryBusRelations failed for DO(0x%p), Status(0x%x), pDevRelations(0x%p)", - pTopDo, Status, pDevRelations)); + WARN(("VBoxUsbMonQueryBusRelations failed for hub DO(0x%p), Status(0x%x), pDevRelations(0x%p)", + pHubDo, Status, pDevRelations)); } - LOG(("Done Visiting pFile(0x%p), pTopDo(0x%p), pHubDo(0x%p), oContext(0x%p)", pFile, pTopDo, pHubDo, pContext)); + LOG(("Done Visiting pHubFile(0x%p), pHubDo(0x%p), oContext(0x%p)", pHubFile, pHubDo, pContext)); return TRUE; } @@ -996,7 +1066,7 @@ VBOXUSBFLTCHECKWALKER Data; Data.pContext = pContext; - vboxUsbMonHubDevWalk(vboxUsbFltFilterCheckWalker, &Data, VBOXUSBMONHUBWALK_F_FDO); + vboxUsbMonHubDevWalk(vboxUsbFltFilterCheckWalker, &Data); LOG(("DONE Running filters, Context (0x%p)", pContext)); @@ -1017,17 +1087,6 @@ VBOXUSBFLT_LOCK_ACQUIRE(); pContext->bRemoved = TRUE; - if (pContext->pChangeEvent) - { - LOG(("seting & closing change event (0x%p)", pContext->pChangeEvent)); - KeSetEvent(pContext->pChangeEvent, - 0, /* increment*/ - FALSE /* wait */); - ObDereferenceObject(pContext->pChangeEvent); - pContext->pChangeEvent = NULL; - } - else - LOG(("no change event")); RemoveEntryList(&pContext->ListEntry); LOG(("removing owner filters")); @@ -1114,6 +1173,22 @@ USBFilterSetMustBePresent(pFilter, USBFILTERIDX_BUS, false); USBFilterSetMustBePresent(pFilter, USBFILTERIDX_PORT, false); + /* We may not be able to reconstruct the class/subclass/protocol if we aren't able to + * read the device descriptor. Don't require these to be present. See also the fInferredDesc flag. + */ + USBFilterSetMustBePresent(pFilter, USBFILTERIDX_DEVICE_CLASS, false); + USBFilterSetMustBePresent(pFilter, USBFILTERIDX_DEVICE_SUB_CLASS, false); + USBFilterSetMustBePresent(pFilter, USBFILTERIDX_DEVICE_PROTOCOL, false); + + /* We may also be unable to read string descriptors. Often the userland can't read the + * string descriptors either because the device is in a low-power state, but it can happen + * that the userland gets lucky and reads the strings, but by the time we get to read them + * they're inaccessible due to power management. So, don't require the strings to be present. + */ + USBFilterSetMustBePresent(pFilter, USBFILTERIDX_MANUFACTURER_STR, false); + USBFilterSetMustBePresent(pFilter, USBFILTERIDX_PRODUCT_STR, false); + USBFilterSetMustBePresent(pFilter, USBFILTERIDX_SERIAL_NUMBER_STR, false); + uintptr_t uId = 0; VBOXUSBFLT_LOCK_ACQUIRE(); /* Add the filter. */ @@ -1121,7 +1196,7 @@ VBOXUSBFLT_LOCK_RELEASE(); if (RT_SUCCESS(rc)) { - LOG(("ADDED filer id 0x%p", uId)); + LOG(("ADDED filter id 0x%p", uId)); ASSERT_WARN(uId, ("uid is NULL")); #ifdef VBOX_USBMON_WITH_FILTER_AUTOAPPLY VBoxUsbFltFilterCheck(); @@ -1189,36 +1264,6 @@ return rc; } -NTSTATUS VBoxUsbFltSetNotifyEvent(PVBOXUSBFLTCTX pContext, HANDLE hEvent) -{ - NTSTATUS Status = STATUS_SUCCESS; - PKEVENT pEvent = NULL; - PKEVENT pOldEvent = NULL; - if (hEvent) - { - Status = ObReferenceObjectByHandle(hEvent, - EVENT_MODIFY_STATE, - *ExEventObjectType, UserMode, - (PVOID*)&pEvent, - NULL); - Assert(Status == STATUS_SUCCESS); - if (!NT_SUCCESS(Status)) - return Status; - } - - VBOXUSBFLT_LOCK_ACQUIRE(); - pOldEvent = pContext->pChangeEvent; - pContext->pChangeEvent = pEvent; - VBOXUSBFLT_LOCK_RELEASE(); - - if (pOldEvent) - { - ObDereferenceObject(pOldEvent); - } - - return STATUS_SUCCESS; -} - static USBDEVICESTATE vboxUsbDevGetUserState(PVBOXUSBFLTCTX pContext, PVBOXUSBFLT_DEVICE pDevice) { if (vboxUsbFltDevStateIsNotFiltered(pDevice)) @@ -1282,7 +1327,8 @@ NTSTATUS VBoxUsbFltGetDevice(PVBOXUSBFLTCTX pContext, HVBOXUSBDEVUSR hDevice, PUSBSUP_GETDEV_MON pInfo) { - Assert(hDevice); + if (!hDevice) + return STATUS_INVALID_PARAMETER; memset (pInfo, 0, sizeof (*pInfo)); VBOXUSBFLT_LOCK_ACQUIRE(); @@ -1305,9 +1351,7 @@ VBOXUSBFLT_LOCK_RELEASE(); - /* this should not occur */ - AssertFailed(); - + /* We should not get this far with valid input. */ return STATUS_INVALID_PARAMETER; } @@ -1316,6 +1360,13 @@ *pbFiltered = FALSE; PVBOXUSBFLT_DEVICE pDevice; + /* Find the real PDO+reference. Dereference when we're done with it. Note that + * the input pPdo was not explicitly referenced so we're not dropping its ref. + */ + PDEVICE_OBJECT pDevObj = IoGetDeviceAttachmentBaseRef(pPdo); + LOG(("DevObj=%p, real PDO=%p\n", pPdo, pDevObj)); + pPdo = pDevObj; + /* first check if device is in the a already */ VBOXUSBFLT_LOCK_ACQUIRE(); pDevice = vboxUsbFltDevGetLocked(pPdo); @@ -1326,6 +1377,7 @@ ASSERT_WARN(pDevice->enmState != VBOXUSBFLT_DEVSTATE_REMOVED, ("VBOXUSBFLT_DEVSTATE_REMOVED state for device(0x%p)", pDevice)); *pbFiltered = pDevice->enmState >= VBOXUSBFLT_DEVSTATE_CAPTURING; VBOXUSBFLT_LOCK_RELEASE(); + ObDereferenceObject(pPdo); return STATUS_SUCCESS; } VBOXUSBFLT_LOCK_RELEASE(); @@ -1333,6 +1385,7 @@ if (!pDevice) { WARN(("VBoxUsbMonMemAllocZ failed")); + ObDereferenceObject(pPdo); return STATUS_NO_MEMORY; } @@ -1342,6 +1395,7 @@ if (!NT_SUCCESS(Status)) { WARN(("vboxUsbFltDevPopulate failed, Status 0x%x", Status)); + ObDereferenceObject(pPdo); VBoxUsbMonMemFree(pDevice); return Status; } @@ -1354,6 +1408,10 @@ VBOXUSBFLT_LOCK_ACQUIRE(); /* (paranoia) re-check the device is still not here */ pTmpDev = vboxUsbFltDevGetLocked(pPdo); + + /* Drop the PDO ref, now we won't need it anymore. */ + ObDereferenceObject(pPdo); + if (pTmpDev) { LOG(("second try: found device (0x%p), state(%d) for PDO(0x%p)", pDevice, pDevice->enmState, pPdo)); @@ -1399,18 +1457,17 @@ return STATUS_SUCCESS; } -NTSTATUS VBoxUsbFltPdoAddCompleted(PDEVICE_OBJECT pPdo) -{ - RT_NOREF1(pPdo); - VBOXUSBFLT_LOCK_ACQUIRE(); - vboxUsbFltSignalChangeLocked(); - VBOXUSBFLT_LOCK_RELEASE(); - return STATUS_SUCCESS; -} - BOOLEAN VBoxUsbFltPdoIsFiltered(PDEVICE_OBJECT pPdo) { VBOXUSBFLT_DEVSTATE enmState = VBOXUSBFLT_DEVSTATE_REMOVED; + + /* Find the real PDO+reference. Dereference when we're done with it. Note that + * the input pPdo was not explicitly referenced so we're not dropping its ref. + */ + PDEVICE_OBJECT pDevObj = IoGetDeviceAttachmentBaseRef(pPdo); + LOG(("DevObj=%p, real PDO=%p\n", pPdo, pDevObj)); + pPdo = pDevObj; + VBOXUSBFLT_LOCK_ACQUIRE(); PVBOXUSBFLT_DEVICE pDevice = vboxUsbFltDevGetLocked(pPdo); @@ -1418,6 +1475,7 @@ enmState = pDevice->enmState; VBOXUSBFLT_LOCK_RELEASE(); + ObDereferenceObject(pPdo); return enmState >= VBOXUSBFLT_DEVSTATE_CAPTURING; } @@ -1427,6 +1485,13 @@ PVBOXUSBFLT_DEVICE pDevice; VBOXUSBFLT_DEVSTATE enmOldState; + /* Find the real PDO+reference. Dereference when we're done with it. Note that + * the input pPdo was not explicitly referenced so we're not dropping its ref. + */ + PDEVICE_OBJECT pDevObj = IoGetDeviceAttachmentBaseRef(pPdo); + LOG(("DevObj=%p, real PDO=%p\n", pPdo, pDevObj)); + pPdo = pDevObj; + VBOXUSBFLT_LOCK_ACQUIRE(); pDevice = vboxUsbFltDevGetLocked(pPdo); if (pDevice) @@ -1434,20 +1499,9 @@ RemoveEntryList(&pDevice->GlobalLe); enmOldState = pDevice->enmState; pDevice->enmState = VBOXUSBFLT_DEVSTATE_REMOVED; - if (enmOldState != VBOXUSBFLT_DEVSTATE_REPLUGGING) - { - vboxUsbFltSignalChangeLocked(); - } - else - { - /* the device *should* reappear, do signlling on re-appear only - * to avoid extra signaling. still there might be a situation - * when the device will not re-appear if it gets physically removed - * before it re-appears - * @todo: set a timer callback to do a notification from it */ - } } VBOXUSBFLT_LOCK_RELEASE(); + ObDereferenceObject(pPdo); if (pDevice) vboxUsbFltDevRelease(pDevice); return STATUS_SUCCESS; @@ -1457,6 +1511,8 @@ { PVBOXUSBFLT_DEVICE pDevice; VBOXUSBFLT_LOCK_ACQUIRE(); + + /* NB: The USB proxy (VBoxUSB.sys) passes us the real PDO, not anything above that. */ pDevice = vboxUsbFltDevGetLocked(pPdo); /* * Prevent a host crash when vboxUsbFltDevGetLocked fails to locate the matching PDO @@ -1466,12 +1522,11 @@ { WARN(("failed to get device for PDO(0x%p)", pPdo)); } - else if (pDevice->enmState = VBOXUSBFLT_DEVSTATE_CAPTURING) + else if (pDevice->enmState == VBOXUSBFLT_DEVSTATE_CAPTURING) { pDevice->enmState = VBOXUSBFLT_DEVSTATE_CAPTURED; - LOG(("The proxy notified proxy start for the captured device 0x%x", pDevice)); + LOG(("The proxy notified proxy start for the captured device 0x%p", pDevice)); vboxUsbFltDevRetain(pDevice); - vboxUsbFltSignalChangeLocked(); } else { @@ -1499,9 +1554,8 @@ || pDevice->enmState == VBOXUSBFLT_DEVSTATE_USED_BY_GUEST) { /* this is due to devie was physically removed */ - LOG(("The proxy notified proxy stop for the captured device 0x%x, current state %d", pDevice, pDevice->enmState)); + LOG(("The proxy notified proxy stop for the captured device 0x%p, current state %d", pDevice, pDevice->enmState)); pDevice->enmState = VBOXUSBFLT_DEVSTATE_CAPTURING; - vboxUsbFltSignalChangeLocked(); } else { diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.h virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.h --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.h 2019-07-12 08:49:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.h 2019-10-10 18:13:54.000000000 +0000 @@ -35,10 +35,9 @@ typedef struct VBOXUSBFLTCTX { LIST_ENTRY ListEntry; - PKEVENT pChangeEvent; - RTPROCESS Process; + RTPROCESS Process; // Purely informational, no function? uint32_t cActiveFilters; - BOOLEAN bRemoved; + BOOLEAN bRemoved; // For debugging only? } VBOXUSBFLTCTX, *PVBOXUSBFLTCTX; NTSTATUS VBoxUsbFltInit(); @@ -47,7 +46,6 @@ NTSTATUS VBoxUsbFltClose(PVBOXUSBFLTCTX pContext); int VBoxUsbFltAdd(PVBOXUSBFLTCTX pContext, PUSBFILTER pFilter, uintptr_t *pId); int VBoxUsbFltRemove(PVBOXUSBFLTCTX pContext, uintptr_t uId); -NTSTATUS VBoxUsbFltSetNotifyEvent(PVBOXUSBFLTCTX pContext, HANDLE hEvent); NTSTATUS VBoxUsbFltFilterCheck(PVBOXUSBFLTCTX pContext); NTSTATUS VBoxUsbFltGetDevice(PVBOXUSBFLTCTX pContext, HVBOXUSBDEVUSR hDevice, PUSBSUP_GETDEV_MON pInfo); @@ -57,7 +55,6 @@ void VBoxUsbFltProxyStopped(HVBOXUSBFLTDEV hDev); NTSTATUS VBoxUsbFltPdoAdd(PDEVICE_OBJECT pPdo, BOOLEAN *pbFiltered); -NTSTATUS VBoxUsbFltPdoAddCompleted(PDEVICE_OBJECT pPdo); NTSTATUS VBoxUsbFltPdoRemove(PDEVICE_OBJECT pPdo); BOOLEAN VBoxUsbFltPdoIsFiltered(PDEVICE_OBJECT pPdo); diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp 2019-07-12 08:49:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp 2019-10-10 18:13:54.000000000 +0000 @@ -25,6 +25,76 @@ */ +/* + * + * Theory of Operation + * - or - + * The Document I Wish The Original Author Had Written + * + * + * The USB Monitor (VBoxUSBMon.sys) serves to capture and uncapture USB + * devices. Its job is to ensure that the USB proxy (VBoxUSB.sys) gets installed + * for captured devices and removed again when not needed, restoring the regular + * driver (if any). + * + * The USB Monitor does not handle any actual USB traffic; that is the role of + * VBoxUSB.sys, the USB proxy. A typical solution for installing such USB proxy + * is using a filter driver, but that approach was rejected because filter drivers + * cannot be dynamically added and removed. What VBoxUSBMon does instead is hook + * into the dispatch routine of the bus driver, i.e. USB hub driver, and alter + * the PnP information returned by the bus driver. + * + * The key functionality for capturing is cycling a USB port (which causes a USB + * device reset and triggers re-enumeration in the Windows USB driver stack), and + * then modifying IRP_MN_QUERY_ID / BusQueryHardwareIDs and related requests so + * that they return the synthetic USB VID/PID that VBoxUSB.sys handles rather than + * the true hardware VID/PID. That causes Windows to install VBoxUSB.sys for the + * device. + * + * Uncapturing again cycles the USB port but returns unmodified hardware IDs, + * causing Windows to load the normal driver for the device. + * + * Identifying devices to capture or release (uncapture) is done through USB filters, + * a cross-platform concept which matches USB device based on their VID/PID, class, + * and other criteria. + * + * There is an IOCTL interface for adding/removing USB filters and applying them. + * The IOCTLs are normally issued by VBoxSVC. + * + * USB devices are enumerated by finding all USB hubs (GUID_DEVINTERFACE_USB_HUB) + * and querying their child devices (i.e. USB devices or other hubs) by sending + * IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations. This is done when + * applying existing filters. + * + * Newly arrived USB devices are intercepted early in their PnP enumeration + * through the hooked bus driver dispatch routine. Devices which satisty the + * filter matching criteria are morphed (see above) such that VBoxUSB.sys loads + * for them before any default driver does. + * + * There is an IDC interface to VBoxUSB.sys which allows the USB proxy to report + * that it's installed for a given USB device, and also report when the USB proxy + * is unloaded (typically caused by either unplugging the device or uncapturing + * and cycling the port). VBoxUSBMon.sys relies on these IDC calls to track + * captured devices and be informed when VBoxUSB.sys unloads. + * + * Windows 8+ complicates the USB Monitor's life by automatically putting some + * USB devices to a low-power state where they are unable to respond to any USB + * requests and VBoxUSBMon can't read any of their descriptors (note that in + * userland, the device descriptor can always be read, but string descriptors + * can't). Such devices' USB VID/PID/revision is recovered using the Windows + * PnP Manager from their DevicePropertyHardwareID, but their USB class/subclass + * and protocol unfortunately cannot be unambiguously recovered from their + * DevicePropertyCompatibleIDs. + * + * Filter drivers add another complication. With filter drivers in place, the + * device objects returned by the BusRelations query (or passing through the PnP + * hooks) may not be PDOs but rather filter DOs higher in the stack. To avoid + * confusion, we flatten the references to their base, i.e. the real PDO, which + * should remain the same for the lifetime of a device. Note that VBoxUSB.sys + * always passes its own PDO in the proxy startup IOCTL. + */ + + /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ @@ -86,12 +156,6 @@ VBOXUSBHOOK_REQUEST Rq; } VBOXUSBHUB_PNPHOOK_COMPLETION, *PVBOXUSBHUB_PNPHOOK_COMPLETION; -/* - * Comment out VBOX_USB3PORT definition to disable hooking to multiple drivers (#6509) - */ -#define VBOX_USB3PORT - -#ifdef VBOX_USB3PORT #define VBOXUSBMON_MAXDRIVERS 5 typedef struct VBOXUSB_PNPDRIVER { @@ -99,16 +163,11 @@ VBOXUSBHUB_PNPHOOK UsbHubPnPHook; PDRIVER_DISPATCH pfnHookStub; } VBOXUSB_PNPDRIVER, *PVBOXUSB_PNPDRIVER; -#endif /* !VBOX_USB3PORT */ typedef struct VBOXUSBMONGLOBALS { PDEVICE_OBJECT pDevObj; -#ifdef VBOX_USB3PORT VBOXUSB_PNPDRIVER pDrivers[VBOXUSBMON_MAXDRIVERS]; -#else /* !VBOX_USB3PORT */ - VBOXUSBHUB_PNPHOOK UsbHubPnPHook; -#endif /* !VBOX_USB3PORT */ KEVENT OpenSynchEvent; IO_REMOVE_LOCK RmLock; uint32_t cOpens; @@ -151,6 +210,14 @@ #define VBOXUSBDBG_STRCASE_UNKNOWN(_v) \ default: LOG((__FUNCTION__": Unknown Value (0n%d), (0x%x)", _v, _v)); return "Unknown" +/* These minor code are semi-undocumented. */ +#ifndef IRP_MN_QUERY_LEGACY_BUS_INFORMATION +#define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18 +#endif +#ifndef IRP_MN_DEVICE_ENUMERATED +#define IRP_MN_DEVICE_ENUMERATED 0x19 +#endif + static const char* vboxUsbDbgStrPnPMn(UCHAR uMn) { switch (uMn) @@ -178,6 +245,8 @@ VBOXUSBDBG_STRCASE(IRP_MN_QUERY_BUS_INFORMATION); VBOXUSBDBG_STRCASE(IRP_MN_DEVICE_USAGE_NOTIFICATION); VBOXUSBDBG_STRCASE(IRP_MN_SURPRISE_REMOVAL); + VBOXUSBDBG_STRCASE(IRP_MN_QUERY_LEGACY_BUS_INFORMATION); + VBOXUSBDBG_STRCASE(IRP_MN_DEVICE_ENUMERATED); VBOXUSBDBG_STRCASE_UNKNOWN(uMn); } } @@ -247,89 +316,9 @@ return Status; } -VOID vboxUsbMonHubDevWalk(PFNVBOXUSBMONDEVWALKER pfnWalker, PVOID pvWalker, ULONG fFlags) +VOID vboxUsbMonHubDevWalk(PFNVBOXUSBMONDEVWALKER pfnWalker, PVOID pvWalker) { NTSTATUS Status = STATUS_UNSUCCESSFUL; -#ifndef VBOX_USB3PORT - UNICODE_STRING szStandardHubName; - PDRIVER_OBJECT pDrvObj = NULL; - szStandardHubName.Length = 0; - szStandardHubName.MaximumLength = 0; - szStandardHubName.Buffer = 0; - RtlInitUnicodeString(&szStandardHubName, L"\\Driver\\usbhub"); - UNICODE_STRING szStandardHubPdoNamePrefix; - szStandardHubPdoNamePrefix.Length = 0; - szStandardHubPdoNamePrefix.MaximumLength = 0; - szStandardHubPdoNamePrefix.Buffer = 0; - RtlInitUnicodeString(&szStandardHubPdoNamePrefix, L"\\Device\\USBPDO-"); - - for (int i = 0; i < 16; i++) - { - WCHAR szwHubName[32] = {0}; - char szHubName[32] = {0}; - ANSI_STRING AnsiName; - UNICODE_STRING UnicodeName; - PDEVICE_OBJECT pHubDevObj; - PFILE_OBJECT pHubFileObj; - - sprintf(szHubName, "\\Device\\USBPDO-%d", i); - - RtlInitAnsiString(&AnsiName, szHubName); - - UnicodeName.Length = 0; - UnicodeName.MaximumLength = sizeof (szwHubName); - UnicodeName.Buffer = szwHubName; - - RtlInitAnsiString(&AnsiName, szHubName); - Status = RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, FALSE); - if (Status == STATUS_SUCCESS) - { - Status = IoGetDeviceObjectPointer(&UnicodeName, FILE_READ_DATA, &pHubFileObj, &pHubDevObj); - if (Status == STATUS_SUCCESS) - { - LOG(("IoGetDeviceObjectPointer for \\Device\\USBPDO-%d returned %p %p", i, pHubDevObj, pHubFileObj)); - - VBOXUSBOBJDRVOBJSEARCHER Data = {0}; - Data.pDrvName = &szStandardHubName; - Data.pPdoNamePrefix = &szStandardHubPdoNamePrefix; - Data.fFlags = fFlags; - - vboxUsbObjDevStackWalk(pHubDevObj, vboxUsbObjDevObjSearcherWalker, &Data); - if (Data.pDevObj) - { - LOG(("found hub dev obj (0x%p)", Data.pDevObj)); - if (!pfnWalker(pHubFileObj, pHubDevObj, Data.pDevObj, pvWalker)) - { - LOG(("the walker said to stop")); - ObDereferenceObject(Data.pDevObj); - ObDereferenceObject(pHubFileObj); - break; - } - - LOG(("going forward..")); - ObDereferenceObject(Data.pDevObj); - } - else - { - LOG(("no hub driver obj found")); - ASSERT_WARN(!Data.pDevObj, ("non-null dev obj poiter returned (0x%p)", Data.pDevObj)); - } - - /* this will dereference both file and dev obj */ - ObDereferenceObject(pHubFileObj); - } - else - { - LOG(("IoGetDeviceObjectPointer returned Status (0x%x) for (\\Device\\USBPDO-%d)", Status, i)); - } - } - else - { - WARN(("RtlAnsiStringToUnicodeString failed, Status (0x%x) for Ansu name (\\Device\\USBPDO-%d)", Status, i)); - } - } -#else /* VBOX_USB3PORT */ - RT_NOREF1(fFlags); PWSTR szwHubList; Status = IoGetDeviceInterfaces(&GUID_DEVINTERFACE_USB_HUB, NULL, 0, &szwHubList); if (Status != STATUS_SUCCESS) @@ -353,7 +342,7 @@ * It is the paged memory and we cannot use it in logger cause it increases the IRQL */ LOG(("IoGetDeviceObjectPointer returned %p %p", pHubDevObj, pHubFileObj)); - if (!pfnWalker(pHubFileObj, pHubDevObj, pHubDevObj, pvWalker)) + if (!pfnWalker(pHubFileObj, pHubDevObj, pvWalker)) { LOG(("the walker said to stop")); ObDereferenceObject(pHubFileObj); @@ -367,7 +356,6 @@ } ExFreePool(szwHubList); } -#endif /* VBOX_USB3PORT */ } /* NOTE: the stack location data is not the "actual" IRP stack location, @@ -714,15 +702,7 @@ /* IRP_MN_START_DEVICE only arrives if it's a USB device of a known class or with a present host driver */ case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: case IRP_MN_QUERY_RESOURCES: - if (NT_SUCCESS(pIrp->IoStatus.Status) || pIrp->IoStatus.Status == STATUS_NOT_SUPPORTED) - { - VBoxUsbFltPdoAddCompleted(pRealDevObj); - } - else - { - AssertFailed(); - } - break; + /* There used to be code to support SUPUSBFLT_IOCTL_SET_NOTIFY_EVENT but it was not reliable. */ default: break; @@ -735,11 +715,7 @@ #ifdef DEBUG_misha NTSTATUS tmpStatus = pIrp->IoStatus.Status; #endif -#ifdef VBOX_USB3PORT PVBOXUSBHOOK_ENTRY pHook = pRequest->pHook; -#else /* !VBOX_USB3PORT */ - PVBOXUSBHOOK_ENTRY pHook = &g_VBoxUsbMonGlobals.UsbHubPnPHook.Hook; -#endif /* !VBOX_USB3PORT */ NTSTATUS Status = VBoxUsbHookRequestComplete(pHook, pDevObj, pIrp, pRequest); VBoxUsbMonMemFree(pRequest); #ifdef DEBUG_misha @@ -758,15 +734,8 @@ * @param pDevObj Device object. * @param pIrp Request packet. */ -#ifdef VBOX_USB3PORT static NTSTATUS vboxUsbMonPnPHook(IN PVBOXUSBHOOK_ENTRY pHook, IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp) -#else /* !VBOX_USB3PORT */ -NTSTATUS _stdcall VBoxUsbMonPnPHook(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp) -#endif /* !VBOX_USB3PORT */ -{ -#ifndef VBOX_USB3PORT - PVBOXUSBHOOK_ENTRY pHook = &g_VBoxUsbMonGlobals.UsbHubPnPHook.Hook; -#endif /* !VBOX_USB3PORT */ +{ LOG(("==>PnP: Mn(%s), PDO(0x%p), IRP(0x%p), Status(0x%x)", vboxUsbDbgStrPnPMn(IoGetCurrentIrpStackLocation(pIrp)->MinorFunction), pDevObj, pIrp, pIrp->IoStatus.Status)); if (!VBoxUsbHookRetain(pHook)) @@ -801,7 +770,6 @@ return Status; } -#ifdef VBOX_USB3PORT /** * Device PnP hook stubs. * @@ -835,6 +803,9 @@ * @param uErrId Unique error id representing the location in the driver. * @param cbDumpData Number of bytes at pDumpData. * @param pDumpData Pointer to data that will be added to the message (see 'details' tab). + * + * NB: We only use IoLogMsg.dll as the message file, limiting + * ErrCode to status codes and messages defined in ntiologc.h */ static void vboxUsbMonLogError(NTSTATUS ErrCode, NTSTATUS ReturnedStatus, ULONG uErrId, USHORT cbDumpData, PVOID pDumpData) { @@ -869,9 +840,9 @@ } } -static DECLCALLBACK(BOOLEAN) vboxUsbMonHookDrvObjWalker(PFILE_OBJECT pFile, PDEVICE_OBJECT pTopDo, PDEVICE_OBJECT pHubDo, PVOID pvContext) +static DECLCALLBACK(BOOLEAN) vboxUsbMonHookDrvObjWalker(PFILE_OBJECT pHubFile, PDEVICE_OBJECT pHubDo, PVOID pvContext) { - RT_NOREF3(pFile, pTopDo, pvContext); + RT_NOREF2(pHubFile, pvContext); PDRIVER_OBJECT pDrvObj = pHubDo->DriverObject; /* First we try to figure out if we are already hooked to this driver. */ @@ -925,10 +896,9 @@ */ static NTSTATUS vboxUsbMonInstallAllHooks() { - vboxUsbMonHubDevWalk(vboxUsbMonHookDrvObjWalker, NULL, VBOXUSBMONHUBWALK_F_ALL); + vboxUsbMonHubDevWalk(vboxUsbMonHookDrvObjWalker, NULL); return STATUS_SUCCESS; } -#endif /* VBOX_USB3PORT */ static NTSTATUS vboxUsbMonHookCheckInit() { @@ -938,39 +908,13 @@ LOG(("hook inited already, success")); return STATUS_SUCCESS; } -#ifdef VBOX_USB3PORT return vboxUsbMonInstallAllHooks(); -#else /* !VBOX_USB3PORT */ - PDRIVER_OBJECT pDrvObj = vboxUsbMonHookFindHubDrvObj(); - if (pDrvObj) - { - VBoxUsbHookInit(&g_VBoxUsbMonGlobals.UsbHubPnPHook.Hook, pDrvObj, IRP_MJ_PNP, VBoxUsbMonPnPHook); - fIsHookInited = true; - LOG(("SUCCESS")); - return STATUS_SUCCESS; - } - WARN(("hub drv obj not found, fail")); - return STATUS_UNSUCCESSFUL; -#endif /* !VBOX_USB3PORT */ } static NTSTATUS vboxUsbMonHookInstall() { -#ifdef VBOX_USB3PORT /* Nothing to do here as we have already installed all hooks in vboxUsbMonHookCheckInit(). */ return STATUS_SUCCESS; -#else /* !VBOX_USB3PORT */ -#ifdef VBOXUSBMON_DBG_NO_PNPHOOK - return STATUS_SUCCESS; -#else - if (g_VBoxUsbMonGlobals.UsbHubPnPHook.fUninitFailed) - { - WARN(("trying to hook usbhub pnp after the unhook failed, do nothing & pretend success")); - return STATUS_SUCCESS; - } - return VBoxUsbHookInstall(&g_VBoxUsbMonGlobals.UsbHubPnPHook.Hook); -#endif -#endif /* !VBOX_USB3PORT */ } static NTSTATUS vboxUsbMonHookUninstall() @@ -978,7 +922,6 @@ #ifdef VBOXUSBMON_DBG_NO_PNPHOOK return STATUS_SUCCESS; #else -#ifdef VBOX_USB3PORT NTSTATUS Status = STATUS_SUCCESS; for (int i = 0; i < VBOXUSBMON_MAXDRIVERS; i++) { @@ -1006,14 +949,6 @@ } } } -#else /* !VBOX_USB3PORT */ - NTSTATUS Status = VBoxUsbHookUninstall(&g_VBoxUsbMonGlobals.UsbHubPnPHook.Hook); - if (!NT_SUCCESS(Status)) - { - AssertMsgFailed(("usbhub pnp unhook failed, setting the fUninitFailed flag, the current value of fUninitFailed (%d)", g_VBoxUsbMonGlobals.UsbHubPnPHook.fUninitFailed)); - g_VBoxUsbMonGlobals.UsbHubPnPHook.fUninitFailed = true; - } -#endif /* !VBOX_USB3PORT */ return Status; #endif } @@ -1171,7 +1106,7 @@ NTSTATUS Status = vboxUsbMonContextClose(pCtx); if (Status != STATUS_SUCCESS) { - WARN(("vboxUsbMonContextClose failed, Status (0x%x), prefent unload", Status)); + WARN(("vboxUsbMonContextClose failed, Status (0x%x), prevent unload", Status)); if (!InterlockedExchange(&g_VBoxUsbMonGlobals.ulPreventUnloadOn, 1)) { LOGREL(("ulPreventUnloadOn not set, preventing unload")); @@ -1234,12 +1169,6 @@ return Status; } -static int VBoxUsbMonSetNotifyEvent(PVBOXUSBMONCTX pContext, HANDLE hEvent) -{ - int rc = VBoxUsbFltSetNotifyEvent(&pContext->FltCtx, hEvent); - return rc; -} - static int VBoxUsbMonFltAdd(PVBOXUSBMONCTX pContext, PUSBFILTER pFilter, uintptr_t *pId) { #ifdef VBOXUSBMON_DBG_NO_FILTERS @@ -1369,7 +1298,14 @@ PUSBSUP_GETDEV_MON pOut = (PUSBSUP_GETDEV_MON)pvBuffer; if (!pvBuffer || cbInBuffer != sizeof (hDevice) || cbOutBuffer < sizeof (*pOut)) { - WARN(("SUPUSBFLT_IOCTL_GET_DEVICE: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected >= %d.", + WARN(("SUPUSBFLT_IOCTL_GET_DEVICE: Invalid input/output sizes! cbIn=%d expected %d. cbOut=%d expected >= %d.", + cbInBuffer, sizeof (hDevice), cbOutBuffer, sizeof (*pOut))); + Status = STATUS_INVALID_PARAMETER; + break; + } + if (!hDevice) + { + WARN(("SUPUSBFLT_IOCTL_GET_DEVICE: hDevice is NULL!", cbInBuffer, sizeof (hDevice), cbOutBuffer, sizeof (*pOut))); Status = STATUS_INVALID_PARAMETER; break; @@ -1388,23 +1324,6 @@ break; } - case SUPUSBFLT_IOCTL_SET_NOTIFY_EVENT: - { - PUSBSUP_SET_NOTIFY_EVENT pSne = (PUSBSUP_SET_NOTIFY_EVENT)pvBuffer; - if (!pvBuffer || cbInBuffer != sizeof (*pSne) || cbOutBuffer != sizeof (*pSne)) - { - WARN(("SUPUSBFLT_IOCTL_SET_NOTIFY_EVENT: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.", - cbInBuffer, sizeof (*pSne), cbOutBuffer, sizeof (*pSne))); - Status = STATUS_INVALID_PARAMETER; - break; - } - - pSne->u.rc = VBoxUsbMonSetNotifyEvent(pContext, pSne->u.hEvent); - Info = sizeof (*pSne); - ASSERT_WARN(Status == STATUS_SUCCESS, ("unexpected status, 0x%x", Status)); - break; - } - default: WARN(("Unknown code 0x%x", Ctl)); Status = STATUS_INVALID_PARAMETER; @@ -1485,7 +1404,15 @@ break; } - pOut->u.hDev = VBoxUsbFltProxyStarted(pOut->u.pPDO); + PDEVICE_OBJECT pDevObj = pOut->u.pPDO; + pOut->u.hDev = VBoxUsbFltProxyStarted(pDevObj); + + /* If we couldn't find the PDO in our list, that's a real problem and + * the capturing will not really work. Log an error. + */ + if (!pOut->u.hDev) + vboxUsbMonLogError(IO_ERR_DRIVER_ERROR, STATUS_SUCCESS, 2, sizeof("INTERNAL_IOCTL_PROXY_STARTUP"), "INTERNAL_IOCTL_PROXY_STARTUP"); + ASSERT_WARN(pOut->u.hDev, ("zero hDev")); ASSERT_WARN(Status == STATUS_SUCCESS, ("unexpected status, 0x%x", Status)); break; @@ -1592,14 +1519,14 @@ LOGREL(("Built %s %s", __DATE__, __TIME__)); memset (&g_VBoxUsbMonGlobals, 0, sizeof (g_VBoxUsbMonGlobals)); -#ifdef VBOX_USB3PORT + VBOX_PNPHOOKSTUB_INIT(0); VBOX_PNPHOOKSTUB_INIT(1); VBOX_PNPHOOKSTUB_INIT(2); VBOX_PNPHOOKSTUB_INIT(3); VBOX_PNPHOOKSTUB_INIT(4); AssertCompile(VBOXUSBMON_MAXDRIVERS == 5); -#endif /* VBOX_USB3PORT */ + KeInitializeEvent(&g_VBoxUsbMonGlobals.OpenSynchEvent, SynchronizationEvent, TRUE /* signaled */); IoInitializeRemoveLock(&g_VBoxUsbMonGlobals.RmLock, VBOXUSBMON_MEMTAG, 1, 100); UNICODE_STRING DevName; diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.h virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.h --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.h 2019-07-12 08:49:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.h 2019-10-10 18:13:54.000000000 +0000 @@ -55,16 +55,9 @@ void vboxUsbDbgPrintUnicodeString(PUNICODE_STRING pUnicodeString); -/* visit usbhub-originated device PDOs */ -#define VBOXUSBMONHUBWALK_F_PDO 0x00000001 -/* visit usbhub device FDOs */ -#define VBOXUSBMONHUBWALK_F_FDO 0x00000002 -/* visit all usbhub-originated device objects */ -#define VBOXUSBMONHUBWALK_F_ALL (VBOXUSBMONHUBWALK_F_FDO | VBOXUSBMONHUBWALK_F_PDO) - -typedef DECLCALLBACK(BOOLEAN) FNVBOXUSBMONDEVWALKER(PFILE_OBJECT pFile, PDEVICE_OBJECT pTopDo, PDEVICE_OBJECT pHubDo, PVOID pvContext); +typedef DECLCALLBACK(BOOLEAN) FNVBOXUSBMONDEVWALKER(PFILE_OBJECT pHubFile, PDEVICE_OBJECT pHubDo, PVOID pvContext); typedef FNVBOXUSBMONDEVWALKER *PFNVBOXUSBMONDEVWALKER; -VOID vboxUsbMonHubDevWalk(PFNVBOXUSBMONDEVWALKER pfnWalker, PVOID pvWalker, ULONG fFlags); +VOID vboxUsbMonHubDevWalk(PFNVBOXUSBMONDEVWALKER pfnWalker, PVOID pvWalker); #endif /* #ifndef ___VBoxUsbMon_h___ */ diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/testcase/USBTest.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/testcase/USBTest.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/HostDrivers/VBoxUSB/win/testcase/USBTest.cpp 2019-07-12 08:49:36.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/HostDrivers/VBoxUSB/win/testcase/USBTest.cpp 2019-10-10 18:13:54.000000000 +0000 @@ -156,12 +156,12 @@ * Add USB device filter * * @returns VBox status code. - * @param pszVendor Vendor filter string - * @param pszProduct Product filter string - * @param pszRevision Revision filter string + * @param usVendorId Vendor id + * @param usProductId Product id + * @param usRevision Revision * @param ppID Pointer to filter id */ -int usbMonInsertFilter(const char *pszVendor, const char *pszProduct, const char *pszRevision, void **ppID) +int usbMonInsertFilter(USHORT usVendorId, USHORT usProductId, USHORT usRevision, void **ppID) { USBFILTER filter; USBSUP_FLTADDOUT flt_add; @@ -169,11 +169,12 @@ Assert(g_hUSBMonitor); - printf("usblibInsertFilter %s %s %s\n", pszVendor, pszProduct, pszRevision); + printf("usblibInsertFilter %04X %04X %04X\n", usVendorId, usProductId, usRevision); -// strncpy(filter.szVendor, pszVendor, sizeof(filter.szVendor)); -// strncpy(filter.szProduct, pszProduct, sizeof(filter.szProduct)); -// strncpy(filter.szRevision, pszRevision, sizeof(filter.szRevision)); + USBFilterInit(&filter, USBFILTERTYPE_CAPTURE); + USBFilterSetNumExact(&filter, USBFILTERIDX_VENDOR_ID, usVendorId, true); + USBFilterSetNumExact(&filter, USBFILTERIDX_PRODUCT_ID, usProductId, true); + USBFilterSetNumExact(&filter, USBFILTERIDX_DEVICE_REV, usRevision, true); if (!DeviceIoControl(g_hUSBMonitor, SUPUSBFLT_IOCTL_ADD_FILTER, &filter, sizeof(filter), &flt_add, sizeof(flt_add), &cbReturned, NULL)) { @@ -185,6 +186,25 @@ } /** + * Applies existing filters to currently plugged-in USB devices + * + * @returns VBox status code. + */ +int usbMonRunFilters(void) +{ + DWORD cbReturned = 0; + + Assert(g_hUSBMonitor); + + if (!DeviceIoControl(g_hUSBMonitor, SUPUSBFLT_IOCTL_RUN_FILTERS, NULL, 0, NULL, 0, &cbReturned, NULL)) + { + AssertMsgFailed(("DeviceIoControl failed with %d\n", GetLastError())); + return RTErrConvertFromWin32(GetLastError()); + } + return VINF_SUCCESS; +} + +/** * Remove USB device filter * * @returns VBox status code. @@ -316,6 +336,7 @@ int __cdecl main(int argc, char **argv) { int rc; + int c; RT_NOREF2(argc, argv); printf("USB test\n"); @@ -323,19 +344,28 @@ rc = usbMonitorInit(); AssertRC(rc); - void *pId1, *pId2; + void *pId1, *pId2, *pId3; - usbMonInsertFilter("0529", "0514", "0100", &pId1); - usbMonInsertFilter("0A16", "2499", "0100", &pId2); - - printf("Waiting to capture device\n"); - getchar(); + usbMonInsertFilter(0x0529, 0x0514, 0x0100, &pId1); + usbMonInsertFilter(0x0A16, 0x2499, 0x0100, &pId2); + usbMonInsertFilter(0x80EE, 0x0030, 0x0110, &pId3); + + printf("Waiting to capture devices... enter 'r' to run filters\n"); + c = getchar(); + if (c == 'r') + { + usbMonRunFilters(); + printf("Waiting to capture devices...\n"); + getchar(); /* eat the '\n' */ + getchar(); /* wait for more input */ + } printf("Releasing device\n"); usbMonReleaseDevice(0xA16, 0x2499, 0x100); usbMonRemoveFilter(pId1); usbMonRemoveFilter(pId2); + usbMonRemoveFilter(pId3); rc = usbMonitorTerm(); diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/linux/distributions_rpm virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/linux/distributions_rpm --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/linux/distributions_rpm 2019-07-12 08:49:41.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/linux/distributions_rpm 2019-10-10 18:13:58.000000000 +0000 @@ -19,6 +19,7 @@ fedora17 = FEDORA_17 fedora16 = FEDORA_16 fedora15 = FEDORA_15 +el8 = EL_8 el7 = EL_7 el6 = EL_6 el5 = EL_5 diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/linux/Makefile.include.footer virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/linux/Makefile.include.footer --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/linux/Makefile.include.footer 2019-07-12 08:49:40.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/linux/Makefile.include.footer 2019-10-10 18:13:58.000000000 +0000 @@ -33,7 +33,6 @@ KBUILD_EXTMOD := $(shell pwd) endif INCL += $(MOD_INCL) - export INCL endif KFLAGS := -D__KERNEL__ -DMODULE $(MOD_DEFS) ifeq ($(BUILD_TYPE),debug) diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/linux/Makefile.include.header virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/linux/Makefile.include.header --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/linux/Makefile.include.header 2019-07-12 08:49:41.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/linux/Makefile.include.header 2019-10-10 18:13:58.000000000 +0000 @@ -111,6 +111,17 @@ KERN_VER ?= $(shell uname -r) endif + ifeq ($(KERN_DIR),) + KERN_DIR := /lib/modules/$(KERN_VER)/build + endif + + # This makefile received some variables in the command line which should + # not be passed to the recursive make invocations (of the Linux makefile + # for building kernel modules), since they should derive KERN_DIR from the + # respective command line variables to come up with the value they expect. + unexport KERN_VER KERN_DIR + MAKEOVERRIDES := $(filter-out KERN_VER=% KERN_DIR=%,$(MAKEOVERRIDES)) + # guess kernel major version (24 or later) ifeq ($(shell if grep '"2\.4\.' /lib/modules/$(KERN_VER)/build/include/linux/version.h > /dev/null 2>&1; then echo yes; fi),yes) KERN_VERSION := 24 @@ -133,10 +144,16 @@ KERN_VER := $(KERNELRELEASE) + ifeq ($(KERN_DIR),) + ifneq ($(srctree),) + KERN_DIR := $(srctree) + else + KERN_DIR := /lib/modules/$(KERN_VER)/build + endif + endif endif # neq($(KERNELRELEASE),) # Kernel build folder -KERN_DIR := /lib/modules/$(KERN_VER)/build ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) $(error Error: unable to find the headers of the Linux kernel to build against. \ Specify KERN_VER= (currently $(KERN_VER)) and run Make again) diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/linux/rpm/rules virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/linux/rpm/rules --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/linux/rpm/rules 2019-07-12 08:49:41.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/linux/rpm/rules 2019-10-10 18:13:59.000000000 +0000 @@ -71,10 +71,14 @@ # look for fedora rpmrel := $(shell cat /etc/fedora-release 2> /dev/null | sed -e 's/^Fedora *release *\([1-9][0-9]*\) .*/fedora\1/') ifeq ($(rpmrel),) - # look for OL + # look for OEL rpmrel := $(shell cat /etc/enterprise-release 2> /dev/null | sed -ne 's/^Enterprise Linux[a-zA-Z ]*\([1-9][0-9]*\).*/el\1/p') endif ifeq ($(rpmrel),) + # look for OL + rpmrel := $(shell cat /etc/oracle-release 2> /dev/null | sed -ne 's/^Oracle Linux[a-zA-Z ]*\([1-9][0-9]*\).*/el\1/p') + endif + ifeq ($(rpmrel),) # look for CentOS rpmrel := $(shell cat /etc/redhat-release 2> /dev/null | sed -ne 's/^CentOS[a-zA-Z ]*\([1-9][0-9]*\).*/el\1/p') endif @@ -95,7 +99,7 @@ $(error Cannot detect package distribution (rpmrel=$(rpmrel))) endif - ifeq ($(filter-out el5 el6 el7 fedora18 fedora19 fedora20 fedora21 fedora22 fedora24 fedora25 fedora26 fedora29,$(rpmrel)),) + ifeq ($(filter-out el5 el6 el7 el8 fedora18 fedora19 fedora20 fedora21 fedora22 fedora24 fedora25 fedora26 fedora29,$(rpmrel)),) rpmspec := rpm_redhat endif ifeq ($(filter-out openSUSE110 openSUSE111 openSUSE112 openSUSE113 openSUSE114 openSUSE123 openSUSE131 openSUSE132 openSUSE150,$(rpmrel)),) @@ -158,8 +162,8 @@ $(if $(filter el5 el6,$(rpmrel)),,VBOX_WITH_VMSVGA3D=1) \ VBOX_DO_STRIP= \ $(if $(filter el5,$(rpmrel)),VBOX_BLD_PYTHON=$(strip \ - $(firstword $(wildcard /usr/local/bin/python2.7) \ - $(wildcard /usr/bin/python2.6) $(wildcard /usr/bin/python))),) \ + $(firstword $(wildcard /usr/local/bin/python2.7) $(wildcard /usr/bin/python2.7) \ + $(wildcard /usr/bin/python2.6) $(wildcard /usr/bin/python2) $(wildcard /usr/bin/python))),) \ $(doc_dir) \ $(if $(ose),,VBOX_WITH_DOCS_CHM=1) \ VBOX_PACKAGE_DIST=$(rpmdist) \ @@ -216,7 +220,7 @@ -e 's|%OSE%|$(if $(ose),is_ose,not_ose)|g' \ -e 's|%SPEC%|$(rpmspec)|g' \ -e 's|%PYTHON%|$(if $(filter el5,$(rpmrel)),,with_python)|g' \ - -e 's|%MACROSPYTHON%|$(if $(wildcard /usr/lib/rpm/macros.python),%include /usr/lib/rpm/macros.python,)|g' \ + -e 's|%MACROSPYTHON%|$(if $(wildcard /usr/lib/rpm/macros.d/macros.python3),,$(if $(wildcard /usr/lib/rpm/macros.python),%include /usr/lib/rpm/macros.python,))|g' \ -e 's|%INSTMOD%|$(instmod)|g' \ -e 's|%LIBASOUND%|$(if $(filter lib64,$(rpmlib)),libasound.so.2()(64bit),libasound.so.2)|g' \ -e 's|%INITSCRIPTS%|$(if $(filter fedora,$(rpmspec)),initscripts,)|g' \ diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec 2019-07-12 08:49:41.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec 2019-10-10 18:13:58.000000000 +0000 @@ -20,7 +20,7 @@ %define %PYTHON% 1 %define VBOXDOCDIR %{_defaultdocdir}/%NAME% %global __requires_exclude_from ^/usr/lib/virtualbox/VBoxPython.*$ -%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} Summary: Oracle VM VirtualBox Name: %NAME% @@ -39,17 +39,28 @@ %endif %MACROSPYTHON% +%if %{?__python3:1}%{!?__python3:0} +%define vbox_python %{__python3} +%define vbox_python_sitelib %{python3_sitelib} +%else +%define vbox_python %{__python} +%{?rpm_suse: %define vbox_python_sitelib %{py_sitedir}} +%{!?rpm_suse: %define vbox_python_sitelib %{python_sitelib}} +%endif # our Qt5 libs are built on EL5 with ld 2.17 which does not provide --link-id= %undefine _missing_build_ids_terminate_build # Remove source code from debuginfo package, needed for Fedora 27 and later # as we build the binaries before creating the RPMs. - %if 0%{?fedora} >= 27 %undefine _debugsource_packages %undefine _debuginfo_subpackages %endif +%if 0%{?rhel} >= 8 +%undefine _debugsource_packages +%undefine _debuginfo_subpackages +%endif %description VirtualBox is a powerful PC virtualization solution allowing @@ -89,7 +100,7 @@ %if %{?with_python:1}%{!?with_python:0} (export VBOX_INSTALL_PATH=/usr/lib/virtualbox && \ cd ./sdk/installer && \ - %{__python} ./vboxapisetup.py install --prefix %{_prefix} --root $RPM_BUILD_ROOT) + %{vbox_python} ./vboxapisetup.py install --prefix %{_prefix} --root $RPM_BUILD_ROOT) %endif rm -rf sdk/installer mv nls $RPM_BUILD_ROOT/usr/share/virtualbox @@ -316,8 +327,7 @@ %defattr(-,root,root) %doc %{VBOXDOCDIR}/* %if %{?with_python:1}%{!?with_python:0} -%{?rpm_suse: %{py_sitedir}/*} -%{!?rpm_suse: %{python_sitelib}/*} +%{vbox_python_sitelib}/* %endif /etc/vbox /usr/bin/* diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/win/Makefile.kmk virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/win/Makefile.kmk --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/win/Makefile.kmk 2019-07-12 08:49:42.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/win/Makefile.kmk 2019-10-10 18:13:59.000000000 +0000 @@ -432,6 +432,7 @@ -loc $(VBOX_WIN_INST_OUT_DIR)/NLS/License_$(lang).wxl \ -ext $(VBOX_PATH_WIX)/WixUIExtension.dll \ -ext $(VBOX_PATH_WIX)/WixDifxAppExtension.dll \ + -ext $(VBOX_PATH_WIX)/WixUtilExtension.dll \ $(if-expr defined(VBOX_WITH_MSI_HACK),-ext $(MsiHack_0_OUTDIR)/MsiHackExtension.dll,) \ $(VBOX_MSI_ICE_IGNORE) \ -out $$@ \ @@ -452,6 +453,7 @@ ' -loc files-VirtualBox_$(lang)/License_$(lang).wxl ^' \ ' -ext $(VBOX_PATH_WIX)/WixUIExtension.dll ^' \ ' -ext $(VBOX_PATH_WIX)/WixDifxAppExtension.dll ^' \ + ' -ext $(VBOX_PATH_WIX)/WixUtilExtension.dll ^' \ $(if-expr defined(VBOX_WITH_MSI_HACK),'-ext $(MsiHack_0_OUTDIR)/MsiHackExtension.dll ^',) \ ' $(VBOX_MSI_ICE_IGNORE) ^' \ ' -out $$(@F) ^' \ @@ -489,6 +491,7 @@ -loc $(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl \ -loc $(VBOX_WIN_INST_OUT_DIR)/NLS/License_$(lang).wxl \ -ext $(VBOX_PATH_WIX)/WixDifxAppExtension.dll \ + -ext $(VBOX_PATH_WIX)/WixUtilExtension.dll \ $(VBOX_MSI_ICE_IGNORE) \ -out $$@ \ $$< \ @@ -503,6 +506,7 @@ ' -loc files-VirtualBox_$(lang)/Language_$(lang).wxl ^' \ ' -loc files-VirtualBox_$(lang)/License_$(lang).wxl ^' \ ' -ext $(VBOX_PATH_WIX)/WixDifxAppExtension.dll ^' \ + ' -ext $(VBOX_PATH_WIX)/WixUtilExtension.dll ^' \ ' $(VBOX_MSI_ICE_IGNORE) ^' \ ' -out $$(@F) ^' \ ' $$(byCntPkgs - && rcExit == RTEXITCODE_SUCCESS) + && (rcExit == RTEXITCODE_SUCCESS || rcExit == (RTEXITCODE)ERROR_SUCCESS_REBOOT_REQUIRED)) { - rcExit = ProcessPackage(iPackage, szExtractPath, - szMSIArgs, fEnableLogging); + RTEXITCODE rcExit2 = ProcessPackage(iPackage, szExtractPath, szMSIArgs, fEnableLogging); + if (rcExit2 != RTEXITCODE_SUCCESS) + rcExit = rcExit2; iPackage++; } @@ -1182,6 +1195,6 @@ hMutexAppRunning = NULL; } - return rcExit; + return rcExit != (RTEXITCODE)ERROR_SUCCESS_REBOOT_REQUIRED || !fIgnoreReboot ? rcExit : RTEXITCODE_SUCCESS; } diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/win/VBoxMergeApp.wxi virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/win/VBoxMergeApp.wxi --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Installer/win/VBoxMergeApp.wxi 2019-07-12 08:49:43.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Installer/win/VBoxMergeApp.wxi 2019-10-10 18:14:00.000000000 +0000 @@ -1,7 +1,7 @@ + xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension" + xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> @@ -75,8 +76,7 @@ - - + @@ -421,6 +421,9 @@ + + diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Main/idl/VirtualBox.xidl virtualbox-hwe-5.2.34-dfsg/src/VBox/Main/idl/VirtualBox.xidl --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Main/idl/VirtualBox.xidl 2019-07-12 08:49:44.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Main/idl/VirtualBox.xidl 2019-10-10 18:14:02.000000000 +0000 @@ -2038,9 +2038,18 @@ - To be defined exactly, but we need something that the Validation Kit - can use to figure which methods and attributes can safely be used on a - continuously changing trunk (and occasional branch). + This is mainly intended for the VBox Validation Kit so it can fluently + deal with incompatible API changes and new functionality during + development (i.e. on trunk). + + The high 7 bits (62:56) is the major version number, the next 8 bits + (55:48) are the minor version number, the next 8 bits (47:40) are the + build number, and the rest (39:0) is the API revision number. + + The API revision number is manually increased on trunk when making + incompatible changes that the validation kit or others needs to be able + to detect and cope with dynamically. It can also be used to indicate + the presence of new features on both trunk and branches. diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Main/src-server/VirtualBoxImpl.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Main/src-server/VirtualBoxImpl.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Main/src-server/VirtualBoxImpl.cpp 2019-07-12 08:49:49.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Main/src-server/VirtualBoxImpl.cpp 2019-10-10 18:14:07.000000000 +0000 @@ -928,10 +928,8 @@ AssertCompile(VBOX_VERSION_MAJOR < 128 && VBOX_VERSION_MAJOR > 0); AssertCompile((uint64_t)VBOX_VERSION_MINOR < 256); uint64_t uRevision = ((uint64_t)VBOX_VERSION_MAJOR << 56) - | ((uint64_t)VBOX_VERSION_MINOR << 48); - - if (VBOX_VERSION_BUILD >= 51 && (VBOX_VERSION_BUILD & 1)) /* pre-release trunk */ - uRevision |= (uint64_t)VBOX_VERSION_BUILD << 40; + | ((uint64_t)VBOX_VERSION_MINOR << 48) + | ((uint64_t)VBOX_VERSION_BUILD << 40); /** @todo This needs to be the same in OSE and non-OSE, preferrably * only changing when actual API changes happens. */ diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/common/crypto/tsp-template.h virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/common/crypto/tsp-template.h --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/common/crypto/tsp-template.h 2019-07-12 08:50:00.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/common/crypto/tsp-template.h 2019-10-10 18:14:18.000000000 +0000 @@ -54,18 +54,23 @@ /* * Accuracy + * + * Note! Capping second accuracy at an hour to reduce chance exploiting this + * field to tinker with a signed structure. The RFC does not specify + * any upper limit. + * + * Note! Allowing a zero value for the 'millis' field because we've seen symantec + * return that when 'micros' is present. The RFC seems to want the TSA to + * omit the field if its value is zero. */ #define RTASN1TMPL_TYPE RTCRTSPACCURACY #define RTASN1TMPL_EXT_NAME RTCrTspAccuracy #define RTASN1TMPL_INT_NAME rtCrTspAccuracy RTASN1TMPL_BEGIN_SEQCORE(); RTASN1TMPL_MEMBER_OPT_ITAG_EX( Seconds, RTASN1INTEGER, RTAsn1Integer, ASN1_TAG_INTEGER, RTASN1TMPL_ITAG_F_UP, - RTASN1TMPL_MEMBER_CONSTR_U64_MIN_MAX(Seconds, 0, UINT64_MAX, RT_NOTHING)); -/** @todo The Millis and Micros fields makes no sense if Seconds > 1, while the - * Micros field makes no sense with Millis > 1. Add constraints - * expressing this dependency. */ + RTASN1TMPL_MEMBER_CONSTR_U64_MIN_MAX(Seconds, 0, 3600, RT_NOTHING)); RTASN1TMPL_MEMBER_OPT_ITAG_EX( Millis, RTASN1INTEGER, RTAsn1Integer, 0, RTASN1TMPL_ITAG_F_CP, - RTASN1TMPL_MEMBER_CONSTR_U64_MIN_MAX(Millis, 1, 999, RT_NOTHING)); + RTASN1TMPL_MEMBER_CONSTR_U64_MIN_MAX(Millis, 0, 999, RT_NOTHING)); RTASN1TMPL_MEMBER_OPT_ITAG_EX( Micros, RTASN1INTEGER, RTAsn1Integer, 1, RTASN1TMPL_ITAG_F_CP, RTASN1TMPL_MEMBER_CONSTR_U64_MIN_MAX(Micros, 1, 999, RT_NOTHING)); RTASN1TMPL_END_SEQCORE(); diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/common/path/RTPathParse.cpp.h virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/common/path/RTPathParse.cpp.h --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/common/path/RTPathParse.cpp.h 2019-07-12 08:50:04.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/common/path/RTPathParse.cpp.h 2019-10-10 18:14:22.000000000 +0000 @@ -207,13 +207,13 @@ { fProps |= RTPATH_PROP_FILENAME; - /* look for an ? */ + /* Look for a suffix: */ uint32_t offSuffix = offStart + cchComp; - while (offSuffix-- > offStart) + while (--offSuffix > offStart) if (pszPath[offSuffix] == '.') { uint32_t cchSuffix = offStart + cchComp - offSuffix; - if (cchSuffix > 1 && offStart != offSuffix) + if (cchSuffix > 1) { pParsed->cchSuffix = cchSuffix; pParsed->offSuffix = offSuffix; diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/common/path/RTPathParseSimple.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/common/path/RTPathParseSimple.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/common/path/RTPathParseSimple.cpp 2019-07-12 08:50:04.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/common/path/RTPathParseSimple.cpp 2019-10-10 18:14:22.000000000 +0000 @@ -31,6 +31,9 @@ #include "internal/iprt.h" #include +#include +#include + /** * Parses a path. @@ -52,26 +55,57 @@ */ RTDECL(size_t) RTPathParseSimple(const char *pszPath, size_t *pcchDir, ssize_t *poffName, ssize_t *poffSuff) { - const char *psz = pszPath; - ssize_t offRoot = 0; - const char *pszName = pszPath; - const char *pszLastDot = NULL; + /* + * First deal with the root as it is always more fun that you'd think. + */ + const char *psz = pszPath; + size_t cchRoot = 0; +#if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS + if (RT_C_IS_ALPHA(*psz) && RTPATH_IS_VOLSEP(psz[1])) + { + /* Volume specifier. */ + cchRoot = 2; + psz += 2; + } + else if (RTPATH_IS_SLASH(*psz) && RTPATH_IS_SLASH(psz[1])) + { + /* UNC - there are exactly two prefix slashes followed by a namespace + or computer name, which can be empty on windows. */ + cchRoot = 2; + psz += 2; + while (!RTPATH_IS_SLASH(*psz) && *psz) + { + cchRoot++; + psz++; + } + } +#endif + while (RTPATH_IS_SLASH(*psz)) + { + cchRoot++; + psz++; + } + + /* + * Do the remainder. + */ + const char *pszName = psz; + const char *pszLastDot = NULL; for (;; psz++) { switch (*psz) { - /* handle separators. */ -#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) - case ':': - pszName = psz + 1; - offRoot = pszName - psz; + default: break; + /* handle separators. */ +#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) case '\\': #endif case '/': pszName = psz + 1; + pszLastDot = NULL; break; case '.': @@ -90,21 +124,22 @@ if (poffSuff) { ssize_t offSuff = -1; - if (pszLastDot) + if ( pszLastDot + && pszLastDot != pszName + && pszLastDot[1] != '\0') { offSuff = pszLastDot - pszPath; - if (offSuff <= offName) - offSuff = -1; + Assert(offSuff > offName); } *poffSuff = offSuff; } if (pcchDir) { - ssize_t off = offName - 1; - while (off >= offRoot && RTPATH_IS_SLASH(pszPath[off])) - off--; - *pcchDir = RT_MAX(off, offRoot) + 1; + size_t cch = offName < 0 ? psz - pszPath : offName - 1 < (ssize_t)cchRoot ? cchRoot : offName - 1; + while (cch > cchRoot && RTPATH_IS_SLASH(pszPath[cch - 1])) + cch--; + *pcchDir = cch; } return psz - pszPath; diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c 2019-07-12 08:50:13.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c 2019-10-10 18:14:30.000000000 +0000 @@ -66,7 +66,7 @@ RTR0DECL(bool) RTR0MemUserIsValidAddr(RTR3PTR R3Ptr) { IPRT_LINUX_SAVE_EFL_AC(); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) || defined(RHEL_81) bool fRc = access_ok((void *)R3Ptr, 1); #else bool fRc = access_ok(VERIFY_READ, (void *)R3Ptr, 1); @@ -86,7 +86,7 @@ return (uintptr_t)pv >= PAGE_OFFSET; #else # error "PORT ME" -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) || defined(RHEL_81) return !access_ok(pv, 1); #else return !access_ok(VERIFY_READ, pv, 1); diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c 2019-07-12 08:50:13.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c 2019-10-10 18:14:30.000000000 +0000 @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2008-2017 Oracle Corporation + * Copyright (C) 2008-2019 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -283,12 +283,15 @@ if (RTCpuSetCount(&OnlineSet) > 1) { /* Fire the function on all other CPUs without waiting for completion. */ -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) +# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0) + smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* wait */); +# elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) int rc = smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* wait */); + Assert(!rc); NOREF(rc); # else int rc = smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* retry */, 0 /* wait */); -# endif Assert(!rc); NOREF(rc); +# endif } #endif @@ -326,7 +329,6 @@ { #ifdef CONFIG_SMP IPRT_LINUX_SAVE_EFL_AC(); - int rc; RTMPARGS Args; RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER; @@ -337,14 +339,17 @@ Args.cHits = 0; RTThreadPreemptDisable(&PreemptState); -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) - rc = smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */); +# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0) + smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */); +# elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) + int rc = smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */); + Assert(rc == 0); NOREF(rc); # else /* older kernels */ - rc = smp_call_function(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */); + int rc = smp_call_function(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */); + Assert(rc == 0); NOREF(rc); # endif /* older kernels */ RTThreadPreemptRestore(&PreemptState); - Assert(rc == 0); NOREF(rc); IPRT_LINUX_RESTORE_EFL_AC(); #else RT_NOREF(pfnWorker, pvUser1, pvUser2); diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h 2019-07-12 08:50:13.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h 2019-10-10 18:14:30.000000000 +0000 @@ -451,5 +451,13 @@ DECLHIDDEN(void) rtR0LnxWorkqueuePush(RTR0LNXWORKQUEUEITEM *pWork, void (*pfnWorker)(RTR0LNXWORKQUEUEITEM *)); DECLHIDDEN(void) rtR0LnxWorkqueueFlush(void); +/* + * Guest Additions changes specific to Red Hat 8.1 and later. + */ +#ifdef RHEL_RELEASE_CODE +# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8, 1) +# define RHEL_81 +# endif +#endif #endif diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h 2019-07-12 08:50:13.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h 2019-10-10 18:14:30.000000000 +0000 @@ -47,6 +47,7 @@ { /** The wait queue entry. */ #if LINUX_VERSION_CODE > KERNEL_VERSION(4, 13, 0) \ + || defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 12 && CONFIG_SUSE_PATCHLEVEL == 4 \ || defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 15 wait_queue_entry_t WaitQE; #else diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/r3/win/mp-win.cpp virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/r3/win/mp-win.cpp --- virtualbox-hwe-5.2.32-dfsg/src/VBox/Runtime/r3/win/mp-win.cpp 2019-07-12 08:50:19.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/Runtime/r3/win/mp-win.cpp 2019-10-10 18:14:36.000000000 +0000 @@ -418,7 +418,7 @@ g_aidRtMpWinByCpuSetIdx[i] = NIL_RTCPUID; unsigned const cbGip = pGip->cPages * PAGE_SIZE; - for (uint32_t idxGroup = 0; idxGroup < g_cRtMpWinMaxCpus; idxGroup++) + for (uint32_t idxGroup = 0; idxGroup < g_cRtMpWinMaxCpuGroups; idxGroup++) { uint32_t idxMember; unsigned offCpuGroup = pGip->aoffCpuGroup[idxGroup]; @@ -426,8 +426,8 @@ { PSUPGIPCPUGROUP pGipCpuGrp = (PSUPGIPCPUGROUP)((uintptr_t)pGip + offCpuGroup); uint32_t cMaxMembers = pGipCpuGrp->cMaxMembers; - AssertStmt(cMaxMembers < RT_ELEMENTS(g_aRtMpWinCpuGroups[0].aidxCpuSetMembers), - cMaxMembers = RT_ELEMENTS(g_aRtMpWinCpuGroups[0].aidxCpuSetMembers)); + AssertStmt(cMaxMembers <= RT_ELEMENTS(g_aRtMpWinCpuGroups[0].aidxCpuSetMembers), + cMaxMembers = RT_ELEMENTS(g_aRtMpWinCpuGroups[0].aidxCpuSetMembers)); g_aRtMpWinCpuGroups[idxGroup].cMaxCpus = cMaxMembers; g_aRtMpWinCpuGroups[idxGroup].cActiveCpus = RT_MIN(pGipCpuGrp->cMembers, cMaxMembers); @@ -477,15 +477,15 @@ uint32_t const cMyActiveCpus = ASMAtomicReadU32(&g_cRtMpWinActiveCpus); ASMCompilerBarrier(); - for (uint32_t idxGroup = 0; idxGroup < g_cRtMpWinMaxCpus; idxGroup++) + for (uint32_t idxGroup = 0; idxGroup < g_cRtMpWinMaxCpuGroups; idxGroup++) { unsigned offCpuGroup = pGip->aoffCpuGroup[idxGroup]; if (offCpuGroup < cbGip) { PSUPGIPCPUGROUP pGipCpuGrp = (PSUPGIPCPUGROUP)((uintptr_t)pGip + offCpuGroup); uint32_t cMaxMembers = pGipCpuGrp->cMaxMembers; - AssertStmt(cMaxMembers < RT_ELEMENTS(g_aRtMpWinCpuGroups[0].aidxCpuSetMembers), - cMaxMembers = RT_ELEMENTS(g_aRtMpWinCpuGroups[0].aidxCpuSetMembers)); + AssertStmt(cMaxMembers <= RT_ELEMENTS(g_aRtMpWinCpuGroups[0].aidxCpuSetMembers), + cMaxMembers = RT_ELEMENTS(g_aRtMpWinCpuGroups[0].aidxCpuSetMembers)); for (uint32_t idxMember = g_aRtMpWinCpuGroups[idxGroup].cActiveCpus; idxMember < cMaxMembers; idxMember++) { int16_t idxSet = pGipCpuGrp->aiCpuSetIdxs[idxMember]; diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs-nat.reg virtualbox-hwe-5.2.34-dfsg/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs-nat.reg --- virtualbox-hwe-5.2.32-dfsg/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs-nat.reg 2019-07-12 08:50:50.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs-nat.reg 2019-10-10 18:15:07.000000000 +0000 @@ -5,6 +5,7 @@ "AutoAdminLogon"="1" "ForceAutoLogon"="1" "DefaultUserName"="Administrator" +; Sample password for test VM, see TestExecServ/vboxtxs-readme.txt "DefaultPassword"="password" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] diff -Nru virtualbox-hwe-5.2.32-dfsg/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs.reg virtualbox-hwe-5.2.34-dfsg/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs.reg --- virtualbox-hwe-5.2.32-dfsg/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs.reg 2019-07-12 08:50:50.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs.reg 2019-10-10 18:15:07.000000000 +0000 @@ -5,6 +5,7 @@ "AutoAdminLogon"="1" "ForceAutoLogon"="1" "DefaultUserName"="Administrator" +; Sample password for test VM, see TestExecServ/vboxtxs-readme.txt "DefaultPassword"="password" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] diff -Nru virtualbox-hwe-5.2.32-dfsg/Version.kmk virtualbox-hwe-5.2.34-dfsg/Version.kmk --- virtualbox-hwe-5.2.32-dfsg/Version.kmk 2019-07-12 08:42:10.000000000 +0000 +++ virtualbox-hwe-5.2.34-dfsg/Version.kmk 2019-10-10 18:06:26.000000000 +0000 @@ -25,7 +25,7 @@ # This is the current build number. It should be increased every time we publish a # new build. The define is available in every source file. Only even build numbers # will be published, odd numbers are set during development. -VBOX_VERSION_BUILD = 32 +VBOX_VERSION_BUILD = 34 # This can be overridden in LocalConfig.kmk or elsewhere. # For the convention, see checks near the end of Config.kmk. VBOX_BUILD_PUBLISHER =