https://bugs.kde.org/show_bug.cgi?id=416436

--- Comment #2 from Louis Brunner <louis.brunner...@gmail.com> ---
Created attachment 125843
  --> https://bugs.kde.org/attachment.cgi?id=125843&action=edit
Fix _pthread_init illegal instruction by providing ptr_munge

I have been investigating the problem and I have a fix (patch included).

Some context: it is difficult to be sure without the libpthread sources for
10.15, but if you check libpthread-330.250.2 (for 10.14), you will find a
parse_ptr_munge_params function that tries to get ptr_munge value from the
environment (through the Apple environment or an actual environment variable,
PTHREAD_PTR_MUNGE_TOKEN). In previous versions, __pthread_init would just carry
on even if the value wasn't defined, but while stepping through the code, I
have found that macOS 10.15 seems to crash using the ud2 instruction just after
the environment variable check, hinting that this value is now required.

My patch adds PTHREAD_PTR_MUNGE_TOKEN with a value of 1 everytime valgrind
starts a program. Note that a value of 0 is considered an error by pthread.

Disclaimer: while I found where ptr_munge is generated (kernel) and used (some
kind of conversion in jmp instructions in libplatform), I don't understand what
it does exactly. On the other hand, the dummy value doesn't seem to make a
difference when executing a program with valgrind.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to