Changeset 99420 in vbox for trunk/src/VBox/Additions/linux
- Timestamp:
- Apr 17, 2023 2:25:25 PM (21 months ago)
- Location:
- trunk/src/VBox/Additions/linux/sharedfolders
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/dirops.c
r99419 r99420 78 78 pReq = (VBOXSFCREATEREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath.String) + sf_i->path->u16Size); 79 79 if (pReq) { 80 VB OX_LINUX_MEMCPY(&pReq->StrPath, sf_i->path, SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size);80 VBSF_UNFORTIFIED_MEMCPY(&pReq->StrPath, sf_i->path, SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size); 81 81 RT_ZERO(pReq->CreateParms); 82 82 pReq->CreateParms.Handle = SHFL_HANDLE_NIL; … … 688 688 689 689 RT_ZERO(*pReq); 690 VB OX_LINUX_MEMCPY(&pReq->StrPath, path, SHFLSTRING_HEADER_SIZE + path->u16Size);690 VBSF_UNFORTIFIED_MEMCPY(&pReq->StrPath, path, SHFLSTRING_HEADER_SIZE + path->u16Size); 691 691 pReq->CreateParms.Handle = SHFL_HANDLE_NIL; 692 692 pReq->CreateParms.CreateFlags = SHFL_CF_LOOKUP | SHFL_CF_ACT_FAIL_IF_NEW; … … 824 824 } *pReq = (union CreateAuxReq *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath.String) + path->u16Size); 825 825 if (pReq) { 826 VB OX_LINUX_MEMCPY(&pReq->Create.StrPath, path, SHFLSTRING_HEADER_SIZE + path->u16Size);826 VBSF_UNFORTIFIED_MEMCPY(&pReq->Create.StrPath, path, SHFLSTRING_HEADER_SIZE + path->u16Size); 827 827 RT_ZERO(pReq->Create.CreateParms); 828 828 pReq->Create.CreateParms.Handle = SHFL_HANDLE_NIL; … … 1131 1131 + path->u16Size); 1132 1132 if (pReq) { 1133 VB OX_LINUX_MEMCPY(&pReq->StrPath, path, SHFLSTRING_HEADER_SIZE + path->u16Size);1133 VBSF_UNFORTIFIED_MEMCPY(&pReq->StrPath, path, SHFLSTRING_HEADER_SIZE + path->u16Size); 1134 1134 uint32_t fFlags = fDirectory ? SHFL_REMOVE_DIR : SHFL_REMOVE_FILE; 1135 1135 if (dentry->d_inode && ((dentry->d_inode->i_mode & S_IFLNK) == S_IFLNK)) … … 1251 1251 PSHFLSTRING pOldPath = sf_file_i->path; 1252 1252 1253 VB OX_LINUX_MEMCPY(&pReq->StrDstPath, pNewPath, SHFLSTRING_HEADER_SIZE + pNewPath->u16Size);1253 VBSF_UNFORTIFIED_MEMCPY(&pReq->StrDstPath, pNewPath, SHFLSTRING_HEADER_SIZE + pNewPath->u16Size); 1254 1254 rc = VbglR0SfHostReqRenameWithSrcContig(pSuperInfo->map.root, pReq, pOldPath, virt_to_phys(pOldPath), fRename); 1255 1255 VbglR0PhysHeapFree(pReq); … … 1352 1352 if (pReq) { 1353 1353 RT_ZERO(*pReq); 1354 VB OX_LINUX_MEMCPY(&pReq->StrSymlinkPath, pPath, SHFLSTRING_HEADER_SIZE + pPath->u16Size);1354 VBSF_UNFORTIFIED_MEMCPY(&pReq->StrSymlinkPath, pPath, SHFLSTRING_HEADER_SIZE + pPath->u16Size); 1355 1355 1356 1356 rc = VbglR0SfHostReqCreateSymlinkContig(pSuperInfo->map.root, pTarget, virt_to_phys(pTarget), pReq); -
trunk/src/VBox/Additions/linux/sharedfolders/regops.c
r99419 r99420 3073 3073 return -ENOMEM; 3074 3074 } 3075 VB OX_LINUX_MEMCPY(&pReq->StrPath, sf_i->path, SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size);3075 VBSF_UNFORTIFIED_MEMCPY(&pReq->StrPath, sf_i->path, SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size); 3076 3076 RT_ZERO(pReq->CreateParms); 3077 3077 pReq->CreateParms.Handle = SHFL_HANDLE_NIL; -
trunk/src/VBox/Additions/linux/sharedfolders/utils.c
r99419 r99420 193 193 pString->u16Length = (uint16_t)cchNls; 194 194 pString->u16Size = (uint16_t)(cchNls + 1); 195 VB OX_LINUX_MEMCPY(pString->String.ach, pszNls, cchNls);195 VBSF_UNFORTIFIED_MEMCPY(pString->String.ach, pszNls, cchNls); 196 196 pString->String.ach[cchNls] = '\0'; 197 197 rc = 0; … … 503 503 if (pReq) { 504 504 RT_ZERO(*pReq); 505 VB OX_LINUX_MEMCPY(&pReq->StrPath, path, SHFLSTRING_HEADER_SIZE + path->u16Size);505 VBSF_UNFORTIFIED_MEMCPY(&pReq->StrPath, path, SHFLSTRING_HEADER_SIZE + path->u16Size); 506 506 pReq->CreateParms.Handle = SHFL_HANDLE_NIL; 507 507 pReq->CreateParms.CreateFlags = SHFL_CF_LOOKUP | SHFL_CF_ACT_FAIL_IF_NEW; … … 589 589 if (pReq) { 590 590 RT_ZERO(*pReq); 591 VB OX_LINUX_MEMCPY(&pReq->StrPath, pPath, SHFLSTRING_HEADER_SIZE + pPath->u16Size);591 VBSF_UNFORTIFIED_MEMCPY(&pReq->StrPath, pPath, SHFLSTRING_HEADER_SIZE + pPath->u16Size); 592 592 pReq->CreateParms.Handle = SHFL_HANDLE_NIL; 593 593 pReq->CreateParms.CreateFlags = SHFL_CF_LOOKUP | SHFL_CF_ACT_FAIL_IF_NEW; … … 890 890 if (fAttrs & ATTR_SIZE) 891 891 pReq->Create.CreateParms.CreateFlags |= SHFL_CF_ACCESS_WRITE; 892 VB OX_LINUX_MEMCPY(&pReq->Create.StrPath, sf_i->path, SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size);892 VBSF_UNFORTIFIED_MEMCPY(&pReq->Create.StrPath, sf_i->path, SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size); 893 893 vrc = VbglR0SfHostReqCreate(pSuperInfo->map.root, &pReq->Create); 894 894 if (RT_SUCCESS(vrc)) { … … 1028 1028 1029 1029 if (fRoot) 1030 VB OX_LINUX_MEMCPY(&tmp->String.utf8[0], d_name, d_len + 1);1030 VBSF_UNFORTIFIED_MEMCPY(&tmp->String.utf8[0], d_name, d_len + 1); 1031 1031 else { 1032 VB OX_LINUX_MEMCPY(&tmp->String.utf8[0], p_name, p_len);1032 VBSF_UNFORTIFIED_MEMCPY(&tmp->String.utf8[0], p_name, p_len); 1033 1033 tmp->String.utf8[p_len] = '/'; 1034 VB OX_LINUX_MEMCPY(&tmp->String.utf8[p_len + 1], d_name, d_len);1034 VBSF_UNFORTIFIED_MEMCPY(&tmp->String.utf8[p_len + 1], d_name, d_len); 1035 1035 tmp->String.utf8[p_len + 1 + d_len] = '\0'; 1036 1036 } -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c
r99419 r99420 119 119 if ((unsigned)info->length >= RT_UOFFSETOF(struct vbsf_mount_info_new, cMaxIoPages)) { 120 120 AssertCompile(sizeof(pSuperInfo->szTag) >= sizeof(info->szTag)); 121 VB OX_LINUX_MEMCPY(pSuperInfo->szTag, info->szTag, sizeof(info->szTag));121 VBSF_UNFORTIFIED_MEMCPY(pSuperInfo->szTag, info->szTag, sizeof(info->szTag)); 122 122 pSuperInfo->szTag[sizeof(pSuperInfo->szTag) - 1] = '\0'; 123 123 } else { … … 243 243 str_name->u16Length = name_len; 244 244 str_name->u16Size = name_len + 1; 245 VB OX_LINUX_MEMCPY(str_name->String.utf8, info->name, name_len + 1);245 VBSF_UNFORTIFIED_MEMCPY(str_name->String.utf8, info->name, name_len + 1); 246 246 247 247 /* … … 1490 1490 if (data) { 1491 1491 if (VBSF_IS_MOUNT_VBOXSF_DATA(data)) { 1492 VB OX_LINUX_MEMCPY(info, data, sizeof(struct vbsf_mount_info_new));1492 VBSF_UNFORTIFIED_MEMCPY(info, data, sizeof(struct vbsf_mount_info_new)); 1493 1493 } else { 1494 1494 /* this will call vbsf_parse_param() */ -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h
r98869 r99420 80 80 81 81 82 /* Simmilar workaround for CONFIG_FORTIFY_SOURCE kernel config option as we have for host drivers. 83 * In Linux 5.18-rc1, memcpy became a wrapper which does fortify checks 84 * before triggering __underlying_memcpy() call. We do not pass these checks in some places so 85 * bypass them for now. */ 82 /** Similar workaround for CONFIG_FORTIFY_SOURCE kernel config option as we 83 * have in the host drivers. 84 * 85 * In Linux 5.18-rc1, memcpy became a wrapper which does fortify checks before 86 * making a call to __underlying_memcpy(). There are a number of places where 87 * we trigger the "field-spanning write" fortify check, typically when copying 88 * to SHFLSTRING structure members as these are actually of variable length but 89 * we don't (cannot with gcc) use RT_FLEXIBLE_ARRAY_NESTED. 90 * 91 * Use this when copying to structures or members with a variable length member. 92 * 93 * @see @ticketref{21410}, @bugref{10209} 94 */ 86 95 #if RTLNX_VER_MIN(5,18,0) && !defined(__NO_FORTIFY) && defined(__OPTIMIZE__) && defined(CONFIG_FORTIFY_SOURCE) 87 # define VB OX_LINUX_MEMCPY __underlying_memcpy96 # define VBSF_UNFORTIFIED_MEMCPY __underlying_memcpy 88 97 #else 89 # define VBOX_LINUX_MEMCPYmemcpy98 # define VBSF_UNFORTIFIED_MEMCPY memcpy 90 99 #endif 91 100
Note:
See TracChangeset
for help on using the changeset viewer.