-
Notifications
You must be signed in to change notification settings - Fork 381
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
vdef: introduce v_counted_by_(field) #4039
Conversation
I am generally 👍🏽 , this could potentially increase our code quality. BUT
locally installing gcc-trunk and testing the changes should not be asking too much, rather than putting the burdon on a future incarnation of some other maintainer. |
I agree with the reasoning to test it before merge to not uncover work later on, I was partly thinking this could be easily tested in CCI. The attribute is maybe too new. Anyways, thanks, I will look into it. |
@asadsa92 , do you need help with this? |
@gquintard No, but thanks for the reminder. |
I wanted to get ahead with this feature for new code, so I built gcc trunk as of today:
result:
issues seen:
The details on the clang implementation sound like expressions were not supported for the Removing this offending use of I then wanted to know if the new attribute had any effect, so I also built and installed the sanitizer:
with this in place, varnishd could be compiled using ubsan
Luckily, |
@nigoroll Thanks for stepping in and giving this a test. I do offer an apology as I should have done this myself. |
So now I ran an actual test with
and learned something important: The sanitizer does not abort, it just outputs a diagnostic:
This way, I found another glitch: diff --git a/lib/libvarnish/vte.c b/lib/libvarnish/vte.c
index 65255e647..0ceb7d02f 100644
--- a/lib/libvarnish/vte.c
+++ b/lib/libvarnish/vte.c
@@ -63,7 +63,7 @@ struct vte {
int f_cnt; /* actual number of fields */
int f_maxcnt; /* maximum number of fields */
int f_maxsz[]
- v_counted_by_(f_cnt); /* maximum size per field */
+ v_counted_by_(f_maxcnt); /* maximum size per field */
};
struct vte * but after the fix, this remains the only place for
|
Committer edit: Removed one offending case and fixed another, see varnishcache#4039 Signed-off-by: Asad Sajjad Ahmed <[email protected]>
Committer edit: Removed one offending case and fixed another, see #4039 Signed-off-by: Asad Sajjad Ahmed <[email protected]>
I used the wrong push order, for this reason the PR is not shown as merged, but it is. The merge commit is 6f374e3 |
Did you export |
A new attribute can be used for flexible arrays to make the compiler smarter:
This would improve the array bound sanitizer.
Note: this has not been tested locally, but this should be safe until a
compiler supports it. Once supported, we would detect and make the adjustments
as needed.