Re: ubsan

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Date: 2022-03-23T19:22:41Z
Lists: pgsql-hackers
Hi,

On 2022-03-23 11:21:37 -0700, Andres Freund wrote:
> On 2022-03-23 13:54:50 -0400, Tom Lane wrote:
> > Andres Freund <andres@anarazel.de> writes:
> > > I tried to run postgres with ubsan to debug something.
> > 
> > For 0001, could we just replace configure's dlopen check with the
> > dlsym check?  Or are you afraid of reverse-case failures?
> 
> Yea, I was worried about that. But now that I think more about it, it's hard
> to believe something could provide / intercept dlsym but not dlopen. I guess
> we can try and see?
>
> > 0003: OK.  Interesting though that we haven't seen these before.

I think we should backpatch both, based on the reasoning in
46ab07ffda9d6c8e63360ded2d4568aa160a7700 ?

Greetings,

Andres Freund



Commits

  1. Avoid possible crash within libsanitizer.

  2. ci: Use -fsanitize=undefined,alignment,address in linux tasks

  3. Add workaround to make ubsan and ps_status.c compatible

  4. Don't try to translate NULL in GetConfigOptionByNum().

  5. Don't call fwrite() with len == 0 when writing out relcache init file.

  6. configure: check for dlsym instead of dlopen.

  7. Clean up assorted failures under clang's -fsanitize=undefined checks.