This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: RFC: GCC plugin to find encrypted function pointer calls in glibc
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: libc-alpha at sourceware dot org, Florian Weimer <fweimer at redhat dot com>
- Date: Tue, 3 May 2016 03:02:17 -0400
- Subject: Re: RFC: GCC plugin to find encrypted function pointer calls in glibc
- Authentication-results: sourceware.org; auth=none
- References: <57233606 dot 7050205 at redhat dot com> <20160502223624 dot 3FE132C3A94 at topped-with-meat dot com>
On 05/02/2016 06:36 PM, Roland McGrath wrote:
The only reason we have asm in those macros is because it's optimal.
The best thing would be if we could express the bit swizzling in C in
a fashion that (new enough) GCC could be relied upon to implement with
the same optimal instruction sequence.
If y'all can do it with C, be it with builtins or whatever, if there's a
common pattern, I can probably get the plugin to notice it. Right now,
the only thing it notices is the result of an xor, bitwise or, or
bitwise and (plus the proposed attribute).
Using an inline with __attribute__ ((always_inline, aldys_new_magic))
should be acceptable in libc-internal sources. But it would be better
if you have us ways to do it with less magic rather than more.
How can I say no to "aldys_new_magic attribute"? I love it! :).
If anyone has any other suggestions, I'm all ears. As I mentioned
before, the only thing else I can think of is:
asm("your stuff #some_magic_attribute#")
Assuming there's a common way to make comments across the assemblers you
support.
Aldy