diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-05-23 04:24:23 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-05-23 04:24:28 -0400 |
commit | 043d07084b5347a26eab0a07aa13a4a929ad9e71 (patch) | |
tree | 13c2a902ccb2ecb779722c8b81ada32d242760c8 /arch/s390/kernel/setup.c | |
parent | 9bf05098ce34e68a9e15f09ad6cdfea4ed64057a (diff) |
[S390] Remove data execution protection
The noexec support on s390 does not rely on a bit in the page table
entry but utilizes the secondary space mode to distinguish between
memory accesses for instructions vs. data. The noexec code relies
on the assumption that the cpu will always use the secondary space
page table for data accesses while it is running in the secondary
space mode. Up to the z9-109 class machines this has been the case.
Unfortunately this is not true anymore with z10 and later machines.
The load-relative-long instructions lrl, lgrl and lgfrl access the
memory operand using the same addressing-space mode that has been
used to fetch the instruction.
This breaks the noexec mode for all user space binaries compiled
with march=z10 or later. The only option is to remove the current
noexec support.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/setup.c')
-rw-r--r-- | arch/s390/kernel/setup.c | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index f5434d1ecb31..0c35dee10b00 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -305,8 +305,7 @@ static int set_amode_and_uaccess(unsigned long user_amode, | |||
305 | */ | 305 | */ |
306 | static int __init early_parse_switch_amode(char *p) | 306 | static int __init early_parse_switch_amode(char *p) |
307 | { | 307 | { |
308 | if (user_mode != SECONDARY_SPACE_MODE) | 308 | user_mode = PRIMARY_SPACE_MODE; |
309 | user_mode = PRIMARY_SPACE_MODE; | ||
310 | return 0; | 309 | return 0; |
311 | } | 310 | } |
312 | early_param("switch_amode", early_parse_switch_amode); | 311 | early_param("switch_amode", early_parse_switch_amode); |
@@ -315,10 +314,6 @@ static int __init early_parse_user_mode(char *p) | |||
315 | { | 314 | { |
316 | if (p && strcmp(p, "primary") == 0) | 315 | if (p && strcmp(p, "primary") == 0) |
317 | user_mode = PRIMARY_SPACE_MODE; | 316 | user_mode = PRIMARY_SPACE_MODE; |
318 | #ifdef CONFIG_S390_EXEC_PROTECT | ||
319 | else if (p && strcmp(p, "secondary") == 0) | ||
320 | user_mode = SECONDARY_SPACE_MODE; | ||
321 | #endif | ||
322 | else if (!p || strcmp(p, "home") == 0) | 317 | else if (!p || strcmp(p, "home") == 0) |
323 | user_mode = HOME_SPACE_MODE; | 318 | user_mode = HOME_SPACE_MODE; |
324 | else | 319 | else |
@@ -327,31 +322,9 @@ static int __init early_parse_user_mode(char *p) | |||
327 | } | 322 | } |
328 | early_param("user_mode", early_parse_user_mode); | 323 | early_param("user_mode", early_parse_user_mode); |
329 | 324 | ||
330 | #ifdef CONFIG_S390_EXEC_PROTECT | ||
331 | /* | ||
332 | * Enable execute protection? | ||
333 | */ | ||
334 | static int __init early_parse_noexec(char *p) | ||
335 | { | ||
336 | if (!strncmp(p, "off", 3)) | ||
337 | return 0; | ||
338 | user_mode = SECONDARY_SPACE_MODE; | ||
339 | return 0; | ||
340 | } | ||
341 | early_param("noexec", early_parse_noexec); | ||
342 | #endif /* CONFIG_S390_EXEC_PROTECT */ | ||
343 | |||
344 | static void setup_addressing_mode(void) | 325 | static void setup_addressing_mode(void) |
345 | { | 326 | { |
346 | if (user_mode == SECONDARY_SPACE_MODE) { | 327 | if (user_mode == PRIMARY_SPACE_MODE) { |
347 | if (set_amode_and_uaccess(PSW_ASC_SECONDARY, | ||
348 | PSW32_ASC_SECONDARY)) | ||
349 | pr_info("Execute protection active, " | ||
350 | "mvcos available\n"); | ||
351 | else | ||
352 | pr_info("Execute protection active, " | ||
353 | "mvcos not available\n"); | ||
354 | } else if (user_mode == PRIMARY_SPACE_MODE) { | ||
355 | if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY)) | 328 | if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY)) |
356 | pr_info("Address spaces switched, " | 329 | pr_info("Address spaces switched, " |
357 | "mvcos available\n"); | 330 | "mvcos available\n"); |