diff options
Diffstat (limited to 'arch/s390/boot')
-rw-r--r-- | arch/s390/boot/ipl_parm.c | 11 | ||||
-rw-r--r-- | arch/s390/boot/string.c | 38 |
2 files changed, 48 insertions, 1 deletions
diff --git a/arch/s390/boot/ipl_parm.c b/arch/s390/boot/ipl_parm.c index 7f8e546400a1..9dab596be98e 100644 --- a/arch/s390/boot/ipl_parm.c +++ b/arch/s390/boot/ipl_parm.c @@ -13,6 +13,7 @@ int __bootdata(early_ipl_block_valid); unsigned long __bootdata(memory_end); int __bootdata(memory_end_set); +int __bootdata(noexec_disabled); static inline int __diag308(unsigned long subcode, void *addr) { @@ -145,8 +146,10 @@ void setup_boot_command_line(void) static char command_line_buf[COMMAND_LINE_SIZE] __section(.data); static void parse_mem_opt(void) { - char *args; char *param, *val; + bool enabled; + char *args; + int rc; args = strcpy(command_line_buf, early_command_line); while (*args) { @@ -156,6 +159,12 @@ static void parse_mem_opt(void) memory_end = memparse(val, NULL); memory_end_set = 1; } + + if (!strcmp(param, "noexec")) { + rc = kstrtobool(val, &enabled); + if (!rc && !enabled) + noexec_disabled = 1; + } } } diff --git a/arch/s390/boot/string.c b/arch/s390/boot/string.c index 09ca9130e73a..25aca07898ba 100644 --- a/arch/s390/boot/string.c +++ b/arch/s390/boot/string.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include <linux/ctype.h> #include <linux/kernel.h> +#include <linux/errno.h> #include "../lib/string.c" int strncmp(const char *cs, const char *ct, size_t count) @@ -98,3 +99,40 @@ long simple_strtol(const char *cp, char **endp, unsigned int base) return simple_strtoull(cp, endp, base); } + +int kstrtobool(const char *s, bool *res) +{ + if (!s) + return -EINVAL; + + switch (s[0]) { + case 'y': + case 'Y': + case '1': + *res = true; + return 0; + case 'n': + case 'N': + case '0': + *res = false; + return 0; + case 'o': + case 'O': + switch (s[1]) { + case 'n': + case 'N': + *res = true; + return 0; + case 'f': + case 'F': + *res = false; + return 0; + default: + break; + } + default: + break; + } + + return -EINVAL; +} |