public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mbhangui at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug dynamic-link/27646] Linker error for non-existing NSS symbols (e.g. _nss_files_getcanonname_r) from within a dlmopen namespace.
Date: Fri, 02 Jul 2021 16:26:40 +0000	[thread overview]
Message-ID: <bug-27646-131-fc7QtRHMNs@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27646-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=27646

--- Comment #8 from cprogrammer <mbhangui at gmail dot com> ---
This is still an issue. Though it solves functions like gethostbyname crashing,
getpwent and family still crash with SIGSEGV. Details below on how to simulate
it. Setting LD_DEBUG to unused prevents the crash. Also modifying
/etc/nsswitch.conf to have passwd obtained only from files prevents the crash
(removing sss).

cat <<EOF>foo.c
#include <stdio.h>
#include <pwd.h>
void bar1()
{
  struct passwd *pw;
  pw = getpwent();
  if (pw)
    printf("%s\n", pw->pw_name);
}
EOF
cat <<EOF>test.c
#define _GNU_SOURCE
#include <dlfcn.h>
#include <stdio.h>
int
main(int argc, char **argv)
{
  void *handle;
  int (*func) ();

  if (!(handle = dlmopen(LM_ID_NEWLM, "./libfoo.so", RTLD_NOW))) {
                perror("dlmopen");
                return 1;
  }
  func = dlsym(handle, "bar1");
  (*func)();
  return 0;
}
EOF

$ gcc -fPIC -shared foo.c -o libfoo.so
$ gcc test.c -o test -ldl
$ ./test
Segmentation fault (core dumped)

$ env LD_DEBUG=unused ./test
root

$ rpm -qf /etc/nsswitch.conf
glibc-2.33-18.fc34.x86_64

$ cat /etc/fedora-release
Fedora release 34 (Thirty Four)

$ egrep -v "^#|^$" /etc/nsswitch.conf
passwd:     sss files systemd
group:      sss files systemd
netgroup:   sss files
automount:  sss files
services:   sss files
shadow:     files sss
hosts:      files myhostname mdns4_minimal [NOTFOUND=return] resolve
[!UNAVAIL=return] dns
bootparams: files
ethers:     files
netmasks:   files
networks:   files
protocols:  files
rpc:        files
publickey:  files
aliases:    files

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2021-07-02 16:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24 18:03 [Bug dynamic-link/27646] New: " alfonso.peterssen at oracle dot com
2021-03-31 10:00 ` [Bug dynamic-link/27646] " gilles.m.duboscq at gmail dot com
2021-05-16  3:39 ` evangelos at foutrelis dot com
2021-06-09 11:57 ` mbhangui at gmail dot com
2021-06-09 13:51 ` fweimer at redhat dot com
2021-06-09 13:57 ` fweimer at redhat dot com
2021-06-09 16:45 ` fweimer at redhat dot com
2021-06-14  7:45 ` gilles.m.duboscq at gmail dot com
2021-06-14  8:54 ` fweimer at redhat dot com
2021-06-14  8:55 ` fweimer at redhat dot com
2021-06-14  9:48 ` fweimer at redhat dot com
2021-06-17 13:09 ` fweimer at redhat dot com
2021-07-02 16:26 ` mbhangui at gmail dot com [this message]
2021-07-06 11:14 ` fweimer at redhat dot com
2021-07-06 11:33 ` mbhangui at gmail dot com
2021-07-06 11:47 ` fweimer at redhat dot com
2021-07-06 16:19 ` gilles.m.duboscq at gmail dot com
2021-07-06 16:23 ` fweimer at redhat dot com
2021-12-03 11:03 ` lewurm at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27646-131-fc7QtRHMNs@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).