I'm looking at getting Valgrind to run on macOS 10.15 Catalina.So far I have the build working OK (based on a fork for 10.14 plus a few tweaks specific to 10.15).However when I run Valgrind [and I'm running the minimal --tool=none with an app that is just "int main(void) {}"] then I'm getting an error related to pthread_init. From what I see from the executed machine code, there is a test for _os_xbs_chrooted (a global variable in the kernel by the looks of it) which then leads to a call to __pthread_init.cold.2. This function contains a ud2 opcode which triggers a SIGILL in the Valgrind VM.Dearching google for _os_xbs_chrooted doesn't come up with anything much. There's this https://github.com/apple/darwin-libpthread/blob/master/src/pthread.c for the pthread check, and one other reference for the initialization.I realize this looks like it could be security related and information is not made public.Any suggestions as to how I can proceed? I have little experience in kernel programming.
Post
Replies
Boosts
Views
Activity
I'm trying to find which macOS version added _platform_memchr$VARIANT$Base
(see https://bugs.kde.org/show_bug.cgi?id=43779 for details, a request to get this handled properly by Valgrind).
[I've already asked this on llvm discourse, no answer yet]
Can someone give me a brief intro or point me to documentation that describes how lldb handles the dyld shared cache on macOS?
I’m trying to evaluate how to implement the same functionality in
Valgrind. Prior to macOS 11 Big Sur Valgrind used
DYLD_SHARED_REGION=avoid to force loading the libraries and then to
bypass the cache and so to trigger reading the mach-o info to be able to
redirect malloc/pthread functions. Without these redirs not much is
working correctly.