The vulnerability (CVE-2023-28320) is a race condition caused by the unsynchronized use of a global buffer (curl_jmpenv) for sigsetjmp/siglongjmp operations during synchronous name resolution timeouts.
The introducing commit 3c49b405de4fbf1f added this timeout mechanism using sigsetjmp (in Curl_resolv) and siglongjmp (in alarmfunc) with a global curl_jmpenv buffer without mutex protection.
The fixing commit 13718030ad4b3209a7583b addresses this by adding a mutex (curl_jmpenv_lock) around the critical section in Curl_resolv_timeout where sigsetjmp is called and the alarm is configured.
Curl_resolv_timeout (in lib/hostip.c) is identified as vulnerable because it sets the sigjmp_buf curl_jmpenv via sigsetjmp without proper locking in the vulnerable versions. This allows multiple threads to overwrite this global buffer, leading to a race condition.
alarmfunc (in lib/hostip.c) is identified as part of the vulnerable mechanism because it executes siglongjmp using the potentially corrupted curl_jmpenv. If curl_jmpenv points to an invalid state due to the race condition, alarmfunc's execution will lead to a crash or misbehavior.
Both functions are critical to the vulnerability: Curl_resolv_timeout creates the race condition by improperly managing the shared resource, and alarmfunc triggers the fault by using this compromised resource.