Respect value of LD_PRELOAD given by the CLI

This commit is contained in:
Edoardo Pirovano 2021-11-15 22:16:59 +00:00
parent 2803f4a792
commit 9b506fed7c
No known key found for this signature in database
GPG key ID: 047556B5D93FFE28
3 changed files with 28 additions and 28 deletions

18
lib/tracer-config.js generated
View file

@ -182,15 +182,15 @@ async function getCombinedTracerConfig(config, codeql) {
tracedLanguageConfigs[language] = await getTracerConfigForLanguage(codeql, config, language); tracedLanguageConfigs[language] = await getTracerConfigForLanguage(codeql, config, language);
} }
mainTracerConfig = concatTracerConfigs(tracedLanguageConfigs, config); mainTracerConfig = concatTracerConfigs(tracedLanguageConfigs, config);
} // Add a couple more variables
// Add a couple more variables mainTracerConfig.env["ODASA_TRACER_CONFIGURATION"] = mainTracerConfig.spec;
mainTracerConfig.env["ODASA_TRACER_CONFIGURATION"] = mainTracerConfig.spec; const codeQLDir = path.dirname(codeql.getPath());
const codeQLDir = path.dirname(codeql.getPath()); if (process.platform === "darwin") {
if (process.platform === "darwin") { mainTracerConfig.env["DYLD_INSERT_LIBRARIES"] = path.join(codeQLDir, "tools", "osx64", "libtrace.dylib");
mainTracerConfig.env["DYLD_INSERT_LIBRARIES"] = path.join(codeQLDir, "tools", "osx64", "libtrace.dylib"); }
} else if (process.platform !== "win32") {
else if (process.platform !== "win32") { mainTracerConfig.env["LD_PRELOAD"] = path.join(codeQLDir, "tools", "linux64", "${LIB}trace.so");
mainTracerConfig.env["LD_PRELOAD"] = path.join(codeQLDir, "tools", "linux64", "${LIB}trace.so"); }
} }
// On macos it's necessary to prefix the build command with the runner executable // On macos it's necessary to prefix the build command with the runner executable
// on order to trace when System Integrity Protection is enabled. // on order to trace when System Integrity Protection is enabled.

File diff suppressed because one or more lines are too long

View file

@ -212,25 +212,25 @@ export async function getCombinedTracerConfig(
); );
} }
mainTracerConfig = concatTracerConfigs(tracedLanguageConfigs, config); mainTracerConfig = concatTracerConfigs(tracedLanguageConfigs, config);
}
// Add a couple more variables // Add a couple more variables
mainTracerConfig.env["ODASA_TRACER_CONFIGURATION"] = mainTracerConfig.spec; mainTracerConfig.env["ODASA_TRACER_CONFIGURATION"] = mainTracerConfig.spec;
const codeQLDir = path.dirname(codeql.getPath()); const codeQLDir = path.dirname(codeql.getPath());
if (process.platform === "darwin") { if (process.platform === "darwin") {
mainTracerConfig.env["DYLD_INSERT_LIBRARIES"] = path.join( mainTracerConfig.env["DYLD_INSERT_LIBRARIES"] = path.join(
codeQLDir, codeQLDir,
"tools", "tools",
"osx64", "osx64",
"libtrace.dylib" "libtrace.dylib"
); );
} else if (process.platform !== "win32") { } else if (process.platform !== "win32") {
mainTracerConfig.env["LD_PRELOAD"] = path.join( mainTracerConfig.env["LD_PRELOAD"] = path.join(
codeQLDir, codeQLDir,
"tools", "tools",
"linux64", "linux64",
"${LIB}trace.so" "${LIB}trace.so"
); );
}
} }
// On macos it's necessary to prefix the build command with the runner executable // On macos it's necessary to prefix the build command with the runner executable