libresolv-wrapper does not work on 22.04, may just need rebuild
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
resolv-wrapper (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
libresolv-wrapper contains a small shared object intended to be used with LD_PRELOAD to intercept calls to the BSD resolver API such as res_nsearch(), faking up the existence of records in the DNS. It is typically used when testing other software. The libresolv-wrapper package in Ubuntu 22.04 does not work with the libc package in the same version, because it intercepts the wrong symbols. This problem likely arose when libc was upgraded past version 2.34, and can likely be fixed by simply rebuilding the package.
Here we can see that the default symbol version for res_nsearch (indicated by the double "@@") in libc is simply res_nsearch:
$ objdump --syms /lib/x86_
000000000014e2b0 l F .text 000000000000009f ___res_nsearch
000000000014e2b0 g F .text 000000000000009f __res_nsearch@
000000000014e2b0 g F .text 000000000000009f res_nsearch@
while libresolv_wrapper is instead intercepting __res_nsearch, as would be necessary for older versions of libc which provided the symbol in libresolv.so:
$ objdump --dynamic-syms /lib/x86_
00000000000041d0 g DF .text 0000000000000009 Base __res_nsearch
If I build libresolv-wrapper (current or 1.7) from upstream source, we can see that it intercepts the proper symbol for the current version of libc:
$ objdump --dynamic-syms /me/rwinst/
0000000000006389 g DF .text 0000000000000048 Base res_nsearch
Testing whether resolv-wrapper works is slightly involved; you need a program that invokes the res_ APIs, a hosts file with fake DNS records, and a RESOLV_
ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: libresolv-wrapper 1.1.7-1
ProcVersionSign
Uname: Linux 5.15.0-58-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.3
Architecture: amd64
CasperMD5CheckR
CurrentDesktop: XFCE
Date: Fri Apr 7 10:19:58 2023
InstallationDate: Installed on 2020-04-29 (1072 days ago)
InstallationMedia: Xubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
RebootRequiredPkgs: Error: path contained symlinks.
SourcePackage: resolv-wrapper
UpgradeStatus: Upgraded to jammy on 2022-10-05 (183 days ago)
Hi
I can confirm that resolv-wrapper does not work, to see run the upstream regression suite on the system resolv-wrapper and see it fail:
git clone https:/ /git.samba. org/resolv_ wrapper. git PRELOAD= \)[^;]* /\(libresolv_ wrapper. so\)#\1\ 2#' -i CTestTestfile.cmake
mkdir b
cd b
cmake -DUNIT_TESTING=ON ..
make -C tests/
cd tests
sed -e 's#\(LD_
ctest --output-on-failure -V
If you rebuild the package and install that instead of Ubuntu 22.04 version, the above snippet works.