Enable ASAN detect_stack_use_after_return for #2431 repro

The bug is a textbook stack-use-after-return: a stack-local struct gaicb
is destroyed when getaddrinfo_with_timeout returns after gai_cancel()
yields EAI_NOTCANCELED, then the still-live resolver worker thread writes
back into the freed frame. ASAN's detect_stack_use_after_return is the
direct detector for exactly this pattern -- enabling it lets the failure
surface as a clear ASAN diagnostic during the test run instead of as an
orphan-process hang at job teardown.
This commit is contained in:
yhirose
2026-04-28 09:04:07 +09:00
parent fdac01d93a
commit 49708a18b2

View File

@@ -164,7 +164,13 @@ jobs:
run: | run: |
cd test cd test
ARCH=$(uname -m) ARCH=$(uname -m)
# detect_stack_use_after_return=1 is the direct detector for this
# bug: when the resolver worker writes back to the destroyed
# stack-local gaicb, ASAN aborts immediately with a stack trace
# naming getaddrinfo_with_timeout. Without it the bug only shows
# up as an orphan-process hang at job teardown.
CPPHTTPLIB_TEST_ISSUE_2431=1 \ CPPHTTPLIB_TEST_ISSUE_2431=1 \
ASAN_OPTIONS=detect_stack_use_after_return=1 \
LSAN_OPTIONS=suppressions=lsan_suppressions.txt \ LSAN_OPTIONS=suppressions=lsan_suppressions.txt \
setarch "$ARCH" -R \ setarch "$ARCH" -R \
./test --gtest_filter='GetAddrInfoAsyncCancelTest.*' ./test --gtest_filter='GetAddrInfoAsyncCancelTest.*'