Re: Detecting use-after-free bugs using gcc's malloc() attribute

2023-07-06 Thread Peter Eisentraut
On 28.06.23 20:15, Andres Freund wrote: On 2023-06-28 10:40:22 +0200, Peter Eisentraut wrote: On 26.06.23 21:54, Andres Freund wrote: For something like pg_list.h the malloc(free) attribute is a bit awkward to use, because one a) needs to list ~30 functions that can free a list and b) the refer

Re: Detecting use-after-free bugs using gcc's malloc() attribute

2023-06-28 Thread Andres Freund
Hi, On 2023-06-28 10:40:22 +0200, Peter Eisentraut wrote: > On 26.06.23 21:54, Andres Freund wrote: > > For something like pg_list.h the malloc(free) attribute is a bit awkward to > > use, because one a) needs to list ~30 functions that can free a list and b) > > the referenced functions need to b

Re: Detecting use-after-free bugs using gcc's malloc() attribute

2023-06-28 Thread Peter Eisentraut
On 26.06.23 21:54, Andres Freund wrote: For something like pg_list.h the malloc(free) attribute is a bit awkward to use, because one a) needs to list ~30 functions that can free a list and b) the referenced functions need to be declared. Hmm. Saying list_concat() "deallocates" a list is mighty

Detecting use-after-free bugs using gcc's malloc() attribute

2023-06-26 Thread Andres Freund
Hi, I played around with adding __attribute__((malloc(free_func), malloc(another_free_func))) annotations to a few functions in pg. See https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html Adding them to pg_list.h seems to have found two valid issues when compiling without optimi