Re: Fix some ubsan/asan related issues

Поиск
Список
Период
Сортировка
От Tristan Partin
Тема Re: Fix some ubsan/asan related issues
Дата
Msg-id CYT3IUIG27KH.3C4TYKWRC1K83@neon.tech
обсуждение исходный текст
Ответ на Re: Fix some ubsan/asan related issues  (Alexander Lakhin <exclusion@gmail.com>)
Список pgsql-hackers
On Tue Jan 30, 2024 at 10:00 PM CST, Alexander Lakhin wrote:
> Hello,
>
> 30.01.2024 18:57, Tristan Partin wrote:
> > Patch 1:
> >
> > Passing NULL as a second argument to memcpy breaks ubsan, ...
>
> Maybe you would like to fix also one more similar place, reached with:
> create extension xml2;
> select xslt_process('<x/>',
> $$<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:template match="@*|node()">
> </xsl:template>
> </xsl:stylesheet>$$);
>
> varlena.c:201:26: runtime error: null pointer passed as argument 2, which is declared to never be null
>
> There is also an issue with pg_bsd_indent, I stumble upon when doing
> `make check-world` with the sanitizers enabled:
> https://www.postgresql.org/message-id/591971ce-25c1-90f3-0526-5f54e3ebb32e%40gmail.com
>
> 31.01.2024 00:23, Andres Freund wrote:
> > The reason asan fails is that it uses a "shadow stack" to track stack variable
> > lifetimes. These confuse our stack depth check. CI doesn't have the issue
> > because the compiler doesn't yet enable the feature, locally I get around it
> > by using ASAN_OPTIONS=detect_stack_use_after_return=0:...
>
> Even with detect_stack_use_after_return=0, clang-18's asan makes the test
> 012_subtransactions.pl fail:
> 2024-01-31 03:24:25.691 UTC [4112455] 012_subtransactions.pl LOG: statement: SELECT hs_subxids(201);
> 2024-01-31 03:24:25.714 UTC [4112455] 012_subtransactions.pl ERROR: stack depth limit exceeded
> 2024-01-31 03:24:25.714 UTC [4112455] 012_subtransactions.pl HINT: Increase the configuration parameter
max_stack_depth 
> (currently 2048kB), after ensuring the platform's stack depth limit is adequate.
>
> (All the other tests pass.)
> Though the same test passes when I use clang-16.

Thanks Alexander! I will try and take a look at these.

--
Tristan Partin
Neon (https://neon.tech)



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: make dist using git archive
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: scalability bottlenecks with (many) partitions (and more)