dlopen problems with debug build, macOS SDK 15, and ASAN

Hello,

There seems to be a regression with macOS SDK 15 and dynamically loading libraries if Address Sanitizer is turned on. Seems to only affect Debug builds, and .frameworks. I've also reported this via the Feedback Assistant: FB16513866

Here's a minimal repro, if anyone is interested: https://gist.github.com/peter-esik/6b00432e411be85333e14ae7d953966e

I thought I'd post this here, as according to my web searches, this isn't a very well-known bug at this point.

Answered by DTS Engineer in 825439022

Thanks for filing FB16513866, and for the heads up in general.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks for filing FB16513866, and for the heads up in general.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Maybe this proves to be useful for others affected by this issue: passing "-mllvm -asan-globals=0" to clang works around the problem.

Hi, I ran across this issue developing the Vulkan-Loader, which uses the pattern shown in the reproducible during test execution (where it loads and unloads dylibs over and over).

Thank you pesik for the workaround, that works like a charm. While diagnosing the issue I found another workaround which is to add RTLD_NODELETE to the flags of dlopen. This works but has the side effect of not completely resetting globals defined in the dylib.

dlopen problems with debug build, macOS SDK 15, and ASAN
 
 
Q