Skip to content

Commit d593553

Browse files
Kefeng Wangpalmer-dabbelt
authored andcommitted
riscv: Improve stack randomisation on RV64
This enlarges the bits availiable for stack randomisation on RV64 from the default of 8MiB to 1GiB, to match arm64 and x86. Also, update the documentation to reflect our support for stack randomisation. Signed-off-by: Kefeng Wang <[email protected]> [Palmer: commit text] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent efe1e08 commit d593553

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Documentation/features/vm/ELF-ASLR/arch-support.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
| openrisc: | TODO |
2323
| parisc: | ok |
2424
| powerpc: | ok |
25-
| riscv: | TODO |
25+
| riscv: | ok |
2626
| s390: | ok |
2727
| sh: | TODO |
2828
| sparc: | TODO |

arch/riscv/include/asm/elf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
*/
4343
#define ELF_ET_DYN_BASE ((TASK_SIZE / 3) * 2)
4444

45+
#ifdef CONFIG_64BIT
46+
#define STACK_RND_MASK (0x3ffff >> (PAGE_SHIFT - 12))
47+
#endif
4548
/*
4649
* This yields a mask that user programs can use to figure out what
4750
* instruction set this CPU supports. This could be done in user space,

0 commit comments

Comments
 (0)