From d963aa3e914615631a8169f6d88d82167fe06a63 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Sat, 13 Oct 2018 11:21:35 -0700 Subject: Display status of ASLR in Computer->Operating System --- modules/computer.c | 6 +++++- modules/computer/os.c | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/computer.c b/modules/computer.c index 3984efc9..45c4502e 100644 --- a/modules/computer.c +++ b/modules/computer.c @@ -511,10 +511,14 @@ gchar *callback_os(void) info_field(_("Home Directory"), computer->os->homedir), info_field_last()); + info_add_group(info, _("Security"), + info_field_update(_("Available entropy in /dev/random"), 1000), + info_field(_("ASLR"), idle_free(computer_get_aslr())), + info_field_last()); + info_add_group(info, _("Misc"), info_field_update(_("Uptime"), 1000), info_field_update(_("Load Average"), 10000), - info_field_update(_("Available entropy in /dev/random"), 1000), info_field_last()); return info_flatten(info); diff --git a/modules/computer/os.c b/modules/computer/os.c index aec53df2..fc370ee8 100644 --- a/modules/computer/os.c +++ b/modules/computer/os.c @@ -234,6 +234,20 @@ detect_desktop_environment(void) return g_strdup(_("Unknown")); } +gchar * +computer_get_aslr(void) +{ + switch (h_sysfs_read_int("/proc/sys/kernel", "randomize_va_space")) { + case 0: + return g_strdup(_("Disabled")); + case 1: + return g_strdup(_("Partially enabled (mmap base+stack+VDSO base)")); + case 2: + return g_strdup(_("Fully enabled (mmap base+stack+VDSO base+heap)")); + default: + return g_strdup(_("Unknown")); + } +} gchar * computer_get_entropy_avail(void) { -- cgit v1.2.3