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:
Saran Tunyasuvunakool
2024-02-22 08:02:46 -08:00
committed by Copybara-Service
parent 34d4a69027
commit b04de39e4e
5 changed files with 107 additions and 22 deletions
+2 -1
View File
@@ -80,7 +80,8 @@ extern "C" {
#endif
#ifdef ADDRESS_SANITIZER
int _mj_comparePcFuncName(void* pc1, void* pc2);
int mj__comparePcFuncName(void* pc1, void* pc2);
const char* mj__getPcDebugInfo(void* pc);
#endif
#ifdef __cplusplus