Thread: some problem explicit_bzero with building PostgreSQL on linux
Hi, we got some problem with building PostgreSQL (version 15.1) on linux ldd —version returns ldd (Debian GLIBC 2.31-13+deb11u5.tmw1) 2.31 we can build it all right, however we want to use binaries on different glibc version so we’re detecting usage of the glibc version > 2.17 and we need to prevent usage of symbols (like explicit_bzero), that wasn’t exist in glibc 2.17. what we see that even if I commented line $as_echo "#define HAVE_EXPLICIT_BZERO 1" >>confdefs.h from configure we still have a problem - symbol explicit_bzero was leaked in lib/libpq.so.5.15, bin/postgres, bin/pg_verifybackup I was able to verify that HAVE_EXPLICIT_BZERO wasn’t defined in all c files that use explicit_bzero: ./src/interfaces/libpq/fe-connect.c ./src/backend/libpq/be-secure-common.c ./src/common/hmac_openssl.c ./src/common/cryptohash.c ./src/common/cryptohash_openssl.c ./src/common/hmac.c how we can guaranty that if HAVE_EXPLICIT_BZERO is not defined then explicit_bzero function implemented in port/explicit_bzero.c will be used (just like in Darwin or windows) thanks in advance dm
Dimitry Markman <dmarkman@mathworks.com> writes: > how we can guaranty that if HAVE_EXPLICIT_BZERO is not defined then > explicit_bzero function implemented in port/explicit_bzero.c will be used (just like in Darwin or windows) Did you remember to add explicit_bzero.o to LIBOBJS in the configured Makefile.global? If it still doesn't work, then evidently your toolchain is selecting the system's built-in definition of explicit_bzero over the one in src/port/. This is not terribly surprising given that there has to be some amount of compiler magic involved in that function. You may have to resort to actually building Postgres on a platform without explicit_bzero. regards, tom lane
Hi Tom, thanks a lot
Adding explicit_bzero.o did the job
Thanks a lot
dm
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Tuesday, March 7, 2023 at 9:14 AM
To: Dimitry Markman <dmarkman@mathworks.com>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>, Bhavya Dabas <bdabas@mathworks.com>
Subject: Re: some problem explicit_bzero with building PostgreSQL on linux
Dimitry Markman <dmarkman@mathworks.com> writes:
> how we can guaranty that if HAVE_EXPLICIT_BZERO is not defined then
> explicit_bzero function implemented in port/explicit_bzero.c will be used (just like in Darwin or windows)
Did you remember to add explicit_bzero.o to LIBOBJS in
the configured Makefile.global?
If it still doesn't work, then evidently your toolchain is selecting
the system's built-in definition of explicit_bzero over the one in
src/port/. This is not terribly surprising given that there has to be
some amount of compiler magic involved in that function. You may have
to resort to actually building Postgres on a platform without
explicit_bzero.
regards, tom lane