Skip to content

Commit 166ce84

Browse files
zevweissakpm00
authored andcommitted
ARM: prctl: reject PR_SET_MDWE on pre-ARMv6
On v5 and lower CPUs we can't provide MDWE protection, so ensure we fail any attempt to enable it via prctl(PR_SET_MDWE). Previously such an attempt would misleadingly succeed, leading to any subsequent mmap(PROT_READ|PROT_WRITE) or execve() failing unconditionally (the latter somewhat violently via force_fatal_sig(SIGSEGV) due to READ_IMPLIES_EXEC). Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Zev Weiss <[email protected]> Cc: <[email protected]> [6.3+] Cc: Borislav Petkov <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Florent Revest <[email protected]> Cc: Helge Deller <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Cc: Josh Triplett <[email protected]> Cc: Kees Cook <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Mike Rapoport (IBM) <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Ondrej Mosnacek <[email protected]> Cc: Rick Edgecombe <[email protected]> Cc: Russell King (Oracle) <[email protected]> Cc: Sam James <[email protected]> Cc: Stefan Roesch <[email protected]> Cc: Yang Shi <[email protected]> Cc: Yin Fengwei <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent d5aad4c commit 166ce84

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

arch/arm/include/asm/mman.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef __ASM_MMAN_H__
3+
#define __ASM_MMAN_H__
4+
5+
#include <asm/system_info.h>
6+
#include <uapi/asm/mman.h>
7+
8+
static inline bool arch_memory_deny_write_exec_supported(void)
9+
{
10+
return cpu_architecture() >= CPU_ARCH_ARMv6;
11+
}
12+
#define arch_memory_deny_write_exec_supported arch_memory_deny_write_exec_supported
13+
14+
#endif /* __ASM_MMAN_H__ */

0 commit comments

Comments
 (0)