public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: stsp <stsp2@yandex.ru>
To: Carlos O'Donell <carlos@redhat.com>,
	libc-alpha@sourceware.org,
	Paul Pluzhnikov <ppluzhnikov@google.com>
Subject: Re: [PATCH 2/3] dlfcn,elf: implement dlmem() and audit [BZ #11767]
Date: Sat, 18 Mar 2023 22:04:10 +0500	[thread overview]
Message-ID: <8ae11de1-1b64-99af-2f9f-ca8272a653c2@yandex.ru> (raw)
In-Reply-To: <e89233f4-f5a0-a31b-3bda-0b076c8eb8e7@redhat.com>

Hi Carlos,

20.02.2023 20:50, Carlos O'Donell пишет:
> * No new LD_AUDIT interfaces reuqired so auditors and developer tooling does
>    not need to be updated.

I dropped LD_AUDIT stuff just as you say.


> My suggestion therefore is to attempt to refactor what you have around an API
> that is like fdlopen(), and see what the implementation and performance looks
> like in glibc.
>
> Thoughts?
Done in a just posted v9.
It has fdlopen() in tst-dlmem-fdlopen.
Its source are also listed below.
I think that impl should go to libbsd,
not into glibc though.
What do you think?

Source:

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

   len = lseek (fd, 0, SEEK_END);
   lseek (fd, 0, SEEK_SET);
   addr = mmap (NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
   if (addr == MAP_FAILED)
     {
       printf ("cannot mmap, %s\n", strerror(errno));
       exit (EXIT_FAILURE);
     }
   handle = dlmem (addr, len, flags, NULL);
   munmap (addr, len);
   return handle;
}


  parent reply	other threads:[~2023-03-18 17:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 16:55 [PATCH v7 0/3] implement dlmem() with audit extensions Stas Sergeev
2023-02-15 16:55 ` [PATCH 1/3] elf: strdup() l_name if no realname [BZ #30100] Stas Sergeev
2023-02-15 16:55 ` [PATCH 2/3] dlfcn,elf: implement dlmem() and audit [BZ #11767] Stas Sergeev
2023-02-20 15:50   ` Carlos O'Donell
2023-02-20 16:35     ` stsp
2023-03-18 17:04     ` stsp [this message]
2023-02-15 16:55 ` [PATCH 3/3] elf/dl-audit: add _dl_audit_premap fn [BZ #30007] Stas Sergeev

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=8ae11de1-1b64-99af-2f9f-ca8272a653c2@yandex.ru \
    --to=stsp2@yandex.ru \
    --cc=carlos@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=ppluzhnikov@google.com \
    /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).