aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/boot/string.c
diff options
context:
space:
mode:
authorBaoquan He <[email protected]>2017-05-13 13:46:28 +0800
committerIngo Molnar <[email protected]>2017-05-24 09:50:27 +0200
commitd52e7d5a952c5e35783f96e8c5b7fcffbb0d7c60 (patch)
tree4c8b6c1df9e5032f71a9f79b1f573774f690d766 /arch/x86/boot/string.c
parent56fff1bb0f31358bf81a3c64a8dcd6da0dc44263 (diff)
x86/KASLR: Parse all 'memmap=' boot option entries
In commit: f28442497b5c ("x86/boot: Fix KASLR and memmap= collision") ... the memmap= option is parsed so that KASLR can avoid those reserved regions. It uses cmdline_find_option() to get the value if memmap= is specified, however the problem is that cmdline_find_option() can only find the last entry if multiple memmap entries are provided. This is not correct. Address this by checking each command line token for a "memmap=" match and parse each instance instead of using cmdline_find_option(). Signed-off-by: Baoquan He <[email protected]> Acked-by: Kees Cook <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'arch/x86/boot/string.c')
-rw-r--r--arch/x86/boot/string.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c
index 5457b02fc050..630e3664906b 100644
--- a/arch/x86/boot/string.c
+++ b/arch/x86/boot/string.c
@@ -122,6 +122,14 @@ unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int bas
return result;
}
+long simple_strtol(const char *cp, char **endp, unsigned int base)
+{
+ if (*cp == '-')
+ return -simple_strtoull(cp + 1, endp, base);
+
+ return simple_strtoull(cp, endp, base);
+}
+
/**
* strlen - Find the length of a string
* @s: The string to be sized