Bug 277222 - WITH_BIND_NOW + libsys/rtld breaks bind 9.18 / mysql / java / ...
Summary: WITH_BIND_NOW + libsys/rtld breaks bind 9.18 / mysql / java / ...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-22 10:21 UTC by Alexander Leidinger
Modified: 2024-02-24 22:29 UTC (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Leidinger freebsd_committer freebsd_triage 2024-02-22 10:21:05 UTC
Hi,

-current as of 2024-02-22 in the morning (UTC) still fails. Issues are bind 9.18 not being able to open files (I use it as a local primary, but a caching resolver should already exhibit the issue), mysql not being able to do a filesystem socket authentication (mysql command line client connecting to the local database with user authentication), java being able to bind to TCP ports, ...

Reverting those commits (maybe a bit too much, but anyway) make all of the above issues vanish:
452c5e9995ab4cd6c7ea230cffe0c53bfa65c1ab	fdlopen(3): do not create a new object mapping if already loaded
2f4cbf459d4af41977be30eab2f6f7d7e9f9b5b5	libsys auxv.c: add fences needed to ensure that flag works
3668e1fa0a50562f58508565bdde0bdb83e0b475	libsys: disable ssp
fe920a4f2f80fda4a24c3991de0d593e06ae7f6f	libsys: move errno to libsys
8271d9b99a3b98c662ee9a6257a144284b7e1728	libsys: remove usage of pthread_once and _once_stub
af9758deff9abb118ce189cbab0a830b02fc63db	libsys: internalize memcpy, memset, and strlcpy
180df764c4ee570850deb4a910a11780ec3316df	rtld: remove pointless "extern"
eb90239d08863bcff3cf82a556ad9d89776cdf3f	lib{c,thr}: add DT_RUNPATH for gcc -m32
99ea67573164637d633e8051eb0a5d52f1f9488e	lib{c,sys}: move auxargs more firmly into libsys
968a18975adc9c2a619bb52aa2f009de99fc9e24	rtld: ignore load_filtees() calls if we already loading filtees for the obj
30b5f6b33b35623e6b6aa1d27a78311e199fa602	rtld load_filtees(): reindent and reduce block nesting
9ea864b54b57f2d0125860fb923f8db52b20eac2	rtld symlook_obj: move common code to check filtees into helper
1995ea1ea2654d5c32ef17ddf651380ecc23c635	libsys: add guards to MD manpages
d5677b0b8b8a1505edeaafab5606c4f890c1a42d	libsys: actually install manpages
cc697d22c4a43d6d40744799695a65a1076bf3e8	libsys: move some missed manpages
82bebc7936581e9c4ff3604d4cb998f8cc017f50	rescue: Don't explicitly link with libsys
49d684369c6682eebca325c55a6c96b7c03f5aeb	libthr: filter rather than link with libsys
49076f376af52ac6cb7e8dfaf19766044fedd4d5	libc: don't directly link libsys
57ddfad884a0c490e462b78634f2582e6b07dc9a	lib/libc: version auxiliary libsys.so
11f9745c5bab98165238882f0dde1058bf42b3aa	libsys: fix powerpcspe build
8d2e8f720516e88a896390763ff372a6e5a2550f	libc: make syscall stubs empty for shared lib
f21777224411fee14b8aea6d8465bd6c2b318429	SYS.h: make _SYSCALL_BODY overridable
0d4f7723bc43e06ca22025740cb826a7f282ea11	libc: link libsys as a auxiliary filter library
ef9871c6205c158b16ee23702d2b8c043debc51a	libthr: move _umtx_op_err() to libsys
e9d961055aa2502f4915611e8fb2e9f9f9c86719	libsys: plumb in to build
86deddfacb6f66549303c1cea241a55de25fc0c2	libsys: generate private symbol map
b71defdbd8715c1a778ebf8195e41b1c6db90d6c	makesyscalls: generate private syscall symbols
10f1b536ad71fddc725da58d9e30a42fa66d183c	libc: move __getosreldate to libsys
f70c5a0925c621ce862327a1f335394e731fbaed	libc: move getpagesize(s) to libsys
4c33415e4cf52c075046569000d92032496978fb	libc: elf auxiliary vector handling to libsys
81245a77f0a34f80f8097ed461d785a9074855e3	libc: compile _once in libsys
1e2502bfca58344780747c3948b51164e25c8b5f	libc: move MD sys related symbols to libsys
cdecda8da32b67f2be34a4d2ea37f90986a45a00	libc: move rfork_thread(3) to libsys
31a46e2cc84d7ebfc25ce5a33e54681057e9ed9a	libc: Move per-arch sys/Makefile.inc to libsys
19149b03b1b5ae3134a58bb6baafef07888181a5	libc: remove .PATH refs to libc/<arch>/sys
4bc66c0f9f2c349af86cbf4e77f000b49d819fea	libc: remove remaining x86 sys bits to libsys
0d6cc87b18ded879b17574384ce86f119921bc5d	libc: libc/<arch>/sys/__vdso_gettc -> libsys/<arch>/
84dd0c080ba5ddf67a54e9eb070fe5174ffead19	libc: libc/gen/sched_getcpu_gen.c -> libsys/
a52cb4c480f270fc7158a0f58179f7b80d8a5b3c	Document aio_read2/aio_write2
8dfc788b8480a13f1f945f0a94d8b1e327af5c6f	aio_read2/aio_write2: add AIO_OP2_VECTORED
06cb1c3f9528f088bdaf10d28dcfe7eeaad726d3	libc: add aio_read2() and aio_write2() functions
e4b7bbd6ab77e908a60362aa29e518f224a117b0	lio_listio(2): add LIO_FOFFSET flag to ignore aiocb aio_offset
29d079c9649174a36a87a26d1f99e3c0b3e78e0c	libsys: move __libsys_interposer consumers
8f529310bd09c064d5d69740f03c6fe6f12650a3	libc: libc/sys/Makefile.inc -> libsys/Makefile.sys
8269e7673cf033aba67dab8264fe719920c70f87	libsys: relocate implementations and manpages
228d8c9efe1e9a2946a5e64ff33362a54b9c3b5d	libc: split libc and syscall interposing (2/2)
9cbd96582c0ac133f911270a47bff189d769ac8d	libc: split libc and syscall interposing (1/2)

My src.conf:
WITHOUT_PROFILE=yes
MALLOC_PRODUCTION=yes
WITH_MALLOC_PRODUCTION=yes
WITHOUT_LLVM_ASSERTIONS=yes
WITH_RETPOLINE=yes
WITH_BIND_NOW=yes
WITHOUT_CLEAN=yes

src-env.conf has only WITH_META_MODE=yes.

make.conf:
.if empty{.CURDIR:M/usr/src/sys/boot*}
CPUTYPE?=native
.endif
. if !empty{.CURDIR:M/usr/src/*}
CFLAGS+= -O2 -pipe
.else
CFLAGS+= -O2 -pipe -mtune=native
.endif

Bye,
Alexander.
Comment 1 Alexander Leidinger freebsd_committer freebsd_triage 2024-02-22 11:25:07 UTC
Little typo: "java NOT being able to bind to TCP ports".
Comment 2 Alexander Leidinger freebsd_committer freebsd_triage 2024-02-22 15:01:28 UTC
lang/rust (1.76) builds just fine with the backout of libsys, whereas v1.75 failed in a libsys userland.

@vishwin, does 1.76 build in a libsys world for you?
Comment 3 Mark Millard 2024-02-22 17:22:49 UTC
(In reply to Alexander Leidinger from comment #2)

FYI: on aarch64 14.0-RELELASE build failures for lang/rust 1.76.0
have been reported, not just for main [so: 15]. On main I get the
failure but can build it in an armv7 context just fine.

lang/rust may be a messy example with multiple issues going on at
the same time.
Comment 4 Brooks Davis freebsd_committer freebsd_triage 2024-02-22 18:12:07 UTC
The problem seems to be an interaction with WITH_BIND_NOW.  If I rebuild a jail with it on, poudriere is nonfunctional in quite bizarre ways (e.g., pkg somehow doesn't get installed in a testport run).  I suggest disabling it and doing a clean build.  It would be really helpful to find a smaller or simpler reproducer, ideally one that works LD_BIND_NOW=yes.


FIWI, I'd be fairly surprised if reverting anything before:

0d4f7723bc43e06ca22025740cb826a7f282ea11	libc: link libsys as a auxiliary filter library

makes a difference.  Before that point libc is untouched other than shuffling things around.
Comment 5 Konstantin Belousov freebsd_committer freebsd_triage 2024-02-22 18:14:17 UTC
(In reply to Brooks Davis from comment #4)
Can you provide any self-contained example of BIND_NOW breakage?
Comment 6 Charlie Li freebsd_committer freebsd_triage 2024-02-22 19:58:40 UTC
Turns out I also have WITH_BIND_NOW specified in all of my src.confs.

I built a source unmodified base bad90cb4f686 with my usual src.conf for that machine, and on boot, date(1) crashes when trying to print the date for the login prompt, /var/log is not mounted or read-only (so no /var/log/messages or anything) and a bunch of base system stuff doesn't run (or tries to run but exits with "no error"). No dumps or traces are created or available.

(In reply to Brooks Davis from comment #4)
The one and only commit that I have unequivocally identified as the culprit is base 968a18975adc; reverting this (and it is cleanly revertable) on top of every later commit keeps my systems (at least userlands) running.
Comment 7 Alexander Leidinger freebsd_committer freebsd_triage 2024-02-23 07:21:37 UTC
(In reply to Konstantin Belousov from comment #5)
In a jail which has a world with WITH_BIND_NOW, "su" doesn't work.

Booting a WITH_BIND_NOW world does not do anything useful (nearly nothing is started and you need console access to fix it, remote access is not possible), so if you install such a world into a VM I'm sure you can find plenty of stuff directly on boot. My gut feeling is that (nearly) everything which is not static breaks.
Comment 8 Alexander Leidinger freebsd_committer freebsd_triage 2024-02-23 09:05:19 UTC
(In reply to Brooks Davis from comment #4)
I did a clean build without BIND_NOW (source with libsys) in the basesystem. All the ports are still build with WITH_PIE=yes, WITH_RELRO=yes, WITH_BIND_NOW=yes.

I can confirm that I do NOT see any issues with bind or mysql (the rest I haven't checked yet).
Comment 9 Gleb Smirnoff freebsd_committer freebsd_triage 2024-02-24 20:36:51 UTC
Alexander, can you please check if the problem is fixed or not
by baa7d0741b9a2117410d558c6715906980723eed?
Comment 10 Alexander Leidinger freebsd_committer freebsd_triage 2024-02-24 22:29:16 UTC
(In reply to Gleb Smirnoff from comment #9)
Yes, it is. bind, mysql and java work with a BIND_NOW world.