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/30100] [patch] add dlmem()
Date: Sat, 18 Mar 2023 18:14:12 +0000	[thread overview]
Message-ID: <bug-30100-131-ddmP1XgSpb@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30100-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30100

--- Comment #32 from Stas Sergeev <stsp at users dot sourceforge.net> ---
https://sourceware.org/pipermail/libc-alpha/2023-March/146434.html
Posted a v9 with lots of new features.
Also its better structured for a review.
Namely the shm-dealing stuff is in the
patch 13, outside of the main dlmem()
impl. As this shm-dealing seems to be
the last part still not well understood,
I put it separately, with a separate
test-case. Which, as before, maps the
lib twice.

Also patch 12 has an fdlopen() impl as
a test-case:

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;
}


Neither fdlopen() nor solib duplication can
be done with intercepting the first mmap.
Also I wonder if fdlopen() can ever be
implemented simpler than that. :) The test-case
for fdlopen() makes sure that /proc/self/maps
have the right references to the loaded solib,
rather than some anonymously mapped areas, which
would be a cheating.
So in fact dlmem() have suddenly grown into
an universal tool that exposes all the former
and new libdl features via the single small
call. It can handle file-based solibs not
any worse than the memory-based ones (you
can even specify the solib name now).
So basically, a huge libdl superset by the
price of just 1 call!

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09  9:47 [Bug dynamic-link/30100] New: " stsp at users dot sourceforge.net
2023-02-09  9:48 ` [Bug dynamic-link/30100] " stsp at users dot sourceforge.net
2023-02-09 11:51 ` adhemerval.zanella at linaro dot org
2023-02-09 12:17 ` stsp at users dot sourceforge.net
2023-02-09 12:48 ` adhemerval.zanella at linaro dot org
2023-02-09 13:59 ` stsp at users dot sourceforge.net
2023-02-09 14:16 ` adhemerval.zanella at linaro dot org
2023-02-09 14:34 ` stsp at users dot sourceforge.net
2023-02-09 15:14 ` stsp at users dot sourceforge.net
2023-02-09 16:51 ` stsp at users dot sourceforge.net
2023-02-09 16:55 ` adhemerval.zanella at linaro dot org
2023-02-09 16:56 ` adhemerval.zanella at linaro dot org
2023-02-09 17:37 ` stsp at users dot sourceforge.net
2023-02-09 17:58 ` stsp at users dot sourceforge.net
2023-02-09 18:22 ` schwab@linux-m68k.org
2023-02-09 18:29 ` stsp at users dot sourceforge.net
2023-02-09 18:49 ` stsp at users dot sourceforge.net
2023-02-09 18:56 ` stsp at users dot sourceforge.net
2023-02-09 19:00 ` stsp at users dot sourceforge.net
2023-02-09 19:02 ` adhemerval.zanella at linaro dot org
2023-02-10  8:27 ` stsp at users dot sourceforge.net
2023-02-10  8:30 ` stsp at users dot sourceforge.net
2023-02-10  8:30 ` stsp at users dot sourceforge.net
2023-02-10  9:08 ` stsp at users dot sourceforge.net
2023-02-10 10:04 ` stsp at users dot sourceforge.net
2023-02-10 13:09 ` stsp at users dot sourceforge.net
2023-02-10 13:46 ` adhemerval.zanella at linaro dot org
2023-02-11 17:37 ` stsp at users dot sourceforge.net
2023-02-11 19:08 ` stsp at users dot sourceforge.net
2023-02-11 19:37 ` stsp at users dot sourceforge.net
2023-02-16 13:40 ` stsp at users dot sourceforge.net
2023-03-17  6:41 ` stsp at users dot sourceforge.net
2023-03-17  6:45 ` stsp at users dot sourceforge.net
2023-03-18 18:14 ` stsp at users dot sourceforge.net [this message]
2023-03-18 23:30 ` janderson at rice dot edu
2023-03-19  2:14 ` stsp at users dot sourceforge.net
2023-03-20 15:47 ` stsp at users dot sourceforge.net
2023-03-20 16:06 ` stsp at users dot sourceforge.net
2023-03-29 14:45 ` sam at gentoo dot org
2023-05-05 14:29 ` 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-30100-131-ddmP1XgSpb@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: 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).