| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | Tristan Partin <tristan(at)partin(dot)io> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Japin Li <japinli(at)hotmail(dot)com> |
| Subject: | Re: Add counted_by attribute |
| Date: | 2026-11-26 10:50:34 |
| Message-ID: | 49839dda-aab7-4b3f-8520-7e8212931386@eisentraut.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 02.11.26 11:49, Peter Eisentraut wrote:
> On 06.10.26 22:41, Tristan Partin wrote:
>> On Mon Oct 5, 2026 at 7:52 PM UTC, Peter Eisentraut wrote:
>>> Ok, all the infrastructure is in place now. I'm working through the
>>> attribute additions now.
>>>
>>> One thing to think about is that adding these attributes to server
>>> header files would also affect extensions. I think we might want to do
>>> some research about that. Like, is the normal API to fill in the
>>> structure yourself, or are there wrapper functions that are mandatory to
>>> use? I'm going to park that for the moment and work through the
>>> attribute additions in .c files first.
>>
>> I have to think that extensions testing with
>> -fsanitize=bounds/_FORTIFY_SOURCE=3 is pretty rare. In any case, I did
>> some analysis (grepping and reading) on the list of structs exposed in
>> header files against 9 popular extensions (not in contrib), and I didn't
>> find any potential issues.
>
> Ok, I studies this a bit, too, and I think it's ok. I have committed
> the rest of this, and added a note in the commit message about this.
Since we committed these, clang with -fsanitize=bounds has been failing.
(CI only runs with gcc.)
The problem is that clang rejects things like
memcpy(&p->a[0], ...);
when the associated count is 0. It's debatable whether this is correct,
but in any case clang behaves inconsistently about it, and I have filed
a bug: https://github.com/llvm/llvm-project/issues/236753 . But there
hasn't been any response in a while, so I'm suggesting we go ahead with
a workaround. In this case, we can just write
memcpy(p->a, ...);
which is simpler anyway.
With the attached patch, I get a clean pass on clang -fsanitize=bounds.
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Fix-clang-bounds-sanitizer-failure-with-parallelCurr.patch | text/plain | 2.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Kapila | 2026-11-26 11:28:33 | Re: Proposal: Conflict log history table for Logical Replication |
| Previous Message | Nisha Moond | 2026-11-26 10:46:34 | Re: Conflict Detection and Resolution |