public inbox for [email protected]
help / color / mirror / Atom feedFrom: Noah Misch <[email protected]>
To: Zhihong Yu <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: null iv parameter passed to combo_init()
Date: Thu, 13 Jan 2022 20:09:40 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CALNJ-vREy8vRN6evswXJ2qVX1P7OtebUmfC+ZRU9HH7r7K3HSw@mail.gmail.com>
References: <CALNJ-vSBb2Ees=KB0frYBh7foK-QNZMbK7Vz66bUJa09D+CHAw@mail.gmail.com>
<[email protected]>
<CALNJ-vTh9BXARHg3iaCAzr97Fws2W5aR6nRPJfT4u3VdKDzRTQ@mail.gmail.com>
<[email protected]>
<[email protected]>
<CALNJ-vTuaO+6hM4wY2aE0V7WdB56bwTXDp50Bn2U1ggmonVGbA@mail.gmail.com>
<[email protected]>
<CALNJ-vSf3zDrYm6RqoKqD8CkM9J97mmKroN2HD5ryEO6V6oT6Q@mail.gmail.com>
<CALNJ-vRum8OqMkspx-OV3Fg4jhb5AeLeb9Petz2Mo9K7f3HfAw@mail.gmail.com>
<CALNJ-vREy8vRN6evswXJ2qVX1P7OtebUmfC+ZRU9HH7r7K3HSw@mail.gmail.com>
On Sun, Jan 09, 2022 at 06:45:09PM -0800, Zhihong Yu wrote:
> On Sun, Jan 9, 2022 at 1:27 PM Zhihong Yu <[email protected]> wrote:
> > After installing gcc-11, ./configure passed (with 0003-memcpy-null.patch).
> > In the output of `make check-world`, I don't see `runtime error`.
That's expected. With -fsanitize-undefined-trap-on-error, the program will
generate SIGILL when UBSan detects undefined behavior. To get "runtime error"
messages in the postmaster log, drop -fsanitize-undefined-trap-on-error. Both
ways of running the tests have uses. -fsanitize-undefined-trap-on-error is
better when you think the code is clean, because a zero "make check-world"
exit status confirms the code is clean. Once you know the code is unclean in
some way, -fsanitize-undefined-trap-on-error is better for getting details.
> > Though there was a crash (maybe specific to my machine):
> >
> > Core was generated by
> > `/nfusr/dev-server/zyu/postgres/tmp_install/usr/local/pgsql/bin/postgres
> > --singl'.
> > Program terminated with signal SIGILL, Illegal instruction.
> > #0 0x000000000050642d in write_item.cold ()
> > Missing separate debuginfos, use: debuginfo-install
> > glibc-2.17-325.el7_9.x86_64 nss-pam-ldapd-0.8.13-25.el7.x86_64
> > sssd-client-1.16.5-10.el7_9.10.x86_64
> > (gdb) bt
> > #0 0x000000000050642d in write_item.cold ()
> > #1 0x0000000000ba9d1b in write_relcache_init_file ()
> > #2 0x0000000000bb58f7 in RelationCacheInitializePhase3 ()
> > #3 0x0000000000bd5cb5 in InitPostgres ()
> > #4 0x0000000000a0a9ea in PostgresMain ()
That is UBSan detecting undefined behavior. A successful patch version will
fix write_item(), among many other places that are currently making
check-world fail. I get the same when testing your v5 under "gcc (Debian
11.2.0-13) 11.2.0". I used the same host as buildfarm member thorntail, and I
configured like this:
./configure -C --with-lz4 --prefix=$HOME/sw/nopath/pghead --enable-tap-tests --enable-debug --enable-depend --enable-cassert CC='ccache gcc-11 -fsanitize=undefined -fsanitize-undefined-trap-on-error' CFLAGS='-O2 -funwind-tables'
> Earlier I was using devtoolset-11 which had an `Illegal instruction` error.
>
> I compiled / installed gcc-11 from source (which took whole afternoon).
> `make check-world` passed with patch v3.
> In tmp_install/log/install.log, I saw:
>
> gcc -Wall -Wmissing-prototypes -Wpointer-arith
> -Wdeclaration-after-statement -Werror=vla -Wendif-labels
> -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type
> -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard
> -Wno-format-truncation -Wno-stringop-truncation -fsanitize=undefined
> -fsanitize-undefined-trap-on-error -I../../src/port -DFRONTEND
> -I../../src/include -D_GNU_SOURCE -c -o path.o path.c
> rm -f libpgport.a
Perhaps this self-compiled gcc-11 is defective, being unable to detect the
instances of undefined behavior that other builds detect. If so, use the
"devtoolset-11" gcc instead. You're also building without optimization; that
might be the problem.
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: null iv parameter passed to combo_init()
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox