Re: ubsan - Mailing list pgsql-hackers

From Alexander Lakhin
Subject Re: ubsan
Date
Msg-id aa2ef679-a651-48b2-8db8-9fbcefbd0853@gmail.com
Whole thread Raw
In response to Re: ubsan  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hello Tom,

05.11.2025 03:34, Tom Lane wrote:
> Alexander Lakhin <exclusion@gmail.com> writes:
>> I've just discovered that that function __ubsan_default_options() is
>> incompatible with -fsanitize=hwaddress:
>> $ tmp_install/usr/local/pgsql/bin/postgres
>> Segmentation fault
> Hi Alexander, I wonder if you can still reproduce this problem,
> and if so whether the patch proposed at [1] fixes it.
>
>             regards, tom lane
>
> [1] https://www.postgresql.org/message-id/707073.1762305575%40sss.pgh.pa.us

I don't have that device handy, but I've tried -fsanitize=hwaddress on two
ARM servers available, and despite other issues I've encountered, I could
reproduce the problem with __ubsan_default_options() on current master:
Program received signal SIGSEGV, Segmentation fault.
0x0000aaaaaed06e1c in __ubsan_default_options () at main.c:507
507     if (!reached_main)
(gdb) bt
#0  0x0000aaaaaed06e1c in __ubsan_default_options () at main.c:507
#1  0x0000aaaaac489d84 in __hwasan_init ()
#2  0x0000fffff7fc25c8 in _dl_init (main_map=0xfffff7fff380, argc=1, argv=0xfffffffff3f8, env=0xfffffffff408) at 
./elf/dl-init.c:106
#3  0x0000fffff7fd8d38 in _start () at ../sysdeps/aarch64/dl-start.S:46

The proposed patch really eliminates it. Thank you for recalling this!

Best regards,
Alexander



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [PATCH] Fix fragile walreceiver test.
Next
From: Álvaro Herrera
Date:
Subject: Re: [PATCH] Add pg_get_tablespace_ddl() function to reconstruct CREATE TABLESPACE statement