Skip to content

Commit 3abc944

Browse files
committed
ARC: [mm] Make stack/heap Non-executable by default
1. For VM_EXEC based delayed dcache/icache flush, reduces the number of flushes. 2. Makes this security feature ON by default rather than OFF before. 3. Applications can use mprotect() to selectively override this. 4. ELF binaries have a GNU_STACK segment which can easily override the kernel default permissions. For nested-functions/trampolines, gcc already auto-enables executable stack in elf. Others needing this can use -Wl,-z,execstack option. Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent 2ed21da commit 3abc944

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

arch/arc/Kconfig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,6 @@ config ARC_MISALIGN_ACCESS
362362
Use ONLY-IF-ABS-NECESSARY as it will be very slow and also can hide
363363
potential bugs in code
364364

365-
config ARC_STACK_NONEXEC
366-
bool "Make stack non-executable"
367-
default n
368-
help
369-
To disable the execute permissions of stack/heap of processes
370-
which are enabled by default.
371-
372365
config HZ
373366
int "Timer Frequency"
374367
default 100

arch/arc/include/asm/page.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,8 @@ typedef unsigned long pgtable_t;
9696

9797
#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
9898

99-
/* Default Permissions for page, used in mmap.c */
100-
#ifdef CONFIG_ARC_STACK_NONEXEC
99+
/* Default Permissions for stack/heaps pages (Non Executable) */
101100
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE)
102-
#else
103-
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
104-
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
105-
#endif
106101

107102
#define WANT_PAGE_VIRTUAL 1
108103

0 commit comments

Comments
 (0)