diff --git a/etc/etc.amd64/boot.cfg b/etc/etc.amd64/boot.cfg index 720dc77..0c3500a 100644 --- a/etc/etc.amd64/boot.cfg +++ b/etc/etc.amd64/boot.cfg @@ -1,5 +1,6 @@ menu=Boot normally:rndseed /var/db/entropy-file;boot menu=Boot single user:rndseed /var/db/entropy-file;boot -s +menu=Disable ASLR:rndseed /var/db/entropy-file;boot -A menu=Disable ACPI:rndseed /var/db/entropy-file;boot -2 menu=Disable ACPI and SMP:rndseed /var/db/entropy-file;boot -12 menu=Drop to boot prompt:prompt diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index d64df70..bbc100d 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -227,6 +227,10 @@ extern void *_binary_splash_image_end; extern struct lwp lwp0; extern time_t rootfstime; +#ifdef PAX_ASLR +extern int pax_aslr_enabled; +#endif + #ifndef curlwp struct lwp *curlwp = &lwp0; #endif @@ -1024,6 +1028,12 @@ start_init(void *arg) } #endif + if (boothowto & RB_NO_ASLR) { +#ifdef PAX_ASLR + pax_aslr_enabled = 0; +#endif + } + /* * Move out the flags (arg 1), if necessary. */ diff --git a/sys/sys/boot_flag.h b/sys/sys/boot_flag.h index c84610a..64c08dc 100644 --- a/sys/sys/boot_flag.h +++ b/sys/sys/boot_flag.h @@ -52,6 +52,9 @@ case '4': /* machine dependent flag */ \ (retval) |= RB_MD4; \ break; \ + case 'A': /* No ASLR boot */ \ + (retval) |= RB_NO_ASLR; \ + break; \ case 'a': /* ask for file name to boot from */ \ (retval) |= RB_ASKNAME; \ break; \ diff --git a/sys/sys/reboot.h b/sys/sys/reboot.h index 93f7a27..2ee6c60 100644 --- a/sys/sys/reboot.h +++ b/sys/sys/reboot.h @@ -53,6 +53,7 @@ #define RB_STRING 0x00000400 /* use provided bootstr */ #define RB_POWERDOWN (RB_HALT|0x800) /* turn power off (or at least halt) */ #define RB_USERCONF 0x00001000 /* change configured devices */ +#define RB_NO_ASLR 0x00002000 /* turn off ASLR during boot */ /* * Extra autoboot flags (passed by boot prog to kernel). See also