mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: Dynamic linker refactoring
Date: Sat, 21 Jan 2012 23:30:47 -0500	[thread overview]
Message-ID: <20120122043047.GN132@brightrain.aerifal.cx> (raw)
In-Reply-To: <b4f75a9df9e517a22a5187ec3521de99@exys.org>

On Sat, Jan 21, 2012 at 01:19:40PM +0100, aep wrote:
> On Fri, 20 Jan 2012 20:05:54 -0500, Rich Felker wrote:
> >Hi all,
> >
> > I'm leaning towards stripping out the vdso
> >(linux-gate) support at the dynamic linker level entirely, and
> >instead
> >using Nik's original design for vdso-assisted clock_gettime which can
> >work with static linking too.
> 
> isn't the vdso there for much more then just clock_gettime? Ie for a
> whole bunch of syscalls that otherwise need to go through the slow
> interrupt path?

I wouldn't say a whole bunch. At present there are only one or two
other functions provided by vdso and their applicability is so limited
I can't see them benefitting anything. Certainly there is a fair bit
more that could be implemented by the kernel in userspace in the
future, though.

What I originally thought was useful, but now I'm rethinking, is the
practice of actually including the vdso as a dso in the main chain of
loaded dsos, where its symbols become globally visible (including
accessible by the application using dlsym, for example). In principle,
it could replace symbols from the libc with its own versions. The fact
that I ordered it after libc rather than before partly ameliorates
this problem, but if the symbol in libc is weak, it can still be
overridden by a strong symbol in the vdso. (In fact this is how
__vdso_clock_gettime currently works!) If used correctly, it's no big
deal, but it would be quite unfortunate if the kernel developers went
and added some override that was intended to work with glibc but broke
horribly with musl..

Anyway with that in mind, I'd thought about at least 2 possible
alternatives:

1. Load the vdso through the dynamic linker code, but don't insert it
in the dso list, and instead search out the symbols we want from it
directly.

2. Include the vdso-linking code directly in the functions (like
clock_gettime) that might want vdso code.

Option 2 has the advantage of working even with static linking, but in
the immediate it would cause more code duplication. In the long term,
on the other hand, it might lead to better code factoring by allowing
us to move some of the hash, symbol table search, etc. code out of
dynlink.c and into a module that could be reused both for the vdso
search in static binaries and by the dynamic linker.

Rich


  reply	other threads:[~2012-01-22  4:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-21  1:05 Rich Felker
2012-01-21 12:19 ` aep
2012-01-22  4:30   ` Rich Felker [this message]
2012-01-22 12:45     ` aep

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=20120122043047.GN132@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).