Fix false positives from mjData stack leakage detection.
When built and run under address sanitizer (asan), `mj_markStack` and `mj_freeStack` are instrumented to detect leakage of mjData stack frames. When the compiler inlines several callees that call into mark/free in the same function, this instrumentation requires that the compiler retains separate mark/free calls for each original callee. This change adds necessary optimization barriers to ensure that this is the case. PiperOrigin-RevId: 609373993 Change-Id: I30dfd998fb66530735348e9715d92ee713f28210
This commit is contained in:
committed by
Copybara-Service
parent
34d4a69027
commit
b04de39e4e
@@ -110,12 +110,21 @@ MJAPI void mj_resetDataKeyframe(const mjModel* m, mjData* d, int key);
|
||||
// mjData arena allocate
|
||||
MJAPI void* mj_arenaAllocByte(mjData* d, size_t bytes, size_t alignment);
|
||||
|
||||
#ifndef ADDRESS_SANITIZER
|
||||
|
||||
// mjData mark stack frame
|
||||
MJAPI void mj_markStack(mjData* d);
|
||||
|
||||
// mjData free stack frame
|
||||
MJAPI void mj_freeStack(mjData* d);
|
||||
|
||||
#else
|
||||
|
||||
void mj__markStack(mjData* d) __attribute__((noinline));
|
||||
void mj__freeStack(mjData* d) __attribute__((noinline));
|
||||
|
||||
#endif // ADDRESS_SANITIZER
|
||||
|
||||
// mjData stack allocate
|
||||
MJAPI void* mj_stackAllocByte(mjData* d, size_t bytes, size_t alignment);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user