[Bug 271146] emulators/virtualbox-ose{-*}: update to 7.1.4
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 20 Dec 2024 10:37:20 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271146 --- Comment #46 from Frank Reisert <bugs@rufus.in-berlin.de> --- Status: no progress. I'm still stuck at the same point only a wee bit wiser. It all happens in file src/VBox/Runtime/common/ldr/ldrELFRelocateble.cpp.h in function RTLDRELF_NAME(RelocateSectionRel). From extended logging I can take these numbers: Value=000001ff1b262c95 SymValue=ffffffff82862ca0 *pAddrW=0347f6c31b262c95 (int32_t)Value=455486613 *(int32_t *)pAddrW=455486613 (Elf_Addr)*(int32_t *)pAddrw=000000001b262c95 Now, (Elf_Addr)*(int32_t *)pAddrw should be equal to Value, which it isn't. Value is being calculated from SymValue, BaseAddr, SecAddr, paRels[iRel].r_offset and paRels[iRel].r_addend. The latter two are being read from the ELF headers of VMMR0.r0 (at least I think so). BaseAddr is the base address which the module is being fixedup to. SecAddr is the section address. This is the address the relocations are relative to. Which leaves me with SymValue which in turn brings me (via RTLDRELF_NAME(Symbol)) to pfnGetImport. pfnGetImport is a function pointer which I cannot resolve because I'm not able to follow the chain of functions up to the point where a function is called with the respective function pointer as argument. So I can't tell where SymValue originates from. Is it being miscalculated, then why? Is it read from somewhere in VMMR0.r0? If so, where and what's wrong there and why? All I can say is that '$ readelf -a VMMR0.r0' doesn't give me a match to "ffffffff82862ca0" or even "82862ca0". At this point I won't ask upstream for help because I can't rule out llvm/ld/the_whole_shebang as the cause of this. If anybody can, please step in! Just to see how it would play out, I've tried to build VBox with gcc which opened another whole can of worms. So I've abandoned this idea. regards -Frank PS: below are copied the corresponding lines from ldrELFRelocateble.cpp.h: static int RTLDRELF_NAME(RelocateSectionRel)(PRTLDRMODELF pModElf, Elf_Addr BaseAddr, PFNRTLDRIMPORT pfnGetImport, void *pvUser, const Elf_Addr SecAddr, Elf_Size cbSec, const uint8_t *pu8SecBaseR, uint8_t *pu8SecBaseW, const void *pvRelocs, Elf_Size cbRelocs) { ... const Elf_Reloc *paRels = (const Elf_Reloc *)pvRelocs; Elf_Addr SymValue = 0; int rc = RTLDRELF_NAME(Symbol)(pModElf, BaseAddr, pfnGetImport, pvUser,ELF_R_SYM(paRels[iRel].r_info), &pSym, &SymValue); const Elf_Addr SourceAddr = SecAddr + paRels[iRel].r_offset + BaseAddr; const Elf_Addr Value = SymValue + paRels[iRel].r_addend - SourceAddr; *(int32_t *)pAddrW = (int32_t)Value; AssertMsgReturn((Elf_Addr)*(int32_t *)pAddrW == Value, ("Value=" FMT_ELF_ADDR "\n", Value), VERR_SYMBOL_VALUE_TOO_BIG); ... } static int RTLDRELF_NAME(Symbol)(PRTLDRMODELF pModElf, Elf_Addr BaseAddr, PFNRTLDRIMPORT pfnGetImport, void *pvUser, Elf_Size iSym, const Elf_Sym **ppSym, Elf_Addr *pSymValue) { ... int rc = pfnGetImport(&pModElf->Core, "", pszName, ~0U, &Value, pvUser); *pSymValue = (Elf_Addr)Value; ... } -- You are receiving this mail because: You are on the CC list for the bug.