Repository navigation
fix(build): spell the ASan opt-out so Clang honours it - #20050
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing in the reviewed changes blocks merging; the replacement attribute spelling is consistently applied at all seven reported sites.
What I ran
Reviewed head 3521a9feb2b541233d1a474017cac1aac9923c19. Read the prepared diff and all four changed files through repo_read.py; no build or tests were run.
Results
| Check | Result | Note |
|---|---|---|
| Changed files reviewed | passed | All four files read |
| Build and tests | not run | Author reports compiler and test results |
Findings
Blocking
None.
Non-blocking
None.
Not verified
Build and test claims in the description were not independently verified. No files were excluded from the changed-file review; files.json was unavailable, so the included-file list was confirmed with the review directory listing.
To get this to a good state
Nothing is required.
Continued review (pass 2)
The requested added lines are address-sanitizer function attributes on SIMD helpers; their implementations and callers show no defect in this continuation pass.
What I ran
- Reviewed head
3521a9feb2b541233d1a474017cac1aac9923c19. - Read the prepared diff and
core/libs/prx/libc/src/Strings.cpplines 120–195, plus lines 1–68 for the relevant helper context. No tests were run.
Results
| Check | Result | Note |
|---|---|---|
| Requested added lines | passed | All three requested lines and surrounding helper code read |
| Tests | not run | This continuation pass was limited to the requested lines |
Findings
Blocking
None.
Non-blocking
None.
Not verified
This pass covers only the three requested added lines in Strings.cpp; other changes and tests from the full pull request review are outside its scope.
To get this to a good state
Nothing is required.
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
What
Seven functions opt out of AddressSanitizer with
[[gnu::no_sanitize("address")]]. GCC accepts that spelling, but Clang only knowsno_sanitizeas__attribute__((no_sanitize(...)))or[[clang::no_sanitize(...)]], so it drops the attribute and instruments the functions anyway:Each of these functions deliberately reads memory that ASan poisons (the main image's writable pages with their global redzones, 16-byte blocks that run past a string's end, a fiber's stack), so in a Clang ASan build they report false overflows.
copyImagePagesruns from a static initializer oflibc, so every test that loadslibc.prxstops there:This uses
[[gnu::no_sanitize_address]], which GCC and Clang both accept with the same meaning, in all seven places:core/libs/prx/libc/src/GuestAllocations.cpp:copyImagePagescore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp:CopyGuestBytescore/libs/prx/libc/src/Strings.cpp:MismatchedUnits,MatchUnits,MatchUnitsOrZero,FindLastUnitcore/libs/tests/Fiber.cpp:CheckActiveContextGCC builds the same code as before.
Tested
Ubuntu 24.04, Ninja, Release,
-DANYPS5_ENABLE_ASAN=ON -fsanitize=undefined,ASAN_OPTIONS=detect_leaks=0,UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1,main8d3ff887dfand this change. The tests cover all seven functions:mainguest_freetype_postscript_privatecopyImagePagesguest_dinkumware_fetch_add_8copyImagePagesguest_wide_stringsMatchUnitsOrZeroguest_wide_scan_blocksMatchUnitsagc_driver_compute_user_data_callsCopyGuestBytesagc_driver_draw_cache_relocationCopyGuestBytesfiberCheckActiveContextWith this PR the Clang build prints no
unknown attribute 'no_sanitize'warning. In a full Clang ASan and UBSan run ofmain2cebbe43ee, 158 of the 450 failing tests stop in one of these functions: 124 incopyImagePages, 31 inCopyGuestBytes, 2 inStrings.cppand 1 inFiber.cpp.tools/check_conventions.py --base origin/mainandgit diff --check: clean.tools/pr_overlap.py --branch fix/clang-no-sanitize-address, against 1,520 open pull requests: no overlap reported. 21 that share a file conflict withmainand could not be compared; none of them changes ano_sanitizeline.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)