Jinoh Kang (@iamahuman) commented about dlls/ntdll/unix/virtual.c:
- if (kret)
return FALSE;
- /* Iterate through the threads in the list */
- while (i < count)
- {
uintptr_t reg_values[128];
size_t reg_count = ARRAY_SIZE( reg_values );
uintptr_t sp;
/* Request the thread's register pointer values to force the thread to go through a memory barrier */
kret = p_thread_get_register_pointer_values( threads[i], &sp, ®_count, reg_values );
/* This function always fails when querying Rosetta's exception handling thread, so we only treat
KERN_INSUFFICIENT_BUFFER_SIZE as an error, like .NET core does. */
if (kret == KERN_INSUFFICIENT_BUFFER_SIZE)
goto fail;
This error should be rare enough, so we don't have to bail out early for performance. It's sufficient to just set `success = FALSE;`[^1] here and continue looping. This will eliminate the extra port deallocate loop at `fail:`.
[^1]: After initializing `success` to `TRUE`.