From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id 8D16B3858D37 for ; Wed, 17 Aug 2022 03:52:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8D16B3858D37 Received: by mail-pj1-x102f.google.com with SMTP id o5-20020a17090a3d4500b001ef76490983so723373pjf.2 for ; Tue, 16 Aug 2022 20:52:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:x-gm-message-state:from:to :cc; bh=/RZ2vieNbqA7kUh56GZGkX4NNePdMe2SV9ZhyqiNc6I=; b=hG0BoanhIQdNEoMnpf2nLn4C84Q7psgkQByxRYrJbbSWF/bOFF1t6Nq+Psbk3nLK7B d2opbO1sdcROIv41c8VTj2H34rebJ2dY4NUGWAhaq2dY0C6flb8GtGwTxFLp4GNrIpTM TvdsRpJAuYzERZBWY8AY3caJV6Aufqa+r6GvUJ8oUzlg8GhBthik+OO2LXF1Df0smW9M XyUjN2Kx4za3NccRbnRUdU7ZYkWc7fWSlgTfQ7D77foKhn/A+xDOgAJTeVhbg9Lo5rKD uOiMxB/Y3i+HZzZKibhOdxyOXJ3BDCckH7tiejY4MGjcgvKvHA53ppvlRbIbAJjnmpQk s/XQ== X-Gm-Message-State: ACgBeo0FyLVEPPFaZR+1ZGc3DeRPo32feWnNAb/1XXQRQCCxGTEzw3bH nVMouXpihi2ZYlvaQB2rCik= X-Google-Smtp-Source: AA6agR7mDKkW6ynPYs5Wi+pmlkCze8/aK5mWziTyGT4bDJpddkEiduP5yDBfLn+3SvRn5V6SH4u2pg== X-Received: by 2002:a17:90a:9907:b0:1f5:2318:ea6d with SMTP id b7-20020a17090a990700b001f52318ea6dmr1791942pjp.163.1660708325552; Tue, 16 Aug 2022 20:52:05 -0700 (PDT) Received: from [7.249.249.8] ([119.3.119.19]) by smtp.gmail.com with ESMTPSA id 5-20020a631145000000b00429b6e6c539sm1266380pgr.61.2022.08.16.20.52.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Aug 2022 20:52:05 -0700 (PDT) Subject: Re: [RFC] elf: fine-grained output LD_DEBUG log when symbol lookup error To: Florian Weimer Cc: libc-alpha@sourceware.org, lvying6@huawei.com References: <20220807120003.313131-1-lvying.system.thoughts@gmail.com> <875yj2ootn.fsf@oldenburg.str.redhat.com> From: Lv Ying Message-ID: <87e5a2d3-f7a3-0749-cb70-e86ba27baf48@gmail.com> Date: Wed, 17 Aug 2022 11:51:58 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <875yj2ootn.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2022 03:52:08 -0000 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