VirtualBox

Ignore:
Timestamp:
Jan 9, 2025 5:32:38 PM (7 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
166685
Message:

Additions: Linux: vboxvideo: Additional fix for UBSAN warnings, bugref:10585.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/Graphics/VBoxVideoErr.h

    r106061 r107605  
    7474/** @}  */
    7575
     76/** @def RT_BCOPY_UNFORTIFIED
     77 * For copying a number of bytes from/to variable length structures.
     78 *
     79 * This is for working around false positives ("field-spanning writes") in the
     80 * linux kernel's fortified memcpy (v5.18+) when copying from/to
     81 * RT_FLEXIBLE_ARRAY fields and similar tricks going beyond the strict
     82 * definition of a target or source structure.
     83 *
     84 * @param   a_pDst          Pointer to the destination buffer.
     85 * @param   a_pSrc          Pointer to the source buffer.
     86 * @param   a_cbToCopy      Number of bytes to copy.
     87 * @see @bugref{10209}, @ticketref{21410}
     88 */
     89#if defined(RT_OS_LINUX) && defined(__KERNEL__)
     90/* The definition of RT_BCOPY_UNFORTIFIED macro originally comes from IPRT
     91 * header file. However, due to vboxvideo (Linux/DRM module) implementation,
     92 * those header files cannot be used directly. Therefore, let's duplicate this
     93 * definition here. Following vbox_drv.h header file is a part of
     94 * vboxvideo sources, so this code block is only intended to be used from there. */
     95# include "vbox_drv.h"
     96# if (RTLNX_VER_MIN(5,18,0) || RTLNX_RHEL_RANGE(9,3, 9,99)) \
     97  && !defined(__NO_FORTIFY) \
     98  && defined(__OPTIMIZE__) \
     99  && defined(CONFIG_FORTIFY_SOURCE)
     100#  define RT_BCOPY_UNFORTIFIED(a_pDst, a_pSrc, a_cbToCopy)  __underlying_memcpy((a_pDst), (a_pSrc), (a_cbToCopy))
     101# else
     102#  define RT_BCOPY_UNFORTIFIED(a_pDst, a_pSrc, a_cbToCopy)  memcpy((a_pDst), (a_pSrc), (a_cbToCopy))
     103# endif
     104#else  /* !RT_OS_LINUX && !__KERNEL__ */
     105# define RT_BCOPY_UNFORTIFIED(a_pDst, a_pSrc, a_cbToCopy)   memcpy((a_pDst), (a_pSrc), (a_cbToCopy))
     106#endif /* !RT_OS_LINUX && !__KERNEL__ */
     107
    76108#endif /* !VBOX_INCLUDED_Graphics_VBoxVideoErr_h */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette