Repository navigation
Conversation
…ks and error reports Implement 100 AddressSanitizer exports following LLVM compiler-rt 18.1.8: shadow fills and queries, stack, alloca, intra-object, array cookie and user poisoning, the load/store access callbacks and their report entry points, error report queries and callbacks, and the default hooks and options. The shadow uses the PlayStation mapping (scale 3, offset 1 << 40) reserved on first use. Remaining gaps are listed in the technical debt.
…e accesses Invalid ranges and a failed shadow reservation throw std::invalid_argument and std::runtime_error instead of NotImplemented_nid_no_patch.
…adow range High-entropy ASLR places host allocations between 1 and 17 TiB, so a single 16 TiB reservation fails. The runtime now reserves each free region, records the host allocations as holes, and throws when an export needs shadow inside a hole.
…intrinsics and container annotations
…e and heap queries Add a redzone allocator with a 256 MiB quarantine that backs the __asan_malloc family, the __sanitizer_get_* heap queries, accumulated stats and the allocation and free stack lookups. Misuse such as double free, bad free, overflowing calloc and invalid alignments aborts with the LLVM 18.1.8 report text.
…tion, fibers and address description Add the use-after-return fake stack with its stack_malloc and stack_free size classes, __asan_handle_no_return stack unpoisoning, fiber switching, global variable registration with ODR violation detection, and __asan_describe_address and __asan_locate_address backed by the heap, globals and shadow layout.
…trace and symbolizer exports Add trace-pc-guard coverage with sancov dumping, the report path and descriptor redirection, module-and-offset stack trace rendering and the pc symbolizer, and route every report through the report file.
List the exports that stay unimplemented with their reason and describe how the allocator, globals, fake stacks, report file and symbolizer differ from LLVM 18.1.8.
The 43 runtime and 6 report diagnostic tests run through AddressSanitizerDiagnostic.cmake, which requires both the expected output and the expected exit status (1 for fatal reports, 0 otherwise) instead of PASS_REGULAR_EXPRESSION alone. fatal_control prints a fatal diagnostic and returns, and must fail.
… shadow on every non-Windows host Export.cpp, ShadowCheck.hpp, Report.hpp and ErrorReport.hpp follow compiler-rt and now start with the LLVM Apache-2.0 WITH LLVM-exception notice. ShadowLinux.cpp is built on every host but Windows; without MAP_FIXED_NOREPLACE (macOS) it reserves no shadow, so the library links and the exports that need shadow throw. The shadow test is registered only where a shadow can be reserved.
|
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.
|
Progress report (5cf487d → 60ebf06)📈 System libraries: 48.66% (+0.72%, +285 implemented, -2 removed functions) ✅ 285 implemented
⚪ 11 behaviourally empty (constant return or throw)
🗑️ 2 removed
Changed libraries (implemented exports)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up to boykopovar#13265. This change replaces 185 additional throwing function stubs and replaces two function stubs with data exports. Relative to boykopovar#13265, the library has 285 implemented function bodies out of 299 functions, 14 throwing stubs, and two data exports. The progress script counts functions and does not include the two data objects.
This PR is stacked on boykopovar#13265: its head
78dc5a8136054ba2b62a68e0cf83de7b989f1de3is a real ancestor.maind6401d794e47ef5abef80502c2ac1bfa03d7b20ais integrated. The 185 additional functions and two data objects are measured against boykopovar#13265; the main-to-head diff also includes the prerequisite's 100 functions until it merges. Refresh the branch after boykopovar#13265 lands.Implemented areas:
__asan_option_detect_stack_use_after_returnis a four-byteint;__ubsan_vptr_type_cachecontains 128 pointer-sized hashes (1024 bytes on x86-64).The Windows backing fix remains in this revision: heap and fake-stack backing use bounded
VirtualAlloc2allocations, their application addresses exclude the shadow, their projected shadow is available, andVirtualFree(..., MEM_RELEASE)releases the reservations. The shared range guard rejects shadow, overflowing and out-of-bounds application ranges. Global registration rejects null nonempty descriptor arrays and byte-count overflow. Linux retains the cached-fake-stack behavior of its TLS fast path.Provenance and dependency integration:
The runtime adapts compiler-rt implementation algorithms and diagnostic text. The adapted implementation, including portions inherited from boykopovar#13265, now lives in the compiler-rt port, built from source through CMake's
compiler_rt_anyps5object target..gitmodulesrecords3rdparty/compiler-rtwith URLhttps://github.com/PrivacyOnion/compiler-rt.git; its gitlink is pinned to21681889623a86177efe37b19be8a69fb84f472e. The fork is based on LLVM 18.1.83b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff. Its published branch contains the compiler-rt source tree at the repository root so a shallow submodule checkout retrieves compiler-rt rather than the whole monorepo. A tree comparison confirms upstream compiler-rt is unchanged outsidelib/asan_anyps5.core/libs/prx/libSceAddressSanitizer/Export.cppnow contains the guest ABI adapters, the two data definitions and the documented default/throwing exports. Its source headers forward to the dependency's headers. The adapters pass the original caller PC/BP and function name explicitly to the runtime. The new native bridge symbols use C linkage and_nid_no_patchsuffixes so the NID patcher retains their native names.The port NOTICE records the origin and modifications. Source mapping:
Runtime.cpp: shadow-segment/user/intra-object/alloca poisoning, access callbacks and report dispatchsrc/Container.hpp:FixUnalignedStorage, contiguous/double-ended transitions andFindBadAddresssrc/Allocator.cpp: redzone selection, size-class computation, parameter checks and diagnosticssrc/FakeStack.cpp: flag/frame layout, class allocation, GC and fiber/no-return behaviorsrc/Globals.cpp/.hpp,src/Describe.cpp/.hpp,src/Report.hpp,src/ShadowCheck.hppsrc/Ubsan.cpp: metadata, value decoding, handler decisions and diagnosticssrc/Coverage.cpp: interface and coverage-file formatLicence treatment: the dependency retains the unmodified compiler-rt licence, LLVM exceptions and legacy notices. The external port carries per-file licence and modification notices; its AnyPS5 GPLv2 text is preserved in LICENSE.GPL-2.0, and the NOTICE identifies the derived portions and modified port.
tools/package_release.pynow includes all three documents underlibs/licenses/in both patched and unpatched ZIP/TAR archives. No licence file or comment header is added undercore/libs/prx/.Export names and NIDs come from the pinned ps5rs inventory; that inventory does not establish signatures or behavior. Console ABI, layouts and behavior remain unverified. The implementation is partial, with remaining gaps in
docs/dev/debt/libSceAddressSanitizer.md: options/default overrides are ignored, the allocator has one global quarantine and one caller frame, mismatch checks are missing, Windows reserves each backing block separately, symbol formatting has no external symbolizer, and inline accesses to Windows shadow holes remain a limitation. Fourteen unsupported interfaces still callNotImplemented_nid_no_patch.Tested
Windows 11 Pro 10.0.26200, x86-64, WinLibs MinGW-W64 GCC 16.1.0 UCRT, Ninja, Release,
BUILD_TESTING=ON. Submitted head:ead33bff92dbf676b11292877475abb7414ac3ee; compiler-rt gitlink:21681889623a86177efe37b19be8a69fb84f472e; integrated main:d6401d794e47ef5abef80502c2ac1bfa03d7b20a. No title, homebrew or console execution.Results:
wrapper_call_sitescase verifies that allocation, allocation-context update and free traces identify the test executable as the caller across the extracted runtime boundary. Replacing the forwarded malloc caller PC with zero makes this test fail; restoring the forwarding restores the passing suite.-target x86_64-linux-gnu -std=c++20 -Wall -Wextra -fPIC -c. No Linux link, CTest or runtime result is claimed; compiler warnings are not represented as a warning-free build.Additional checks:
tools/pr_overlap.pycompared the branch with 1535 open PRs. No conflicting lines or same exports were reported among comparable branches after separating the notice-packaging additions from feat(libSceJemspace): implement arena allocation and statistics boykopovar/AnyPS5#9855. The tool could not compare feat(input): add native SDL input configuration with ImGui boykopovar/AnyPS5#674, feat(aot): discuss native ARM64 compiler architecture and integration boykopovar/AnyPS5#1835, feat(aot): consolidate native ARM64 compiler, runtime and consumers boykopovar/AnyPS5#5021 and feat(libSceLibreSsl): implement CMAC with AES-CBC methods boykopovar/AnyPS5#9571 because their bases conflict; their shared-file patches were inspected manually: ImGui/input-tool packaging, Capstone/pyelftools/ps5link-sdk, and LibreSSL module entries are independent of the compiler-rt module and sanitizer notices. No additional dependency is introduced by those patches.git diff --checkand repository conventions against the integrated upstream main passed. The requiredpython tools/check_conventions.py --base origin/mainwas run; the stale fork base still produces the same 140 baseline errors. That invocation is not represented as a passing check._nid_no_patchrather than being converted to NIDs. Data objects retain their four-byte/1024-byte ABI layouts.1bb57ba9ffby the original reviewer on the previously failing Windows/GCC 15.3 host in the PR conversation. The author results above cover the new extracted-runtime revision; no hosted-build result is inferred from those local runs.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)Windows focused CTest output on ead33bf