From 124dddfd6bc0047bb6dc9ab73d3a78e75a4e34a141e652f349d5b92e3424bd6d Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Fri, 18 Aug 2023 18:25:00 +0000 Subject: [PATCH] Accepting request 1104707 from home:lwfinger:branches:Virtualization - An additional fix was needed to handle flexible arrays in kernel 6.5+. A fix was made for breakage of kernels 6.4.10+ boo#1212761 and boo#1214391. Note that the change in 6.4 missed an internal include that is present in kernel 6.5. OBS-URL: https://build.opensuse.org/request/show/1104707 OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=707 --- fixes_for_6.5.patch | 100 +++++++++++++++++++++++++++++++++++++++++++ fixes_for_leap.patch | 14 +++--- virtualbox.changes | 8 ++++ 3 files changed, 117 insertions(+), 5 deletions(-) diff --git a/fixes_for_6.5.patch b/fixes_for_6.5.patch index 330c340..dda4c91 100644 --- a/fixes_for_6.5.patch +++ b/fixes_for_6.5.patch @@ -16,3 +16,103 @@ Index: VirtualBox-7.0.10/src/VBox/Additions/linux/drm/vbox_fb.c .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap, +Index: VirtualBox-7.0.10/include/iprt/cdefs.h +=================================================================== +--- VirtualBox-7.0.10.orig/include/iprt/cdefs.h ++++ VirtualBox-7.0.10/include/iprt/cdefs.h +@@ -38,8 +38,9 @@ + #ifndef RT_WITHOUT_PRAGMA_ONCE + # pragma once + #endif +- +- ++#if defined(DECLARE_FLEX_ARRAY) ++# include ++#endif + /** @defgroup grp_rt_cdefs IPRT Common Definitions and Macros + * @{ + */ +@@ -2961,6 +2962,12 @@ + * @note GCC does not permit using this in nested structures, where as MSC + * does. So, use RT_FLEXIBLE_ARRAY_NESTED for that. + * ++ * @note Linux kernels 6.5+ enforce field-spanning write operations ++ * and require flexible arrays to end with 'array[]' rather than array[1]. ++ * This construct fails with unions, but VB does not have any such unions. ++ * This header is used with both kernel- and user-mode code. In user-mode, ++ * the old method works. If DECLARE_FLEX_ARRAY is defined, we are ++ * building kernel-mode code and RT_FLEXIBLE_ARRAY is set to blank. + * @sa RT_FLEXIBLE_ARRAY_NESTED, RT_FLEXIBLE_ARRAY_IN_UNION + */ + #if RT_MSC_PREREQ(RT_MSC_VER_VS2005) /** @todo Probably much much earlier. */ \ +@@ -2976,10 +2983,18 @@ + # if __STDC_VERSION__ >= 1999901L + # define RT_FLEXIBLE_ARRAY + # else +-# define RT_FLEXIBLE_ARRAY 1 ++# if defined(DECLARE_FLEX_ARRAY) ++# define RT_FLEXIBLE_ARRAY ++# else ++# define RT_FLEXIBLE_ARRAY 1 ++# endif + # endif + #else ++# if defined(DECLARE_FLEX_ARRAY) ++# define RT_FLEXIBLE_ARRAY ++# else + # define RT_FLEXIBLE_ARRAY 1 ++# endif + #endif + + /** @def RT_FLEXIBLE_ARRAY_EXTENSION +@@ -3008,7 +3023,9 @@ + #ifdef _MSC_VER + # define RT_FLEXIBLE_ARRAY_NESTED RT_FLEXIBLE_ARRAY + #else ++# if !defined(DECLARE_FLEX_ARRAY) + # define RT_FLEXIBLE_ARRAY_NESTED 1 ++# endif + #endif + + /** @def RT_FLEXIBLE_ARRAY_IN_UNION +@@ -3024,7 +3041,9 @@ + #ifdef _MSC_VER + # define RT_FLEXIBLE_ARRAY_IN_UNION RT_FLEXIBLE_ARRAY + #else +-# define RT_FLEXIBLE_ARRAY_IN_UNION 1 ++# if !defined(DECLARE_FLEX_ARRAY) ++# define RT_FLEXIBLE_ARRAY_IN_UNION 1 ++# endif + #endif + + /** @def RT_FLEXIBLE_ARRAY_IN_NESTED_UNION +@@ -3037,7 +3056,9 @@ + #ifdef _MSC_VER + # define RT_FLEXIBLE_ARRAY_IN_NESTED_UNION RT_FLEXIBLE_ARRAY_NESTED + #else +-# define RT_FLEXIBLE_ARRAY_IN_NESTED_UNION 1 ++# if !defined(DECLARE_FLEX_ARRAY) ++# define RT_FLEXIBLE_ARRAY_IN_NESTED_UNION 1 ++# endif + #endif + + /** @def RT_UNION_NM +Index: VirtualBox-7.0.10/include/VBox/VBoxGuest.h +=================================================================== +--- VirtualBox-7.0.10.orig/include/VBox/VBoxGuest.h ++++ VirtualBox-7.0.10/include/VBox/VBoxGuest.h +@@ -458,8 +458,12 @@ typedef struct VBGLIOCLOG + { + /** The log message. + * The length is determined from the input size and zero termination. */ +- char szMsg[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION]; +- } In; ++#if defined(DECLARE_FLEX_ARRAY) ++ DECLARE_FLEX_ARRAY(char, szMsg); ++#else ++ char szMsg[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION]; ++#endif ++ } In; + } u; + } VBGLIOCLOG, RT_FAR *PVBGLIOCLOG; + /** @} */ diff --git a/fixes_for_leap.patch b/fixes_for_leap.patch index 3e7cf1c..c955a7f 100644 --- a/fixes_for_leap.patch +++ b/fixes_for_leap.patch @@ -2,7 +2,7 @@ Index: VirtualBox-7.0.10/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux. =================================================================== --- VirtualBox-7.0.10.orig/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c +++ VirtualBox-7.0.10/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c -@@ -89,6 +89,13 @@ +@@ -89,6 +89,17 @@ #define VBOXNETFLT_OS_SPECFIC 1 #include "../VBoxNetFltInternal.h" @@ -12,6 +12,10 @@ Index: VirtualBox-7.0.10/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux. +# if defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 15 && CONFIG_SUSE_PATCHLEVEL == 5 +# define OPENSUSE_155 +# endif ++ ++#if !defined(skb_gso_segment) ++#include ++#endif + typedef struct VBOXNETFLTNOTIFIER { struct notifier_block Notifier; @@ -122,7 +126,7 @@ Index: VirtualBox-7.0.10/configure =================================================================== --- VirtualBox-7.0.10.orig/configure +++ VirtualBox-7.0.10/configure -@@ -2041,7 +2041,7 @@ check_kbuild() +@@ -2039,7 +2039,7 @@ check_kbuild() fi echo "export KBUILD_PATH KBUILD_DEVTOOLS PATH" >> $ENV echo "unset path_kbuild_bin path_tools_bin" >> $ENV @@ -131,7 +135,7 @@ Index: VirtualBox-7.0.10/configure echo '' >> $ENV echo "# Legacy - do not use:" >> $ENV -@@ -2051,7 +2051,7 @@ check_kbuild() +@@ -2049,7 +2049,7 @@ check_kbuild() echo '' >> $ENV elif check_avail "kmk" KBUILDDIR really; then # check for installed kBuild @@ -396,7 +400,7 @@ Index: VirtualBox-7.0.10/src/VBox/Additions/linux/drm/vbox_drv.h #include /* iprt/linux/version.h copy - start */ -@@ -160,9 +161,9 @@ +@@ -166,9 +167,9 @@ # include # include # include @@ -409,7 +413,7 @@ Index: VirtualBox-7.0.10/src/VBox/Additions/linux/drm/vbox_drv.h # include #else /* < 5.5.0 || RHEL < 8.3 || SLES < 15-SP3 */ # include -@@ -192,15 +193,15 @@ +@@ -198,15 +199,15 @@ # include #endif diff --git a/virtualbox.changes b/virtualbox.changes index cdf17d0..54afba1 100644 --- a/virtualbox.changes +++ b/virtualbox.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Aug 18 18:18:19 UTC 2023 - Larry Finger + +- An additional fix was needed to handle flexible arrays in kernel 6.5+. + A fix was made for breakage of kernels 6.4.10+ boo#1212761 and boo#1214391. + Note that the change in 6.4 missed an internal include that is present + in kernel 6.5. + ------------------------------------------------------------------- Wed Aug 9 19:44:14 UTC 2023 - Larry Finger