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: Sat, 18 Mar 2023 22:28:08 +0500	[thread overview]
Message-ID: <e3eae9a9-1a25-d483-01f3-360ba7068218@yandex.ru> (raw)
In-Reply-To: <87y1p1d6go.fsf@oldenburg.str.redhat.com>


13.02.2023 18:45, Florian Weimer пишет:
> On the Google branches, there is somewhat similar functionality, in the
> form of dlopen_with_offset.

I'll list dlopen_with_offset() below.


> 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).

Probably, but in v9 I added a possibility
to specify an object name for dlmem().
It also has an fdlopen() impl as a test-case.

So dlopen_with_offset():

static void *
dlopen_with_offset (int fd, int flags, off_t offset)
{
   off_t len;
   void *addr;
   void *handle;

   len = lseek (fd, 0, SEEK_END);
   lseek (fd, 0, SEEK_SET);
   if (len <= offset)
     return NULL;
   len -= offset;
   addr = mmap (NULL, len, PROT_READ, MAP_PRIVATE, fd, offset);
   if (addr == MAP_FAILED)
     return NULL;
   handle = dlmem (addr, len, flags, NULL);
   munmap (addr, len);
   return handle;
}

Should I add it to a test-case or fdlopen()
is enough?


  parent reply	other threads:[~2023-03-18 17:28 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
2023-02-14  8:43     ` stsp
2023-03-18 17:28     ` stsp [this message]
  -- 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=e3eae9a9-1a25-d483-01f3-360ba7068218@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).