public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: stsp <stsp2@yandex.ru>
To: Florian Weimer <fweimer@redhat.com>,
	Stas Sergeev via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH 2/2] dlfcn,elf: implement dlmem() function [BZ #11767]
Date: Mon, 13 Feb 2023 21:36:34 +0500	[thread overview]
Message-ID: <5635996a-a645-952f-9152-9a5ec1b940d3@yandex.ru> (raw)
In-Reply-To: <87y1p1d6go.fsf@oldenburg.str.redhat.com>


13.02.2023 18:45, Florian Weimer пишет:
> * Stas Sergeev via Libc-alpha:
>
> On the Google branches, there is somewhat similar functionality, in the
> form of dlopen_with_offset.

I've seen its mentioning here:
https://sourceware.org/bugzilla/show_bug.cgi?id=11767
But the attachment that is supposed to
be that patch, is
"attachment-3251-0.html (112 bytes, text/html)",
and if you click on it, you'll see something
completely silly.
So I thought that patch is a vaporware.

And in any case, I don't have an fd at all.
Maybe if they implemented dlopen_fstream(),
then I could use it with fopencookie.
But overall I need dlmem() w/o any fd.


>    Their approach avoids some ambiguity
> inherent to to the dlmem interface, mostly around whose responsibility
> is it to set up the page protections.

You probably mean the ambiguity of _their_
dlmem() interface. They discussed it entirely
differently: they wanted dlmem() to work on
a user's buffer.
My approach is very simple: dlmem() does
any mapping and protection, and memcpy()
from the original buffer. Then user does
munmap() of his buf.

dlmem() to user's buffer will be added later.
I am going to add it via an LD_AUDIT extension
that tells you the size and gets back the
address where you want it to mmap the solib.
So while I want to cover all their ideas, the
implementation is very simple and no
ambiguity should arise from it.


> Your patch seems to allow the creation of fully unnamed link maps
> (especially if the shared object being loaded does not come with
> DT_SONAME).  I think we need to discuss the consequences of that.  This
> feature could be independently useful to some applications, to the
> extent that they would use dlmem just for that purposes (even for files
> that are stored on disk).

Yes, I actually thought of a possibility to
set a name... Although this can be done
later, by someone who needs it.
Probably that will require dlmem2() with
one more argument.

> The test case could be extended to cover some failure cases, like a
> purposefully misaligned buffer containing a valid ELF object.

For my impl its not a failure case, simply
because of memcpy().


>    Or the
> interaction with auditing.
I was planning that for the next patch-set
where I will be covering the user's address.
But I'll see what can be added to current one.

  reply	other threads:[~2023-02-13 16:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 13:23 [PATCH v3 0/2] implement dlmem() function Stas Sergeev
2023-02-13 13:23 ` [PATCH 1/2] elf: strdup() l_name if no realname [BZ #30100] Stas Sergeev
2023-02-13 13:23 ` [PATCH 2/2] dlfcn,elf: implement dlmem() function [BZ #11767] Stas Sergeev
2023-02-13 13:45   ` Florian Weimer
2023-02-13 16:36     ` stsp [this message]
2023-02-14  8:43     ` stsp
2023-03-18 17:28     ` stsp
  -- strict thread matches above, loose matches on Subject: below --
2023-02-15 11:21 [PATCH v5 0/2] implement dlmem() with audit extension Stas Sergeev
2023-02-15 11:21 ` [PATCH 2/2] dlfcn,elf: implement dlmem() function [BZ #11767] Stas Sergeev
2023-02-14  8:41 [PATCH v4 0/2] implement dlmem() function Stas Sergeev
2023-02-14  8:41 ` [PATCH 2/2] dlfcn,elf: implement dlmem() function [BZ #11767] Stas Sergeev
2023-02-14  9:51   ` Florian Weimer
2023-02-14 13:13     ` stsp
2023-02-15 11:30     ` stsp
2023-03-18 16:58     ` stsp
2023-02-10 14:07 [PATCH 1/2] elf: strdup() l_name if no realname [BZ #30100] Stas Sergeev
2023-02-10 14:07 ` [PATCH 2/2] dlfcn,elf: implement dlmem() function [BZ #11767] Stas Sergeev
2023-02-10 21:51   ` Joseph Myers
2023-02-11 20:10     ` stsp
2023-02-13 21:46       ` Joseph Myers
2023-02-14  8:42         ` stsp

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=5635996a-a645-952f-9152-9a5ec1b940d3@yandex.ru \
    --to=stsp2@yandex.ru \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@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: link
Be 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).