Re: ubsan fails on 32bit builds

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: ubsan fails on 32bit builds
Дата
Msg-id 20221117072821.5xufyalfyc2bml6o@awork3.anarazel.de
обсуждение исходный текст
Ответ на ubsan fails on 32bit builds  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Hi,

On 2022-11-16 17:42:30 -0800, Andres Freund wrote:
> Afaict the problem is that
>         proc = (PGPROC *) &(waitQueue->links);
> 
> is a gross gross hack - this isn't actually a PGPROC, it's pointing to an
> SHM_QUEUE, but *not* one embedded in PGPROC.  It kinda works because ->links
> is at offset 0 in PGPROC, which means that
>     SHMQueueInsertBefore(&(proc->links), &(MyProc->links));
> will turn &proc->links back into waitQueue->links. Which we then can enqueue
> again.
> 
> I don't see the point of this hack, even leaving ubsan's valid complaints
> aside. Why bother having this, sometimes, fake PGPROC pointer when we could
> just use a SHM_QUEUE* to determine the insertion point?

As done in the attached patch. With this ubsan passes both on 32bit and 64bit.

Greetings,

Andres Freund

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Maciek Sakrejda
Дата:
Сообщение: Odd behavior with pg_stat_statements and queries called from SQL functions
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: Assertion failure with barriers in parallel hash join