Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add binary hardening compile and link flags (XRPLF#4603)
Enhance security during the build process: * The '-fstack-protector' flag enables stack protection for preventing buffer overflow vulnerabilities. If an attempt is made to overflow the buffer, the program will terminate, thus protecting the integrity of the stack. * The '-Wl,-z,relro,-z,now' linker flag enables Read-only Relocations (RELRO), a feature that helps harden the binary against certain types of exploits, particularly those that involve overwriting the Global Offset Table (GOT). * This flag is only set for Linux builds, due to compatibility issues with apple-clang. * The `relro` option makes certain sections of memory read-only after initialization to prevent them from being overwritten, while `now` ensures that all dynamic symbols are resolved immediately on program start, reducing the window of opportunity for attacks.
- Loading branch information