Re: -fstack-protect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/14/15 08:25, Mike Harrold wrote:
Hello,

Is there a way to disable this for a specific function?  Something
like __attribute__((unprotected)) maybe?

I have a function that appends two string literals* (of known size to
the compiler) into a char array that is 43 bytes larger than the two
literals, but gcc is still emitting the stack guard instructions.

Since I know the stack cannot be smashed (and gcc is apparently unable
to determine that for itself), I'd like to turn it off for that
function.  It's a a heavily used function that is inlined, so it's
causing increased code size and slower performance for no reason.
I'm not aware of a way to do this. I'm in the process of reviewing and updating a patch which allows for explicit requests for protection, but no explicit requests to prevent protection.

If you could pull that function into its own compilation unit you could disable stack protection when compiling that one file.

I'm curious about the compiler not being able to eliminate the protection in cases where it ought to be able to determine no smashing is possible. If you could file a bug report for that, it would be appreciated.

jeff




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux