Repository navigation
build: instrument fetched dependencies under SCN_SANITIZE - #83
Merged
Merged
Conversation
libc++ emits its std::vector container annotations only in translation units compiled with -fsanitize=address, and both halves of the protocol — poisoning the spare capacity on allocation, unpoisoning it as elements are constructed — live in weak inline templates. An uninstrumented dependency contributes non-annotating copies, and the linker is free to pair a poisoning __assign_with_size with a non-unpoisoning __construct_at_end. That is what made an AddressSanitizer build on macOS report a container-overflow in CApiTest.FollowNurbsTrajectoryFollowsTheCircle, in the knot-vector assignment of TrajectoryEvaluator::build_nurbs: googletest was the uninstrumented half. The code was correct; the annotations were not coherent. Linux resolved the same weak symbols consistently, so the CI sanitizer job never saw it. googletest and pugixml now get the same sanitizer flags as Scena's own targets, so a red local sanitizer run means something again. With the fix the full suite is 875/875 under address,undefined on macOS; it aborted before.
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
SCN_SANITIZEnow applies the same sanitizer flags to the fetched C++dependencies (googletest, pugixml) that Scena's own targets get.
Why
An AddressSanitizer build on macOS reported a
container-overflowinCApiTest.FollowNurbsTrajectoryFollowsTheCircle, inside the knot-vectorassignment of
TrajectoryEvaluator::build_nurbs. The code is correct — thesanitizer's view of it was not.
libc++ emits its
std::vectorcontainer annotations only in a translationunit compiled with
-fsanitize=address: the spare capacity is poisoned onallocation and unpoisoned as elements are constructed. Both halves live in
weak inline templates, so an uninstrumented dependency contributes copies
that poison nothing, and the linker is free to pick a poisoning
__assign_with_sizeand a non-unpoisoning__construct_at_endfor the samecall chain. googletest was the uninstrumented half; Linux happened to
resolve the same weak symbols consistently, which is why the CI sanitizer
job stayed green while every local macOS sanitizer run aborted.
This is a root-cause fix, not a suppression: no check is disabled, no test
is skipped or weakened.
Verification
macOS,
-DSCN_SANITIZE=address,undefined -DSCN_BUILD_PYTHON=OFF:capi_testaborts on the container-overflow report.Non-sanitizer builds are unaffected (
scn_sanitize_dependencyreturnsimmediately when
SCN_SANITIZEis empty).Docs
CONTRIBUTING.mdrecords why instrumentation has to be uniform across theprocess, and that AddressSanitizer builds should use
SCN_BUILD_PYTHON=OFF.