We provide a simple Bash script at <book-source>/ch7/ASLR_check.sh. It checks for the presence of both (user-mode) ASLR as well as KASLR, printing (color-coded!) status information about them. It also allows you to change the ASLR value.
Let's give it a spin on our x86_64 Ubuntu 18.04 guest. As our script is programmed to be color-coded, we show a screenshot of its output here:
Figure 7.17 – Screenshot showing the output when our ch7/ASLR_check.sh Bash script runs on an x86_64 Ubuntu guest
It runs, showing you that (at least on this box) both the user mode as well as KASLR are indeed turned on. Not only that, we write a small "test" routine to see ASLR functioning. It's very simple: it runs the following command twice:
grep -E "heap|stack" /proc/self/maps
From what you learned in an earlier section, Interpreting the /proc/PID/maps output, you can now see in Figure 7.17, that the UVAs for...