libresolv-wrapper does not work on 22.04, may just need rebuild

Bug #2015570 reported by Greg Hudson
10
This bug affects 2 people
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_64-linux-gnu/libc.so.6 | grep nsearch
000000000014e2b0 l F .text 000000000000009f ___res_nsearch
000000000014e2b0 g F .text 000000000000009f __res_nsearch@GLIBC_2.2.5
000000000014e2b0 g F .text 000000000000009f res_nsearch@@GLIBC_2.34

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_64-linux-gnu/libresolv_wrapper.so | grep nsearch
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/lib/libresolv_wrapper.so | grep nsearch
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_WRAPPER_HOSTS environment variable pointing at the hosts file. I noticed the problem when running the MIT krb5 test suite on an Ubuntu 22.04 image with the libresolv-wrapper package installed.

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: libresolv-wrapper 1.1.7-1
ProcVersionSignature: Ubuntu 5.15.0-58.64-generic 5.15.74
Uname: Linux 5.15.0-58-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.3
Architecture: amd64
CasperMD5CheckResult: unknown
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)

Revision history for this message
Greg Hudson (ghudson) wrote :
Revision history for this message
Simon Josefsson (simon-josefsson) wrote :

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
mkdir b
cd b
cmake -DUNIT_TESTING=ON ..
make -C tests/
cd tests
sed -e 's#\(LD_PRELOAD=\)[^;]*/\(libresolv_wrapper.so\)#\1\2#' -i CTestTestfile.cmake
ctest --output-on-failure -V

If you rebuild the package and install that instead of Ubuntu 22.04 version, the above snippet works.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in resolv-wrapper (Ubuntu):
status: New → Confirmed
Revision history for this message
Simon Josefsson (simon-josefsson) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.