Changeset 41311 in vbox
- Timestamp:
- May 15, 2012 1:12:02 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
include/VBox/VBoxTpG.h (modified) (1 diff)
-
src/VBox/HostDrivers/Support/Makefile.kmk (modified) (1 diff)
-
src/VBox/HostDrivers/Support/SUPDrvTracer.cpp (modified) (5 diffs)
-
src/bldprogs/VBoxTpG.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxTpG.h
r41130 r41311 380 380 * modules easier. */ 381 381 RTUUID Uuid; 382 /** Mac 10.6.x load workaround. 383 * The linker or/and load messes up the uProbeLocs and uProbeLocsEnd fields 384 * so that they will be link addresses instead of load addresses. To be 385 * able to work around it we store the start address of the __VTGObj section 386 * here and uses it to validate the probe location addresses. */ 387 uint64_t u64VtgObjSectionStart; 382 388 /** Reserved / alignment. */ 383 uint32_t au32Reserved1[ 4];389 uint32_t au32Reserved1[2]; 384 390 } VTGOBJHDR; 385 391 AssertCompileSize(VTGOBJHDR, 128); -
trunk/src/VBox/HostDrivers/Support/Makefile.kmk
r41117 r41311 311 311 win/VBoxDrv.rc 312 312 VBoxDrv_SOURCES = \ 313 SUPDrv.d \ 313 314 SUPDrv.c \ 314 315 SUPDrvSem.c \ 315 SUPDrvTracer.cpp \ 316 SUPDrv.d 316 SUPDrvTracer.cpp 317 317 ifdef VBOX_WITH_NATIVE_DTRACE 318 318 VBoxDrv_SOURCES += \ -
trunk/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp
r41156 r41311 336 336 if (u64Tmp >= UINT32_MAX) 337 337 { 338 SUPR0Printf("supdrvVtgValidateHdr: VERR_SUPDRV_VTG_BAD_HDR_TOO_MUCH - u64Tmp=%#llx ProbeLocs=%#llx ProbeLocsEnd=%#llx\n", 338 SUPR0Printf("supdrvVtgValidateHdr: VERR_SUPDRV_VTG_BAD_HDR_TOO_MUCH - u64Tmp=%#llx ProbeLocs=%#llx ProbeLocsEnd=%#llx\n", 339 339 u64Tmp, pVtgHdr->uProbeLocs.u64, pVtgHdr->uProbeLocsEnd.u64); 340 340 return VERR_SUPDRV_VTG_BAD_HDR_TOO_MUCH; … … 343 343 344 344 u64Tmp = pVtgHdr->uProbeLocs.u64 - uVtgHdrAddr; 345 #ifdef RT_OS_DARWIN 346 /* The loader and/or ld64-97.17 seems not to generate fixups for our 347 __VTGObj section. Detect this by comparing them with the 348 u64VtgObjSectionStart member and assume max image size of 4MB. */ 349 if ( (int64_t)u64Tmp != (int32_t)u64Tmp 350 && pVtgHdr->u64VtgObjSectionStart != uVtgHdrAddr 351 && pVtgHdr->u64VtgObjSectionStart < _4M 352 && pVtgHdr->uProbeLocsEnd.u64 < _4M 353 && !fUmod) 354 { 355 uint64_t offDelta = uVtgHdrAddr - pVtgHdr->u64VtgObjSectionStart; 356 pVtgHdr->uProbeLocs.u64 += offDelta; 357 pVtgHdr->uProbeLocsEnd.u64 += offDelta; 358 u64Tmp += offDelta; 359 } 360 #endif 345 361 if ((int64_t)u64Tmp != (int32_t)u64Tmp) 346 362 { 347 SUPR0Printf("supdrvVtgValidateHdr: VERR_SUPDRV_VTG_BAD_HDR_PTR - u64Tmp=%#llx uProbeLocs=%#llx uVtgHdrAddr=%RTptr\n", 363 SUPR0Printf("supdrvVtgValidateHdr: VERR_SUPDRV_VTG_BAD_HDR_PTR - u64Tmp=%#llx uProbeLocs=%#llx uVtgHdrAddr=%RTptr\n", 348 364 u64Tmp, pVtgHdr->uProbeLocs.u64, uVtgHdrAddr); 349 365 return VERR_SUPDRV_VTG_BAD_HDR_PTR; … … 362 378 && pVtgHdr->cBits != 64)) ) 363 379 return VERR_SUPDRV_VTG_BITS; 364 if ( pVtgHdr->au32Reserved1[0] 365 || pVtgHdr->au32Reserved1[1] 366 || pVtgHdr->au32Reserved1[2] 367 || pVtgHdr->au32Reserved1[3]) 368 return VERR_SUPDRV_VTG_BAD_HDR_MISC; 369 if (RTUuidIsNull(&pVtgHdr->Uuid)) 370 return VERR_SUPDRV_VTG_BAD_HDR_MISC; 380 MY_CHECK_RET(pVtgHdr->au32Reserved1[0] == 0, VERR_SUPDRV_VTG_BAD_HDR_MISC); 381 MY_CHECK_RET(pVtgHdr->au32Reserved1[1] == 0, VERR_SUPDRV_VTG_BAD_HDR_MISC); 382 MY_CHECK_RET(!RTUuidIsNull(&pVtgHdr->Uuid), VERR_SUPDRV_VTG_BAD_HDR_MISC); 371 383 372 384 /* … … 617 629 */ 618 630 { 619 P CVTGPROBELOC paProbeLocs = (PCVTGPROBELOC)((intptr_t)pVtgHdr + pVtgHdr->offProbeLocs);631 PVTGPROBELOC paProbeLocs = (PVTGPROBELOC)((intptr_t)pVtgHdr + pVtgHdr->offProbeLocs); 620 632 i = pVtgHdr->cbProbeLocs / sizeof(VTGPROBELOC); 621 633 while (i-- > 0) … … 626 638 MY_WITHIN_IMAGE(paProbeLocs[i].pszFunction, VERR_SUPDRV_VTG_BAD_PROBE_LOC); 627 639 offTmp = (uintptr_t)paProbeLocs[i].pProbe - (uintptr_t)pVtgHdr->offProbes - (uintptr_t)pVtgHdr; 640 #ifdef RT_OS_DARWIN /* See header validation code. */ 641 if ( offTmp >= pVtgHdr->cbProbes 642 && pVtgHdr->u64VtgObjSectionStart != uVtgHdrAddr 643 && pVtgHdr->u64VtgObjSectionStart < _4M 644 && (uintptr_t)paProbeLocs[i].pProbe < _4M 645 && !fUmod ) 646 { 647 uint64_t offDelta = uVtgHdrAddr - pVtgHdr->u64VtgObjSectionStart; 648 paProbeLocs[i].pProbe = (PVTGDESCPROBE)((uintptr_t)paProbeLocs[i].pProbe + offDelta); 649 offTmp += offDelta; 650 } 651 #endif 628 652 MY_CHECK_RET(offTmp < pVtgHdr->cbProbes, VERR_SUPDRV_VTG_BAD_PROBE_LOC); 629 653 MY_CHECK_RET(offTmp / sizeof(VTGDESCPROBE) * sizeof(VTGDESCPROBE) == offTmp, VERR_SUPDRV_VTG_BAD_PROBE_LOC); -
trunk/src/bldprogs/VBoxTpG.cpp
r41186 r41311 439 439 " NAME(%%1):\n" 440 440 " %%endmacro\n" 441 " [section __VTG __VTGObj align=64]\n" 441 " ; Section order hack!\n" 442 " ; With the ld64-97.17 linker there was a problem with it determin the section\n" 443 " ; order based on symbol references. The references to the start and end of the\n" 444 " ; __VTGPrLc section forced it in front of __VTGObj. \n" 445 " extern section$start$__VTG$__VTGObj\n" 446 " extern section$end$__VTG$__VTGObj\n" 447 " [section __VTG __VTGObj align=1024]\n" 442 448 "\n" 443 449 "%%elifdef ASM_FORMAT_PE\n" … … 522 528 ScmStreamPrintf(pStrm, 523 529 " dd 0%08xh, 0%08xh, 0%08xh, 0%08xh\n" 524 " dd 0, 0, 0, 0\n" 530 "%%ifdef ASM_FORMAT_MACHO\n" 531 " RTCCPTR_DEF section$start$__VTG$__VTGObj\n" 532 " %%if ARCH_BITS == 32\n" 533 " dd 0\n" 534 " %%endif\n" 535 "%%else\n" 536 " dd 0, 0\n" 537 "%%endif\n" 538 " dd 0, 0\n" 525 539 , Uuid.au32[0], Uuid.au32[1], Uuid.au32[2], Uuid.au32[3]); 526 540
Note:
See TracChangeset
for help on using the changeset viewer.

