public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Lv Ying <lvying.system.thoughts@gmail.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org, lvying6@huawei.com
Subject: Re: [RFC] elf: fine-grained output LD_DEBUG log when symbol lookup error
Date: Wed, 17 Aug 2022 11:51:58 +0800	[thread overview]
Message-ID: <87e5a2d3-f7a3-0749-cb70-e86ba27baf48@gmail.com> (raw)
In-Reply-To: <875yj2ootn.fsf@oldenburg.str.redhat.com>

Hi, Florian.
Sorry to reply you too late, and thanks for your reply. I took some time to reproduce this problem.
And I resend this email again to cc libc-alpha@sourceware.org.

> Do you have a reproducer that shows what you want to fix?
Yes, here is the reproduce processing:
I want to get shrared object library search paths in openEuler 22.03(https://ftp.belnet.be/mirror/openeuler/openEuler-22.03-LTS/):


# export LD_DEBUG=libs
# whoami
     40503:    find library=libc.so.6 [0]; searching
     40503:     search cache=/etc/ld.so.cache
     40503:      trying file=/usr/lib64/libc.so.6
     40503:   
     40503:   
     40503:    calling init: /lib64/ld-linux-x86-64.so.2
     40503:   
     40503:   
     40503:    calling init: /usr/lib64/libc.so.6
     40503:   
     40503:   
     40503:    initialize program: whoami
     40503:   
     40503:   
     40503:    transferring control: whoami
     40503:   
     40503:    find library=libnss_sss.so.2 [0]; searching
     40503:     search cache=/etc/ld.so.cache
     40503:      trying file=/usr/lib64/libnss_sss.so.2
     40503:   
     40503:   
     40503:    calling init: /usr/lib64/libnss_sss.so.2
     40503:   
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_endaliasent (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_endetherent (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_endprotoent (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_endrpcent (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_endsgent (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_endspent (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getaliasbyname_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getaliasent_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getcanonname_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getetherent_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_gethostbyaddr2_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_gethostbyname3_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_gethostbyname4_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_gethostton_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getntohost_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getprotobyname_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getprotobynumber_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getprotoent_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getpublickey (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getrpcbyname_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getrpcbynumber_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getrpcent_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getsecretkey (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getsgent_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getsgnam_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getspent_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_getspnam_r (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_netname2user (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_setaliasent (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_setetherent (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_setprotoent (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_setrpcent (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_setsgent (fatal)
     40503:    /usr/lib64/libnss_sss.so.2: error: symbol lookup error: undefined symbol: _nss_sss_setspent (fatal)
root


As ld.so man page(https://man7.org/linux/man-pages/man8/ld-linux.so.8.html) said, LD_DEBUG=libs, only display library search paths.
"symbol lookup error" debug info message should not mess the debuginfo.
Because there are LD_DEBUG=reloc and LD_DEBUG=all to display relocation processing.

 

> The current code looks like this:
>
>       if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
> 	  && !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED))
> 	{
> 	  /* We could find no value for a strong reference.  */
> 	  const char *reference_name = undef_map ? undef_map->l_name : "";
> 	  const char *versionstr = version ? ", version " : "";
> 	  const char *versionname = (version && version->name
> 				     ? version->name : "");
> 	  struct dl_exception exception;
> 	  /* XXX We cannot translate the message.  */
> 	  _dl_exception_create_format
> 	    (&exception, DSO_FILENAME (reference_name),
> 	     "undefined symbol: %s%s%s",
> 	     undef_name, versionstr, versionname);
> 	  _dl_signal_cexception (0, &exception, N_("symbol lookup error"));
> 	  _dl_exception_free (&exception);
> 	}
>
> I think in general, we want to signal an exception here, and we can't
> mask that except in debug mode because it does not result in the right
> behavior.

As the above said, we do not mask that, we only display the exception in the corresponding
reloc LD_DEBUG mode.

Thanks
Lv Ying



  reply	other threads:[~2022-08-17  3:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-07 12:00 Lv Ying
2022-08-08 13:19 ` Florian Weimer
2022-08-17  3:51   ` Lv Ying [this message]
2022-08-17  5:56     ` Florian Weimer
2022-08-19 16:23       ` Lv Ying

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=87e5a2d3-f7a3-0749-cb70-e86ba27baf48@gmail.com \
    --to=lvying.system.thoughts@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=lvying6@huawei.com \
    /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).