Re: PgStat_HashKey padding issue when passed by reference
От | Andres Freund |
---|---|
Тема | Re: PgStat_HashKey padding issue when passed by reference |
Дата | |
Msg-id | hdvf7gzrusxids25i4eqpxj6i2ehltj6llrivghe4ksxydta2p@65r4krbkqh26 обсуждение исходный текст |
Ответ на | PgStat_HashKey padding issue when passed by reference (Sami Imseih <samimseih@gmail.com>) |
Ответы |
Re: PgStat_HashKey padding issue when passed by reference
|
Список | pgsql-hackers |
Hi, On 2025-09-04 11:14:53 -0500, Sami Imseih wrote: > GDB when setting a breakpoint at pgstat_entry_ref_hash_insert (which > is called inside > pgstat_get_entry_ref_cached) shows that the padding has some unexpected > values, see the 12-15th byte "0x00 0x23 0x21 0x21" which based on the > memset done earlier should be 0. > > ``` > (gdb) x/24xb d > 0x7fff68cc16f0: 0x02 0x00 0x00 0x00 0x05 0x00 0x00 0x00 > 0x7fff68cc16f8: 0x00 0x00 0x00 0x00 0x00 0x23 0x21 0x21 > 0x7fff68cc1700: 0x67 0x0a 0x00 0x00 0x00 0x00 0x00 0x00 > (gdb) > ``` > > Now, if we pass the key by reference to pgstat_entry_ref_hash_insert as is > patched, we can see the padding is in fact cleared. > > ``` > (gdb) x/24xb d > 0x7ffe1bf6c640: 0x01 0x00 0x00 0x00 0x05 0x00 0x00 0x00 > 0x7ffe1bf6c648: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 > 0x7ffe1bf6c650: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 > ``` > > This looks like a compiler bug, we tested multiple ways to workaround: Padding bytes aren't guaranteed to be zeroed, unless you take care to zero them out with memset or such. That's not a compiler bug. Greetings, Andres Freund
В списке pgsql-hackers по дате отправления: