-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TySan doesn't catch strict-aliasing violation when using struct initializers #119615
Comments
I think this is the underlying issue of why TySan doesn't detect the strict-aliasing violation in #119099 |
Hi @fhahn, I could look into fixing this if you aren't already? |
@gbMattN that would be great thanks. I've not looked into it yet, but IIRC it looks like Clang doesn't emit TBAA metadata for the initializer |
The following values exist in the IR pre-tysan pass
Despite being global values, as they are not global variables, the |
The approach I've gone with is to record a map of The intuition behind this idea is that if this global value is every used correctly, that usage would have the correct TBAA, and thus create the correct TD. Therefore for any TBAA-data-less global value you use, the TD would exist. I have a branch on my fork where I implement this and it acts correctly in the test case above. This approach could be extended for any other issues that arise due to TBAA limitations. @fhahn, The code has some hacks in it currently which I would want to refactor before raising it as a pull request, but I'd like to check if this approach sounds good to you first. |
The initial version of TySan (#76261) doesn't properly report the first strict aliasing violation in the test case below
Produces the output below with TySan. It looks like it is missing setting the initial type of
values
and the first reported violation isvalues[0] = "test";
, while it should already report the read ofvoid *
forcurr[count]
from memory withchar *
.The text was updated successfully, but these errors were encountered: