static void __init_AT_SECURE(KernelArgumentBlock& args) { // Check auxv for AT_SECURE first to see if program is setuid, setgid, // has file caps, or caused a SELinux/AppArmor domain transition. bool kernel_supplied_AT_SECURE; _AT_SECURE_value = args.getauxval(AT_SECURE, &kernel_supplied_AT_SECURE); // We don't support ancient kernels. if (!kernel_supplied_AT_SECURE) { const char* msg = "FATAL: kernel did not supply AT_SECURE\n"; write(2, msg, strlen(msg)); exit(EXIT_FAILURE); } }
void __libc_init_global_stack_chk_guard(KernelArgumentBlock& args) { // AT_RANDOM is a pointer to 16 bytes of randomness on the stack. // Take the first 4/8 for the -fstack-protector implementation. __stack_chk_guard = *reinterpret_cast<uintptr_t*>(args.getauxval(AT_RANDOM)); }