VirtualBox

Ignore:
Timestamp:
Sep 22, 2020 2:23:25 PM (4 years ago)
Author:
vboxsync
Message:

SUPHard/posix: Function pointer exception hancks for Clang. bugref:9790 bugref:9794

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/posix/SUPR3HardenedMain-posix.cpp

    r85124 r86224  
    9696    PFNRT                    pfnHook;
    9797    /** Where to store the pointer to the code into patch memory
    98      * which resumes the original call. */
    99     PFNRT                   *ppfnRealResume;
     98     * which resumes the original call.
     99     * @note uintptr_t instead of PFNRT is for Clang 11. */
     100    uintptr_t               *ppfnRealResume;
    100101    /** Pointer to the resolver method used on Solaris. */
    101102    PFNSUPHARDENEDSYMRESOLVE pfnResolve;
     
    156157static SUPHARDENEDPOSIXHOOK const g_aHooks[] =
    157158{
    158     /* pszSymbol,       pfnHook,                                     ppfnRealResume,   pfnResolve */
    159     { "dlopen",  (PFNRT)supR3HardenedPosixMonitor_Dlopen,  (PFNRT *)&g_pfnDlopenReal,  supR3HardenedPosixMonitorDlopenResolve  },
     159    /* pszSymbol,       pfnHook,                                         ppfnRealResume,   pfnResolve */
     160    { "dlopen",  (PFNRT)supR3HardenedPosixMonitor_Dlopen,  (uintptr_t *)&g_pfnDlopenReal,  supR3HardenedPosixMonitorDlopenResolve  },
    160161#ifdef SUP_HARDENED_WITH_DLMOPEN
    161     { "dlmopen", (PFNRT)supR3HardenedPosixMonitor_Dlmopen, (PFNRT *)&g_pfnDlmopenReal, supR3HardenedPosixMonitorDlmopenResolve }
     162    { "dlmopen", (PFNRT)supR3HardenedPosixMonitor_Dlmopen, (uintptr_t *)&g_pfnDlmopenReal, supR3HardenedPosixMonitorDlmopenResolve }
    162163#endif
    163164};
     
    315316 * @param   pfnResolve          The resolver to call before trying to query the start address.
    316317 */
    317 static int supR3HardenedMainPosixHookOne(const char *pszSymbol, PFNRT pfnHook, PFNRT *ppfnReal,
     318static int supR3HardenedMainPosixHookOne(const char *pszSymbol, PFNRT pfnHook, uintptr_t /*PFNRT*/ *ppfnReal,
    318319                                         PFNSUPHARDENEDSYMRESOLVE pfnResolve)
    319320{
     
    399400
    400401    /* Assemble the code for resuming the call.*/
    401     *ppfnReal = (PFNRT)(uintptr_t)pbPatchMem;
     402    *ppfnReal = (uintptr_t)pbPatchMem;
    402403
    403404    /* Go through the instructions to patch and fixup any rip relative mov instructions. */
     
    532533
    533534    /* Assemble the code for resuming the call.*/
    534     *ppfnReal = (PFNRT)(uintptr_t)pbPatchMem;
     535    *ppfnReal = (uintptr_t)pbPatchMem;
    535536
    536537    /* Go through the instructions to patch and fixup any relative call instructions. */
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