Re: 012_subtransactions.pl vs clang -fsanitize=undefined - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: 012_subtransactions.pl vs clang -fsanitize=undefined
Date
Msg-id CA+hUKG+AAz2cMBtizgEftmneOk_=g_c4Hx_4JDq5KnuoKKYfAg@mail.gmail.com
Whole thread Raw
In response to Re: 012_subtransactions.pl vs clang -fsanitize=undefined  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Jul 25, 2022 at 10:18 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I wrote:
> > I think what's happening is just that this build configuration
> > eats stack extravagantly.
>
> That's definitely it, but I don't entirely see why.  Here are a
> couple of major offenders though:

Interesting.  I wonder where we can read about what stuff clang puts
on the stack to implement the undefined behaviour checker (and what
GCC does differently here), but today I will resist the urge to go
looking.

As for workarounds (and as a note for my future self next time I'm
testing with UBSan), this is enough for the test to pass on my dev box
(4MB is not enough):

--- a/src/test/recovery/t/012_subtransactions.pl
+++ b/src/test/recovery/t/012_subtransactions.pl
@@ -16,6 +16,7 @@ $node_primary->append_conf(
        'postgresql.conf', qq(
        max_prepared_transactions = 10
        log_checkpoints = true
+       max_stack_depth = 5MB
 ));

It's also possible to tell it to keep out of certain functions:


https://github.com/llvm/llvm-project/blob/main/clang/docs/UndefinedBehaviorSanitizer.rst#disabling-instrumentation-with-attribute-no-sanitize-undefined



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 012_subtransactions.pl vs clang -fsanitize=undefined
Next
From: Kenaniah Cerny
Date:
Subject: Re: Proposal: allow database-specific role memberships