mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Andy Lutomirski <luto@amacapital.net>, Andi Kleen <andi@firstfloor.org>
Cc: Rich Felker <dalias@libc.org>,
	Mikael Pettersson <mikpelinux@gmail.com>,
	Russ Cox <rsc@golang.org>, Linux API <linux-api@vger.kernel.org>,
	Ian Taylor <iant@golang.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	X86 ML <x86@kernel.org>
Subject: Re: [RFC 0/2] __vdso_findsym
Date: Sun, 15 Jun 2014 11:39:54 -0700	[thread overview]
Message-ID: <4ab91a07-c46c-485b-895d-b074d36624d6@email.android.com> (raw)
In-Reply-To: <CALCETrWLBCNiJArMRPuHbfhj6=ytnx_YqykzgCgZ+DYu34M1Mg@mail.gmail.com>

Symbol versioning so we can rev the ABI and still provide backwards compatibility.  Weak symbols so the libc can override symbols if it considers it appropriate.  This is a good thing.

On June 15, 2014 11:20:41 AM PDT, Andy Lutomirski <luto@amacapital.net> wrote:
>cc: Andi Kleen, who designed the vdso
>
>On Sun, Jun 15, 2014 at 10:57 AM, H. Peter Anvin <hpa@zytor.com> wrote:
>> On 06/15/2014 10:40 AM, Andy Lutomirski wrote:
>>>
>>> To be clear, I have no desire whatsoever to give the vdso an actual
>>> ELF parser or anything else that userspace should be providing
>itself.
>>> I think that a special-purpose vdso parser in the vdso makes some
>>> sense, though, since userspace might otherwise provide one for the
>>> sole purpose of parsing the vdso.
>>>
>>> And there's plenty of reasons that having the vdso be an ELF image
>is
>>> useful.  For one thing, gdb can take advantage of it.  For another,
>>> CRIU is parsing it for a rather different reason, and something like
>>> __vdso_findsym won't fill that need.
>>>
>>> Also, given the general lack of a comprehensible specification of
>what
>>> the GNU flavor of the ELF format actually is [1], there's something
>to
>>> be said for reducing the proliferation of ELF parsers.  glibc and
>>> binutils are quite unlikely to become incompatible with each other,
>>> but I sincerely doubt that anyone from binutils land is likely to
>>> review (and maintain!) my ELF parser, Go's, or a hypothetical future
>>> ELF parser from any of the other glibc-less things.  If those things
>>> use one that's in the kernel, then it's easy for the kernel to
>>> guarantee that each vdso image can successfully parse itself.
>>>
>>> [1] The only comprehensible description of the GNU hash extension
>that
>>> I could find is on Oracle's blog (!)
>>>
>>
>> Yes, but that is why we provide the standard SysV hash.  The GNU hash
>is
>> not too bad, but you're absolutely right the documentation stinks.
>>
>> Providing a simple symbol lookup is an opportunistic thing, and might
>be
>> useful that way, and only because (as you say) the version in the
>vdso
>> would only need to be guaranteed to parse a single data structure --
>> that same vdso.
>>
>> On the other hand, it better work, correctly, in every version of the
>> kernel, so I believe it will need to be done such that it is either
>> correct by construction or gets self-tested during the build process
>so
>> it errors out on failure.
>
>I was thinking of adding something to selftests that would check that
>__vdso_findsym can find every exported symbol, check that it can't
>find the ones it shouldn't find, and call it on a bunch of garbage
>strings to make sure it rejects them.
>
>
>> One simple way to do correct by construction
>> would be to do the "vdso entry point by index" -- a new kind of
>system
>> call numbers, in effect, as much as it has shades of Windows DLL with
>> their "ordinal numbers".
>
>It's certainly easy.  It's a little gross, and I sort of feel bad
>about having two parallel ways of referring to a vdso function -- one
>used by ELF parsers and one used by the new thing.  Using an array
>also wins on speed and code size.  *sigh* -- I'm torn on this one.
>
>Do you know why the vdso uses symbol versioning and weak symbols in
>the first place?  This seems to date back all the way to the beginning
>(2aae950b21e4bc789d1fc6668faf67e8748300b7).  If we're going to add a
>new way to find vdso symbols, I would like to at least drop support
>for versions.
>
>--Andy

-- 
Sent from my mobile phone.  Please pardon brevity and lack of formatting.

  reply	other threads:[~2014-06-15 18:40 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-14 18:16 Andy Lutomirski
2014-06-14 18:16 ` [RFC 1/2] uapi: Add some missing dynamic table-related definitions to elf.h Andy Lutomirski
2014-06-14 18:16 ` [RFC 2/2] [NOT READY] x86/vdso: Add __vdso_findsym Andy Lutomirski
2014-06-14 21:30 ` [RFC 0/2] __vdso_findsym Rich Felker
2014-06-14 22:38   ` Andy Lutomirski
2014-06-14 23:36     ` H. Peter Anvin
2014-06-15  3:59       ` H. Peter Anvin
2014-06-15  6:49         ` Andy Lutomirski
2014-06-15 14:25 ` Mikael Pettersson
2014-06-15 14:35   ` Rich Felker
2014-06-15 15:47     ` Andy Lutomirski
2014-06-15 17:05     ` H. Peter Anvin
2014-06-15 17:40       ` Andy Lutomirski
2014-06-15 17:57         ` H. Peter Anvin
2014-06-15 18:20           ` Andy Lutomirski
2014-06-15 18:39             ` H. Peter Anvin [this message]
2014-06-15 18:54               ` Andy Lutomirski
2014-06-15 19:14                 ` H. Peter Anvin
2014-06-15 19:22                   ` Ian Lance Taylor
2014-06-15 19:31                     ` H. Peter Anvin
2014-06-15 19:50                       ` Ian Lance Taylor
2014-06-15 19:56                         ` H. Peter Anvin
2014-06-15 20:53                           ` Andy Lutomirski
2014-06-15 21:13                             ` H. Peter Anvin
2014-06-16  0:55                   ` Rich Felker
2014-06-16  2:36             ` Andi Kleen
2014-06-16  3:49               ` Rich Felker
2014-06-16 14:08               ` Ian Lance Taylor
2014-06-16 14:38                 ` Andi Kleen
2014-06-16 14:58                   ` Rich Felker
2014-06-16 15:31                   ` Ian Lance Taylor
2014-06-16 15:42                     ` Rich Felker
2014-06-20 15:55                       ` Andy Lutomirski
2014-06-20 16:07                         ` Rich Felker
2014-06-16 14:56                 ` Rich Felker
2014-06-15 18:20         ` H. Peter Anvin
2014-06-15 18:22           ` Andy Lutomirski
2014-06-16  6:39             ` Rich Felker
2014-06-16  1:06       ` Rich Felker

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=4ab91a07-c46c-485b-895d-b074d36624d6@email.android.com \
    --to=hpa@zytor.com \
    --cc=andi@firstfloor.org \
    --cc=dalias@libc.org \
    --cc=iant@golang.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mikpelinux@gmail.com \
    --cc=rsc@golang.org \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®