From 3d83a220384c4ec27018c0638bbf5a8f72a68ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=85=B4=E5=87=AF?= Date: Sat, 21 Jun 2025 10:43:33 +0800 Subject: [PATCH] =?UTF-8?q?tsan=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 魏兴凯 --- modules/asan/asan_detector.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/modules/asan/asan_detector.c b/modules/asan/asan_detector.c index c0588a3d..2286c2cb 100644 --- a/modules/asan/asan_detector.c +++ b/modules/asan/asan_detector.c @@ -46,11 +46,34 @@ static const EnvConfig g_configTable[] = { { APP_FLAGS_UBSAN_ENABLED, NULL, NULL, NULL, UBSAN_OPTIONS, NULL }, }; +bool isInRenderProcess(const AppSpawningCtx *property) +{ + static bool isRender = false; + static bool firstIn = true; + if (!firstIn) { + return isRender; + } + firstIn = false; + char *processType = (char *)GetAppPropertyExt(property, "ProcessType", NULL); + if (!processType) { + APPSPAWN_LOGE("GetAppPropertyExt ProcessType is null"); + return false; + } + if (strcmp(processType, "render") == 0 || strcmp(processType, "gpu") == 0) { + isRender = true; + } + return isRender; +} + static int SetAsanEnabledEnv(const AppSpawnMgr *content, const AppSpawningCtx *property) { size_t configTableSize = sizeof(g_configTable) / sizeof(g_configTable[0]); for (size_t i = 0; i < configTableSize; ++i) { if (CheckAppMsgFlagsSet(property, g_configTable[i].flag)) { + if (g_configTable[i].flag == APP_FLAGS_TSAN_ENABLED && isInRenderProcess(property)) { + APPSPAWN_LOGI("SetAsanEnabledEnv ship tsan setting if render process"); + continue; + } if (g_configTable[i].ldPreload) { setenv("LD_PRELOAD", g_configTable[i].ldPreload, 1); } -- Gitee