1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 11:25:09 +00:00
serenity/Userland/Tests/LibC
Brian Gianforcaro 06da50afc7 Build + LibC: Enable -fstack-protector-strong in user space
Modify the user mode runtime to insert stack canaries to find stack corruptions.

The `-fstack-protector-strong` variant was chosen because it catches more
issues than vanilla `-fstack-protector`, but doesn't have substantial
performance impact like `-fstack-protector-all`.

Details:

    -fstack-protector enables stack protection for vulnerable functions that contain:

    * A character array larger than 8 bytes.
    * An 8-bit integer array larger than 8 bytes.
    * A call to alloca() with either a variable size or a constant size bigger than 8 bytes.

    -fstack-protector-strong enables stack protection for vulnerable functions that contain:

    * An array of any size and type.
    * A call to alloca().
    * A local variable that has its address taken.

Example of it catching corrupting in the `stack-smash` test:
```
courage ~ $ ./user/Tests/LibC/stack-smash
[+] Starting the stack smash ...
Error: Stack protector failure, stack smashing detected!
Shell: Job 1 (/usr/Tests/LibC/stack-smash) Aborted
```
2021-01-02 11:34:55 +01:00
..
accuracy-strtod.cpp Everywhere: Re-format with clang-format-11 2020-12-31 21:51:00 +01:00
CMakeLists.txt Toolchain+LibC: Fix usage of crt files 2020-12-24 21:46:35 +01:00
exec-should-not-search-current-directory.cpp Tests: License headers, clang-format, clearer output 2020-08-02 17:15:36 +02:00
memmem-tests.cpp Tests: License headers, clang-format, clearer output 2020-08-02 17:15:36 +02:00
qsort-sorts-and-copies.cpp Test: Mark compilation-unit-only functions as static 2020-08-12 20:40:59 +02:00
snprintf-correctness.cpp LibC: Fix some incorrect printf usages 2020-12-26 10:05:50 +01:00
stack-smash.cpp Build + LibC: Enable -fstack-protector-strong in user space 2021-01-02 11:34:55 +01:00
strlcpy-correctness.cpp LibTLS+Userland: Remove all uses of ByteBuffer::slice_view() 2020-12-19 18:29:13 +01:00