VirtualBox

Changeset 75061 in vbox for trunk/src/libs/xpcom18a4


Ignore:
Timestamp:
Oct 25, 2018 10:44:02 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
126112
Message:

xpcom: make xptcinvoke_x86_64_linux.cpp work with gcc sanitisers.
bugref:8019: GCC sanitisers
XPTC_InvokeByIndex for x86_64 uses a rather original way of setting up a call
stack frame with alloca, which breaks with gcc 8.2 and asan. Conditional on
asan being in use, replace that with a slightly less orininal one.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp

    r1 r75061  
    144144        nr_stack = (nr_stack + 1) & ~1;
    145145
     146#ifndef VBOX_WITH_GCC_SANITIZER
    146147    // Load parameters to stack, if necessary
    147148    PRUint64 *stack = (PRUint64 *) __builtin_alloca(nr_stack * 8);
     149#else
     150    typedef struct { PRUint64 stack[20]; } methodStack;
     151    if (nr_stack > 20)
     152        return NS_ERROR_CALL_FAILED;
     153    methodStack stack;
     154#endif
    148155    PRUint64 gpregs[GPR_COUNT];
    149156    double fpregs[FPR_COUNT];
     157#ifndef VBOX_WITH_GCC_SANITIZER
    150158    invoke_copy_to_stack(stack, paramCount, params, gpregs, fpregs);
     159#else
     160    invoke_copy_to_stack(stack.stack, paramCount, params, gpregs, fpregs);
     161#endif
    151162
    152163    // Load FPR registers from fpregs[]
     
    206217    methodAddress = *((PRUint64 *)methodAddress);
    207218   
     219#ifndef VBOX_WITH_GCC_SANITIZER
    208220    typedef PRUint32 (*Method)(PRUint64, PRUint64, PRUint64, PRUint64, PRUint64, PRUint64);
    209221    PRUint32 result = ((Method)methodAddress)(a0, a1, a2, a3, a4, a5);
     222#else
     223    typedef PRUint32 (*Method)(PRUint64, PRUint64, PRUint64, PRUint64, PRUint64, PRUint64, methodStack);
     224    PRUint32 result = ((Method)methodAddress)(a0, a1, a2, a3, a4, a5, stack);
     225#endif
    210226    return result;
    211227}
Note: See TracChangeset for help on using the changeset viewer.

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