On 12/23/2020 10:35 PM, Alexey Sokolov wrote:
Synopsis:       getaddrinfo() is not thread-safe in 6.8
Category:       system
Environment:
        System      : OpenBSD 6.8
        Details     : OpenBSD 6.8 (GENERIC.MP) #1: Tue Nov  3 09:06:04 MST 2020
                        
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP

        Architecture: OpenBSD.amd64
        Machine     : amd64
Description:
Hi, getaddrinfo() crashes when multiple threads run getaddrinfo()
concurrently. This didn't happen in 6.7.
It looks like asr_ctx which is supposed to be thread-local according to
_asr_use_resolver(), is actually static / shared between threads.
How-To-Repeat:
Compile this code (gcc a.c -pthread), and run. It will segfault in
several seconds. Happens with both gcc (4.2.1) and egcc (8.4.0).

Before going any further. Use the system compiler. That is Clang (cc).

Reply via email to