1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 20:45:06 +00:00
serenity/Libraries/LibC/sys
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
..
arch/i386 Everywhere: Re-format with clang-format-11 2020-12-31 21:51:00 +01:00
cdefs.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
file.h Meta: Add a script check the presence of "#pragma once" in header files 2020-05-29 07:59:45 +02:00
internals.h Build + LibC: Enable -fstack-protector-strong in user space 2021-01-02 11:34:55 +01:00
ioctl.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
ioctl_numbers.h LibC: Implement tcflush(3) 2020-07-11 11:33:33 +02:00
mman.h Meta: Add a script check the presence of "#pragma once" in header files 2020-05-29 07:59:45 +02:00
param.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
prctl.cpp Kernel+LibC: Introduce a "dumpable" flag for processes 2020-12-25 19:35:55 +01:00
prctl.h Kernel+LibC: Introduce a "dumpable" flag for processes 2020-12-25 19:35:55 +01:00
prctl_numbers.h Kernel+LibC: Introduce a "dumpable" flag for processes 2020-12-25 19:35:55 +01:00
ptrace.cpp Everywhere: Fix typos 2020-10-02 16:03:17 +02:00
ptrace.h Kernel: More PID/TID typing 2020-08-10 11:51:45 +02:00
resource.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
select.cpp Kernel: Move headers intended for userspace use into Kernel/API/ 2020-07-04 17:22:23 +02:00
select.h LibC: Implement pselect 2020-06-22 16:00:20 +02:00
socket.cpp Kernel+LibC: Use uintptr_t as the main type in the syscall interface 2020-10-12 19:53:25 +02:00
socket.h LibC: Add flag SO_BROADCAST so we can at least build programs that use it 2020-12-02 10:45:38 +01:00
stat.h LibC: Move stat(), lstat() and fstat() to <sys/stat.h> 2020-08-11 20:29:14 +02:00
sysmacros.h Meta: Add a script check the presence of "#pragma once" in header files 2020-05-29 07:59:45 +02:00
time.h Kernel+LibC: Add adjtime(2) 2020-11-10 19:03:08 +01:00
times.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
types.h LibPthread: Implement pthread_once() 2020-11-24 21:36:28 +01:00
uio.cpp Kernel: Move headers intended for userspace use into Kernel/API/ 2020-07-04 17:22:23 +02:00
uio.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
un.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
utsname.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
wait.cpp Kernel: Move block condition evaluation out of the Scheduler 2020-11-30 13:17:02 +01:00
wait.h Kernel: Move block condition evaluation out of the Scheduler 2020-11-30 13:17:02 +01:00