Skip to content

Instantly share code, notes, and snippets.

@profi200
Last active October 28, 2020 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save profi200/d26cac23fe7f1267ec6df930a78692ee to your computer and use it in GitHub Desktop.
Save profi200/d26cac23fe7f1267ec6df930a78692ee to your computer and use it in GitHub Desktop.
devkitARM bare metal stack protector
#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