-
Notifications
You must be signed in to change notification settings - Fork 449
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
Fix ASAN issue in lib/cstring. #4865
Conversation
For context, running the ASAN tool on one of our tests revealed an
|
@jonathan-dilorenzo, @smolkaj for visibility |
Signed-off-by: Matthew Lam matthew.lam.qwerty@gmail.com
I actually do have patch for this downstream. This is not a complete solution. It only fixes the problem in the single file. However, the order of static initializers is not defined across the translation units. So the cstring literal could initialized somewhere else. |
Do we understand why this wasn't caught by the existing sanitizer CI workflow on GitHub? |
Yes. Though I was able to reproduce it with asan on downstream project. The order of static initializers do matter. And this depends on linker. |
I submitted downstream solution in #4866 that should fix the underlying problem @matthewtlam will you please double-check it fixes asan issues for you? |
To add more on this. We might want to try |
@asl Unfortunately, the ASAN check failed with the changes in #4866 as shown below. I believe we use the most strict form of checking for ASAN.
|
Ah, actually this is a different issue! #4866 fixes the problem when cstring cache is not live before any of cstring literals around. So, it looks like we need to use both. And actually reduce the number of static objects around, this makes p4c-as-a-library usage hard :( @vlstill Should we sunset |
DCO Remediation Commit for Matthew Lam <matthew.lam.qwerty@gmail.com> I, Matthew Lam <matthew.lam.qwerty@gmail.com>, hereby add my Signed-off-by to this commit: a19e22e I, Matthew Lam <matthew.lam.qwerty@gmail.com>, hereby add my Signed-off-by to this commit: 6ccde62 I, Matthew Lam <matthew.lam.qwerty@gmail.com>, hereby add my Signed-off-by to this commit: fe76037 Signed-off-by: Matthew Lam <matthew.lam.qwerty@gmail.com> Signed-off-by: Matthew Lam <matthew.lam.qwerty@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Matthew Lam matthew.lam.qwerty@gmail.com