On 2025/07/23 09:24:09 -0400, Chet Ramey wrote:
> On 7/23/25 9:06 AM, Dr. Werner Fink wrote:
> > On 2025/07/23 14:53:23 +0200, Dr. Werner Fink wrote:
> > > 
> > > The problem is the LD_PRELOAD use in the libssh test suite
> > > 
> > > with HAVE_SETRESUID and HAVE_SETRESGID enabled the call
> > > 
> > > LD_PRELOAD=/usr/lib64/libsocket_wrapper.so:/usr/lib64/libnss_wrapper.so:/usr/lib64/libuid_wrapper.so:/usr/lib64/libpam_wrapper.so:/home/abuild/rpmbuild/BUILD/libssh-test-0.11.2-build/libssh-0.11.2/build/lib/libchroot_wrapper.so:/home/abuild/rpmbuild/BUILD/libssh-test-0.11.2-build/libssh-0.11.2/build/lib/libfs_wrapper.so
> > >  ./bash
> > > Segmentation fault         (core dumped) 
> > > LD_PRELOAD=/usr/lib64/libsocket_wrapper.so:/usr/lib64/libnss_wrapper.so:/usr/lib64/libuid_wrapper.so:/usr/lib64/libpam_wrapper.so:/home/abuild/rpmbuild/BUILD/libssh-test-0.11.2-build/libssh-0.11.2/build/lib/libchroot_wrapper.so:/home/abuild/rpmbuild/BUILD/libssh-test-0.11.2-build/libssh-0.11.2/build/lib/libfs_wrapper.so
> > >  ./bash
> > > 
> > > does segfault whereas HAVE_SETRESUID and HAVE_SETRESGID disabled
> > > 
> > > LD_PRELOAD=/usr/lib64/libsocket_wrapper.so:/usr/lib64/libnss_wrapper.so:/usr/lib64/libuid_wrapper.so:/usr/lib64/libpam_wrapper.so:/home/abuild/rpmbuild/BUILD/libssh-test-0.11.2-build/libssh-0.11.2/build/lib/libchroot_wrapper.so:/home/abuild/rpmbuild/BUILD/libssh-test-0.11.2-build/libssh-0.11.2/build/lib/libfs_wrapper.so
> > >  strace -s 4096 -o log ./bash
> > > abuild@noether:/mnt>
> > > 
> > > it works
> > 
> > Can be reduced to
> > 
> >    LD_PRELOAD=/usr/lib64/libuid_wrapper.so ./bash
> 
> So running a version of bash configured to use a working version of
> setresuid/setresgid from libc breaks (or finds a bug in) libuid_wrapper
> by calling those functions.
> 
> Well, maybe you want to configure bash using the same wrapper library.

Correct configured it seems to work

 abuild@noether:/mnt> LD_PRELOAD=/usr/lib64/libuid_wrapper.so ./bash
 Segmentation fault         (core dumped) 
LD_PRELOAD=/usr/lib64/libuid_wrapper.so ./bash
 abuild@noether:/mnt> UID_WRAPPER=1 UID_WRAPPER_ROOT=1 
LD_PRELOAD=/usr/lib64/libuid_wrapper.so ./bash
 noether:mnt # touch /root/x
 touch: cannot touch '/root/x': Permission denied

it fakes root but is not root (I guess this faked root is for e.g. the test 
suite of libssh)

Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

Attachment: signature.asc
Description: PGP signature

Reply via email to