Last active
October 28, 2020 16:24
-
-
Save profi200/d26cac23fe7f1267ec6df930a78692ee to your computer and use it in GitHub Desktop.
devkitARM bare metal stack protector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "types.h" | |
#include "arm11/debug.h" | |
// Needs to be marked as used to work with LTO. | |
// The used attribute also overrides the newlib symbol. | |
// This is for debugging purposes only. For security this value needs to be random! | |
__attribute__((used)) uintptr_t __stack_chk_guard = 0x2D9B1A0E; | |
// Needs to be marked as noinline and used to work with LTO. | |
// The used attribute also overrides the newlib symbol. | |
__attribute__((noinline, used)) noreturn void __stack_chk_fail(void) | |
{ | |
panicMsg("Stack smash!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment