From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D091D3858D33; Mon, 16 Jan 2023 14:13:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D091D3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673878417; bh=NR6ww2LhLlKNoRtoenbvb8VjJ7rEYFvvApXeZjrFa+s=; h=From:To:Subject:Date:From; b=tptyS6uP+fxVhUxUYGtbBe6hZOOF4Ow+Y6wUdkOnMRIlMwIg4Z9/rhvmMnq2Kguuc mb9Ah8ezPvWRJqAzlmD14RqJf37Icn/9T18HQBRFpEAhnm7Ieer2E2508U7R0Um1TW W8xIh9YSpKmSMx+Exxh6s/J68gyh5bvykYQFZO58= From: "stsp at users dot sourceforge.net" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/30007] New: rfe: dlopen to user buffer or to specified address Date: Mon, 16 Jan 2023 14:13:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement 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: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone 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=3D30007 Bug ID: 30007 Summary: rfe: dlopen to user buffer or to specified address Product: glibc Version: unspecified Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: dynamic-link Assignee: unassigned at sourceware dot org Reporter: stsp at users dot sourceforge.net Target Milestone: --- I've come to a need of dlopen the solib into the previously mmapped buffer. Currently the load address is chosen in _dl_map_segments(). The elf preferred address is taken, which is usually 0 so any address is used. I can think of 2 possible solutions. One would be to add a new func for DL_AUDIT which passes the needed length to the user and expects an address of a buffer as a return. This will allow the user to mmap the MAP_SHARED buffer if he wants, but the down-side is that ld.so will then need to use read() instead of mmap() to not trash the user's shared mapping. This will likely also need some efforts to implement. Another solution is trivial: just add a new fn dlopen3(file, flags, addr) that provides the base address for dlopen. This will not allow to use the pre-allocated buffer (user doesn't know the needed buffer size at that point) but its trivial to code up and will likely also solve my problem. It was also already requested here by someone else: https://stackoverflow.com/questions/62064806/is-there-a-way-to-specify-the-= base-address-of-a-shared-library-using-dlopen What do people think about such an extension? --=20 You are receiving this mail because: You are on the CC list for the bug.=