Skip to content

Commit

Permalink
ARC: [mm] Make stack/heap Non-executable by default
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vineet Gupta committed Jun 22, 2013
1 parent 2ed21da commit 3abc944
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
7 changes: 0 additions & 7 deletions arch/arc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,6 @@ config ARC_MISALIGN_ACCESS
Use ONLY-IF-ABS-NECESSARY as it will be very slow and also can hide
potential bugs in code

config ARC_STACK_NONEXEC
bool "Make stack non-executable"
default n
help
To disable the execute permissions of stack/heap of processes
which are enabled by default.

config HZ
int "Timer Frequency"
default 100
Expand Down
7 changes: 1 addition & 6 deletions arch/arc/include/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,8 @@ typedef unsigned long pgtable_t;

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

/* Default Permissions for page, used in mmap.c */
#ifdef CONFIG_ARC_STACK_NONEXEC
/* Default Permissions for stack/heaps pages (Non Executable) */
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE)
#else
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#endif

#define WANT_PAGE_VIRTUAL 1

Expand Down

0 comments on commit 3abc944

Please sign in to comment.