From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6F40A3858C78; Fri, 17 Feb 2023 09:32:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F40A3858C78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676626329; bh=sn3VlTDDC5Pudx3HwCHdi1KTiWcxFYMjvSplctwr1yk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Mjep0jc16HaavcIOl3jeSY3jY3FQcqDLuP0bXqFwO+LAVCefs9Jmw2hslWiJFyfDf y3hEHxYZpDdNIlNMDKXdieDWDUq4+wi2eHW2Cb94S1pK/G1xK2nO7efmwd4GIlWYLe I/ddQaagIkPiP78WVuaSSljDkN0El5i4v13zI9Mk= From: "stsp at users dot sourceforge.net" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/30127] [rfe]: enable ld audit at run-time Date: Fri, 17 Feb 2023 09:32:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Version: 2.38 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: stsp at users dot sourceforge.net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: security- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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=3D30127 --- Comment #7 from Stas Sergeev --- (In reply to Florian Weimer from comment #6) > There is a problem with copy relocations against _r_debug. If you try to > access _r_debug programmatically, try to build with -fPIC. Oh wow, I was using -fpie, but indeed adding also -fpic to executable fixes _r_debug! Very confusing... Still no luck though. To get the handle, I convert the struct link_map ptr to=20 struct link_map_extended { /* These first few members are part of the protocol with the debugger. This is the same format used in SVR4. */ ElfW(Addr) l_addr; /* Difference between the address in the ELF file and the addresses in memory. */ char *l_name; /* Absolute file name object was found in. = */ ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */ struct link_map *l_next, *l_prev; /* Chain of loaded objects. */ /* All following members are internal to the dynamic linker. They may change without notice. */ /* This is an element which is only ever different from a pointer to the very same copy of this type for ld.so when it is used in more than one namespace. */ struct link_map *l_real; /* Number of the namespace this link map belongs to. */ Lmid_t l_ns; }; I can see that the ns member seems correct: it is 0 for first namespace and 1 for audit namespace. But this fails: void *h =3D dlmopen(((struct link_map_extended *)l1)->l_ns, l1->l_name, RTL= D_LAZY | RTLD_LOCAL | RTLD_NOLOAD); ... with this dlerror(): ./tst-auditmod18.so: invalid target namespace in dlmopen(): Invalid argument So I still can't get a handle. :( Plus I use undocumented struct link_map_extended, which I probably shouldn't do. So what is to try? --=20 You are receiving this mail because: You are on the CC list for the bug.=