From a1e20aa04f3624204f0eff5225ad65869046fced Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 29 Jan 2021 20:28:19 +0200 Subject: [PATCH] Kernel: Fix enum of sysconf values to be in the correct order This prevented from dmidecode to get the right PAGE_SIZE when using the sysconf syscall. I found this bug, when I tried to figure why dmidecode fails to mmap /dev/mem when I passed --no-procfs, and the conclusion is that it tried to mmap unaligned physical address 0xf5ae0 (SMBIOS data), and that was caused by a wrong value returned after using the sysconf syscall to get the plaform page size, therefore, allowing to send an unaligned address to the mmap syscall. --- Kernel/UnixTypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/UnixTypes.h b/Kernel/UnixTypes.h index 271d4a45f02..294b786772a 100644 --- a/Kernel/UnixTypes.h +++ b/Kernel/UnixTypes.h @@ -60,8 +60,8 @@ enum { _SC_NPROCESSORS_CONF, _SC_NPROCESSORS_ONLN, _SC_OPEN_MAX, - _SC_PAGESIZE, _SC_TTY_NAME_MAX, + _SC_PAGESIZE, }; #define PERF_EVENT_SAMPLE 0