| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | Tristan Partin <tristan(at)partin(dot)io>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Add counted_by attribute |
| Date: | 2026-08-05 16:05:04 |
| Message-ID: | b54d9671-9b70-4c6e-896d-2d67235f76ce@eisentraut.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 30.07.26 00:07, Tristan Partin wrote:
> The counted_by[0] compiler attribute is fairly new. It was added in GCC
> 15 and Clang 18. It has been used fairly extensively in the Linux
> kernel[0].
>
> To summarize the benefits of the attribute:
>
> - Runtime bounds checking with -DFORTIFY_SOURCE=3 and -fsanitize-bounds
> - Accurate reporting of __builtin_dynamic_object_size()
>
> While we don't use __builtin_dynamic_object_size(), I think the runtime
> bounds checking improvements are easily worth the little bit of effort
> to add the attribute in various locations and review the code. I think
> it will improve things for buildfarm animals using ASan due to expanded
> coverage.
I think this is a good idea.
Maybe you could produce an intentionally broken piece of code that would
illustrate what kinds of reports one might hope to get from this.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2026-08-05 16:08:38 | Re: man3 Documentation |
| Previous Message | Heikki Linnakangas | 2026-08-05 16:02:27 | Re: Restructured Shared Buffer Hash Table |