Stack protector: Suggestions for documentation
Jonathan Wakely
jwakely.gcc@gmail.com
Mon Oct 23 09:52:00 GMT 2017
Hi,
On 23 October 2017 at 08:53, Martin Richtarsky wrote:
> Hi,
>
> I've written a small blog post about the stack protector:
>
> http://www.productive-cpp.com/hardening-cpp-programs-stack-protector/
>
> While playing around with the features, I noticed that they do not behave
> exactly as documented:
>
> https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
>
> "-fstack-protector"
>
> Emit extra code to check for buffer overflows, such as stack smashing
> attacks. This is done by adding a guard variable to functions with
> vulnerable objects. This includes functions that call alloca, and
> _functions with buffers larger than 8 bytes_. The guards are initialized
> when a function is entered and then checked when the function exits. If a
> guard check fails, an error message is printed and the program exits.
>
> "with buffers larger than 8 bytes" - here I found that a buffer of exactly
> 8 bytes is also instrumented.
>
> The documentation only talks about buffers. This might be mistaken for
> arrays in general. It might be clearer to state that only char arrays are
> instrumented (and not e.g. wchar!)
I don't know enough about stack protector to say but I assume your
findings are right, and so these seem like good suggestions to improve
the docs.
> I can also make the appropriate changes if you can point me to a page
> describing the process.
The process of contributing a patch is described at
https://gcc.gnu.org/contribute.html
I don't think the two tweaks you're proposing would be legally
significant, so would probably not require a copyright assignment
(although if you plan to contribute anything else to GCC in future I
would encourage you to complete the assignment process :-)
The sources for those docs are the file gcc/doc/invoke.texi so once
you have a patch you would send it to the gcc-patches mailing list for
review and to be committed to source control.
More information about the Gcc-help
mailing list