public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Richard Henderson <rth@twiddle.net>, Andreas Schwab <schwab@suse.de>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH v3] getrandom system call wrapper [BZ #17252]
Date: Thu, 08 Sep 2016 18:32:00 -0000	[thread overview]
Message-ID: <721afeb6-4217-d7a5-bd66-3b1e3a4b0a49@redhat.com> (raw)
In-Reply-To: <77056253-5741-5213-f103-a88d01790bd3@twiddle.net>

On 09/08/2016 08:28 PM, Richard Henderson wrote:
> On 09/08/2016 06:02 AM, Florian Weimer wrote:
>> On 09/08/2016 03:01 PM, Andreas Schwab wrote:
>>> On Sep 08 2016, Florian Weimer <fweimer@redhat.com> wrote:
>>>
>>>> I have retained the __getrandom symbol mangling.  The justification for
>>>> that is that getrandom is a fairly common name.  Application code might
>>>> use it for something else entirely and interpose their definition, so that
>>>> libraries cannot rely on it doing the right thing.  I think the mangling
>>>> is justified because it is hard to spot that getrandom is broken due to
>>>> interposition.  As <sys/random.h> is a new header, the macro will be
>>>> exposed to few applications.
>>>
>>> It makes it impossible to take the address of the function, though.
>>
>> It does.  Do you have a better suggestion to achieve the same effect?
>
> Using __asm__ to change the assembler name of the C-level symbol is probably
> preferred for __GCC__.

This does not work in all cases because a getrandom function definition 
will inherit the asm alias on the prototype and interpose the 
supposedly-protected symbol.

But now that we have a <sys/random.h> header, maybe this isn't a 
problem—if an application includes the <sys/random.h> header, it shows 
that it is aware of getrandom, so it's less likely that it's interposing 
the function accidentally.

Thanks,
Florian

  reply	other threads:[~2016-09-08 18:32 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08 11:44 Florian Weimer
2016-09-08 12:46 ` Florian Weimer
2016-09-09  1:54   ` Rical Jasan
2016-09-08 13:01 ` Andreas Schwab
2016-09-08 13:02   ` Florian Weimer
2016-09-08 13:19     ` Andreas Schwab
2016-09-08 13:26       ` Florian Weimer
2016-09-08 13:37         ` Andreas Schwab
2016-09-08 13:49           ` Florian Weimer
2016-09-08 13:54             ` Andreas Schwab
2016-09-08 14:02               ` Florian Weimer
2016-09-08 15:56                 ` Andreas Schwab
2016-09-08 14:19       ` Zack Weinberg
2016-09-08 14:31         ` Florian Weimer
2016-09-08 14:39           ` Zack Weinberg
2016-09-08 14:40             ` Florian Weimer
2016-09-08 15:10               ` Zack Weinberg
2016-09-08 18:28     ` Richard Henderson
2016-09-08 18:32       ` Florian Weimer [this message]
2016-09-08 18:35         ` Richard Henderson
2016-09-12 13:48           ` Florian Weimer
2016-10-07 23:00             ` Paul Eggert
2016-10-08 10:33               ` Florian Weimer
2016-10-08 10:49                 ` Andreas Schwab
2016-10-08 12:31                   ` Florian Weimer
2016-09-09 14:21 ` Torvald Riegel
2016-09-09 14:28   ` Florian Weimer
2016-09-09 14:41     ` Zack Weinberg
2016-09-09 15:14       ` Florian Weimer
2016-09-09 15:23     ` Torvald Riegel
2016-09-12  7:26       ` Florian Weimer
2016-09-12  9:40         ` Torvald Riegel
2016-09-12 11:52           ` Florian Weimer
2016-09-23  9:44         ` Torvald Riegel
2016-09-23 11:04           ` Florian Weimer
2016-10-12 15:58         ` Florian Weimer
2016-10-12 16:10           ` Zack Weinberg
2016-10-17 13:02             ` Florian Weimer
2016-10-17 13:07               ` Zack Weinberg
2016-10-17 12:54           ` Torvald Riegel
2016-10-17 13:01             ` Florian Weimer
2016-10-03 17:51   ` Carlos O'Donell
2016-10-04 12:02     ` Florian Weimer
2016-10-04 12:24       ` Adhemerval Zanella
2016-10-04 16:05     ` Torvald Riegel
2016-10-04 20:31       ` Zack Weinberg
2016-10-05  7:18         ` Florian Weimer
2016-10-05 12:42           ` Zack Weinberg

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=721afeb6-4217-d7a5-bd66-3b1e3a4b0a49@redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=rth@twiddle.net \
    --cc=schwab@suse.de \
    /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).