[PATCH v3] getrandom system call wrapper [BZ #17252]

Florian Weimer fweimer@redhat.com
Mon Sep 12 13:48:00 GMT 2016


On 09/08/2016 08:35 PM, Richard Henderson wrote:
> On 09/08/2016 11:32 AM, Florian Weimer wrote:
>>> 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.
>
> Indeed, that's what I was assuming.  I hadn't read the previous patches where
> this header didn't exist.

Okay.  I think this approach will work.  __REDIRECT will provide the asm 
alias when a GNU-style compiler is used.  Otherwise, we use a function 
macro.

Thanks,
Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getrandom-wrapper-only.patch
Type: text/x-patch
Size: 30438 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160912/71d8ef6f/attachment.bin>


More information about the Libc-alpha mailing list