[vbox-dev] Problem with kernel 6.5

Larry Finger Larry.Finger at lwfinger.net
Fri Jul 21 19:36:13 GMT 2023


Hi,

As noted in the Change log with VB 7.0.10, there are unfixed problems with 
kernel 6.5. I have patches to allow the build to continue, which I will post later.

There is a problem with the kernel itself. Module vboxsf crashes as soon as a VM 
that uses shared folders starts. The problem is that 6.5 treats variable arrays 
at the end of a struct differently. I reported the problem, and Kees Cook 
quickly came up with a fix that has been submitted, but not yet merged into the 
kernel (as of July 21).

For those interested, the patch is as follows:

Author: Kees Cook <keescook at chromium.org>
Date:   Thu Jul 20 08:15:06 2023 -0700

     vboxsf: Use flexible arrays for trailing string member

     The declaration of struct shfl_string used trailing fake flexible arrays
     for the string member. This was tripping FORTIFY_SOURCE since commit
     df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3"). Replace the
     utf8 and utf16 members with actual flexible arrays, drop the unused ucs2
     member, and retriain a 2 byte padding to keep the structure size the same.

     Reported-by: Larry Finger <Larry.Finger at lwfinger.net>
     Closes: 
https://lore.kernel.org/lkml/ab3a70e9-60ed-0f13-e3d4-8866eaccc8c1@lwfinger.net/
     Tested-by: Larry Finger <Larry.Finger at lwfinger.net>
     Signed-off-by: Kees Cook <keescook at chromium.org>

diff --git a/fs/vboxsf/shfl_hostintf.h b/fs/vboxsf/shfl_hostintf.h
index aca829062c12..069a019c9247 100644
--- a/fs/vboxsf/shfl_hostintf.h
+++ b/fs/vboxsf/shfl_hostintf.h
@@ -68,9 +68,9 @@ struct shfl_string {

         /** UTF-8 or UTF-16 string. Nul terminated. */
         union {
-               u8 utf8[2];
-               u16 utf16[1];
-               u16 ucs2[1]; /* misnomer, use utf16. */
+               u8 legacy_padding[2];
+               DECLARE_FLEX_ARRAY(u8, utf8);
+               DECLARE_FLEX_ARRAY(u16, utf16);
         } string;
  };
  VMMDEV_ASSERT_SIZE(shfl_string, 6);

Larry


More information about the vbox-dev mailing list