From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6AD40386102A; Wed, 17 Jul 2024 21:04:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6AD40386102A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1721250261; bh=dTXHIQbCJGhdbV5MAFO7v+Ni93SFp1p76jfIYXVd/IM=; h=From:To:Subject:Date:From; b=S1sdvlp3IjUgq83SpmpRJMKkApTtjpHoMmC9TVHVJl/jBYionPfwaz3399rPgSBu5 IFOItn5xgwkktRcSlptAWyFjQKAOuJNcg8u+VhG8uMD3Qmz9DyFehtEztvok57NyiH +uT6Gm6SxPXB18M2ITNnqyrZ7i7AC7DEAWWE1QaI= From: "woodard at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/31987] New: The name recorded in the link_map does not match what is returned by dlinfo(3) Date: Wed, 17 Jul 2024 21:04:20 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.39 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: woodard at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31987 Bug ID: 31987 Summary: The name recorded in the link_map does not match what is returned by dlinfo(3) Product: glibc Version: 2.39 Status: NEW Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: woodard at redhat dot com CC: drepper.fsp at gmail dot com Target Milestone: --- Created attachment 15631 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D15631&action=3Ded= it reproducer link_map->l_name for main executable is an empty string and therefore does = not match the name returned by dlinfo(3) for the same object. Additionally la_objopen() in an auditor is passed the same empty string. This really sho= uld be populated with the name of the file being opened as it is in all other cases.=20 A second very closely related problem is in non-PIE executables the base address found in the link_map is NULL while dlinfo(3) returns the correct value. This should be set to be where the object is loaded. Attached is a small reproducer simply: tar xvzf inconsistent-objopen.tar.gz cd inconsistent-objopen make The output will look something like: ben@pun:~/Shared/Work/test/auditor-tests/tier2/inconsistent-objopen$ make Success requires OK (not FAIL) at the end of output: LD_AUDIT=3D./libauditor-vdso.so ./main-simple la_objopen('') la_objopen('/lib64/ld-linux-x86-64.so.2') la_objopen('linux-vdso.so.1') Seen vDSO from objopen! la_objopen('/lib64/libc.so.6') la_preinit, scanning main link_map... l_name =3D '' l_name =3D 'linux-vdso.so.1' Seen vDSO in link map! l_name =3D '/lib64/libc.so.6' l_name =3D '/lib64/ld-linux-x86-64.so.2' dladdr(vDSO) pathname matches link_map entry. OK. dladdr(vDSO) base address matches link_map entry. OK. vDSO notified via objopen. OK. Success requires OK (not FAIL) at the end of output: ./main-dlinfo-pie Name recorded in Dl_info: './main-dlinfo-pie' at base 0x556ac1fbd000 Name recorded in link_map: '' at base 0x556ac1fbd000 Pathnames do not match. FAIL. Base addresses match. OK. ./main-dlinfo-nopie Name recorded in Dl_info: './main-dlinfo-nopie' at base 0x400000 Name recorded in link_map: '' at base (nil) Pathnames do not match. FAIL. Base addresses do not match. FAIL. The first problem is when the la_objopen() auditor function is called it is passed an empty string for the object's name. This really should be populat= ed with the name of the file being opened as it is in almost all other cases. = This empty name is then what is stored in the link_map->l_name entry. Subsequen= tly, when dlinfo(3) is called then it surprisingly is able to identify the objec= t's name.=20 Then the base addresses do not match. --=20 You are receiving this mail because: You are on the CC list for the bug.=