public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "stsp at users dot sourceforge.net" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/30007] rfe: dlopen to user buffer or to specified address Date: Thu, 19 Jan 2023 13:46:43 +0000 [thread overview] Message-ID: <bug-30007-131-yu587D4hqg@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-30007-131@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=30007 --- Comment #4 from Stas Sergeev <stsp at users dot sourceforge.net> --- (In reply to Adhemerval Zanella from comment #3) > This seems a very specific usercase that I am not sure if it fits on usual > case of dlopen usage. Mapping to a preferred address basically defeats ASRL > and has other issues: what this dlopen extension should do if the required > mapping is not large enough, if the address is already occupied, or if the > mapping does not have the correct permissions? My current plan (which may of course change) is to have the LD_AUDIT func that will tell the length and get the address back. The user have to make sure there is no any mapping at that address for a specified length (I am looking in /proc/self/maps to find the needed hole). If eventually it appears the hole is not large enough, dlopen() should just fail. That basically addresses the aforementioned concern of yours. After dlopen() succeeded, knowing the length I will mmap(MAP_SHARED) another buffer, memcpy() the solib there and mmap() it back to its addr, but in a shared buffer. So basically all the dirty work is on my side, dlopen() should only tell me the length and get the address back. > In the case of passing mapping not sufficing Passing mapping was just an option to consider. I already realized it would be a bad extension, so currently my plan is to pass only address in response to the length, and then, knowing length, create that "other mapping" by hands, then memcpy(), then remap back. More work for me, but much smaller extension to glibc. > We used to have hacks to force mmap to load executables to 32-bits, it was > added to overcome some particular architecture limitations, and it has > caused some issues and it was eventually removed (check > ea5814467a02c9d2d7608b6445c5d60e2a81d3ee). Wow, just recently removed! Quite sad I haven't had a chance to try it out... But I think we can come up with something much more flexible. Which is why I created that ticket before actually prototyping the thing myself. Eg LD_PREFER_MAP_32BIT_EXEC wouldn't give me the length, so I'd have difficulties wrapping that into a shared mapping. I really aim for something very small and simple on a glibc side, with more work on a user's side. But if glibc isn't helpful, I'll need to implement/use alternative dynamic linker, which would be quite bad. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2023-01-19 13:46 UTC|newest] Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-16 14:13 [Bug dynamic-link/30007] New: " stsp at users dot sourceforge.net 2023-01-17 14:17 ` [Bug dynamic-link/30007] " adhemerval.zanella at linaro dot org 2023-01-17 14:35 ` stsp at users dot sourceforge.net 2023-01-19 13:23 ` adhemerval.zanella at linaro dot org 2023-01-19 13:46 ` stsp at users dot sourceforge.net [this message] 2023-01-20 6:55 ` [Bug dynamic-link/30007] rfe: dlopen " stsp at users dot sourceforge.net 2023-02-15 16:58 ` stsp at users dot sourceforge.net 2023-03-14 3:20 ` stsp at users dot sourceforge.net 2023-03-14 13:21 ` adhemerval.zanella at linaro dot org 2023-03-15 5:34 ` janderson at rice dot edu 2023-03-15 6:33 ` stsp at users dot sourceforge.net 2023-03-15 10:03 ` stsp at users dot sourceforge.net 2023-03-15 11:05 ` stsp at users dot sourceforge.net 2023-03-15 11:41 ` stsp at users dot sourceforge.net 2023-03-15 12:07 ` stsp at users dot sourceforge.net 2023-03-17 6:44 ` stsp at users dot sourceforge.net 2023-03-18 23:28 ` janderson at rice dot edu 2023-03-19 2:12 ` stsp at users dot sourceforge.net 2023-03-19 2:37 ` stsp at users dot sourceforge.net 2023-03-19 9:47 ` stsp at users dot sourceforge.net 2023-03-19 10:14 ` stsp at users dot sourceforge.net 2023-03-19 13:56 ` stsp at users dot sourceforge.net 2023-03-23 10:34 ` stsp at users dot sourceforge.net 2023-03-27 7:12 ` stsp at users dot sourceforge.net 2023-03-27 17:16 ` janderson at rice dot edu 2023-03-28 1:29 ` stsp at users dot sourceforge.net 2023-03-28 5:02 ` stsp at users dot sourceforge.net 2023-03-28 5:37 ` stsp at users dot sourceforge.net 2023-03-28 6:17 ` janderson at rice dot edu 2023-03-28 9:14 ` stsp at users dot sourceforge.net 2023-03-29 15:26 ` stsp at users dot sourceforge.net 2023-03-31 15:43 ` stsp at users dot sourceforge.net 2023-03-31 15:53 ` stsp at users dot sourceforge.net 2023-03-31 16:08 ` stsp at users dot sourceforge.net 2023-04-03 9:28 ` stsp at users dot sourceforge.net 2023-04-03 9:28 ` stsp at users dot sourceforge.net 2023-04-14 19:09 ` stsp at users dot sourceforge.net 2023-04-14 19:11 ` adhemerval.zanella at linaro dot org 2023-04-14 19:12 ` stsp at users dot sourceforge.net 2023-05-08 14:51 ` stsp at users dot sourceforge.net
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=bug-30007-131-yu587D4hqg@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /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: linkBe 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).