Re: 012_subtransactions.pl vs clang -fsanitize=undefined

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 012_subtransactions.pl vs clang -fsanitize=undefined
Date: 2022-07-24 22:39:25
Message-ID: CA+hUKG+AAz2cMBtizgEftmneOk_=g_c4Hx_4JDq5KnuoKKYfAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 25, 2022 at 10:18 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kenaniah Cerny 2022-07-24 23:03:17 Re: Proposal: allow database-specific role memberships
Previous Message Tom Lane 2022-07-24 22:18:03 Re: 012_subtransactions.pl vs clang -fsanitize=undefined