ubsan fixes, alignment in u3a_pile - #1072
Open
dozreg-toplud wants to merge 2 commits into
Open
Conversation
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.
Strange CI behavior in #1071 prompted me to run CI tests locally with UBSan, and fix all places where it complained.
The most substantial fix is introduction of alignment in
u3a_pile. I have a faint memory that something like this was supposed to be added to Vere but was never merged, so let's discuss it again. Inu3a_pile_prepwe align the stack and store both stack offsets before and after the alignment. Inu3a_pile_donewe comparecap_pwith the post-alignment value, and if the stack is empty we restore it to the post-alignment value. Alignment is assumed to be a power of two, and the input alignment is in bytes, just like the length.In unix.c ubsan complained that we increment a null pointer, which is supposed to be illegal? I refactored it slightly so that we formally increment it only if it is not null.
In mars.c the function pointer type and the actual function were technically incompatible.
The rest is
1 << Xtype fixes.