Loading arch/parisc/Kconfig +1 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ config PARISC select HAVE_FUNCTION_GRAPH_TRACER select HAVE_SYSCALL_TRACEPOINTS select ARCH_WANT_FRAME_POINTERS select ARCH_HAS_ELF_RANDOMIZE select RTC_CLASS select RTC_DRV_GENERIC select INIT_ALL_POSSIBLE Loading arch/parisc/include/asm/elf.h +4 −3 Original line number Diff line number Diff line Loading @@ -348,9 +348,10 @@ struct pt_regs; /* forward declaration... */ #define ELF_HWCAP 0 #define STACK_RND_MASK (is_32bit_task() ? \ 0x7ff >> (PAGE_SHIFT - 12) : \ 0x3ffff >> (PAGE_SHIFT - 12)) /* Masks for stack and mmap randomization */ #define BRK_RND_MASK (is_32bit_task() ? 0x07ffUL : 0x3ffffUL) #define MMAP_RND_MASK (is_32bit_task() ? 0x1fffUL : 0x3ffffUL) #define STACK_RND_MASK MMAP_RND_MASK struct mm_struct; extern unsigned long arch_randomize_brk(struct mm_struct *); Loading arch/parisc/kernel/process.c +1 −5 Original line number Diff line number Diff line Loading @@ -276,11 +276,7 @@ void *dereference_function_descriptor(void *ptr) static inline unsigned long brk_rnd(void) { /* 8MB for 32bit, 1GB for 64bit */ if (is_32bit_task()) return (get_random_int() & 0x7ffUL) << PAGE_SHIFT; else return (get_random_int() & 0x3ffffUL) << PAGE_SHIFT; return (get_random_int() & BRK_RND_MASK) << PAGE_SHIFT; } unsigned long arch_randomize_brk(struct mm_struct *mm) Loading arch/parisc/kernel/sys_parisc.c +8 −10 Original line number Diff line number Diff line Loading @@ -225,19 +225,17 @@ static unsigned long mmap_rnd(void) { unsigned long rnd = 0; /* * 8 bits of randomness in 32bit mmaps, 20 address space bits * 28 bits of randomness in 64bit mmaps, 40 address space bits */ if (current->flags & PF_RANDOMIZE) { if (is_32bit_task()) rnd = get_random_int() % (1<<8); else rnd = get_random_int() % (1<<28); } if (current->flags & PF_RANDOMIZE) rnd = get_random_int() & MMAP_RND_MASK; return rnd << PAGE_SHIFT; } unsigned long arch_mmap_rnd(void) { return (get_random_int() & MMAP_RND_MASK) << PAGE_SHIFT; } static unsigned long mmap_legacy_base(void) { return TASK_UNMAPPED_BASE + mmap_rnd(); Loading Loading
arch/parisc/Kconfig +1 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ config PARISC select HAVE_FUNCTION_GRAPH_TRACER select HAVE_SYSCALL_TRACEPOINTS select ARCH_WANT_FRAME_POINTERS select ARCH_HAS_ELF_RANDOMIZE select RTC_CLASS select RTC_DRV_GENERIC select INIT_ALL_POSSIBLE Loading
arch/parisc/include/asm/elf.h +4 −3 Original line number Diff line number Diff line Loading @@ -348,9 +348,10 @@ struct pt_regs; /* forward declaration... */ #define ELF_HWCAP 0 #define STACK_RND_MASK (is_32bit_task() ? \ 0x7ff >> (PAGE_SHIFT - 12) : \ 0x3ffff >> (PAGE_SHIFT - 12)) /* Masks for stack and mmap randomization */ #define BRK_RND_MASK (is_32bit_task() ? 0x07ffUL : 0x3ffffUL) #define MMAP_RND_MASK (is_32bit_task() ? 0x1fffUL : 0x3ffffUL) #define STACK_RND_MASK MMAP_RND_MASK struct mm_struct; extern unsigned long arch_randomize_brk(struct mm_struct *); Loading
arch/parisc/kernel/process.c +1 −5 Original line number Diff line number Diff line Loading @@ -276,11 +276,7 @@ void *dereference_function_descriptor(void *ptr) static inline unsigned long brk_rnd(void) { /* 8MB for 32bit, 1GB for 64bit */ if (is_32bit_task()) return (get_random_int() & 0x7ffUL) << PAGE_SHIFT; else return (get_random_int() & 0x3ffffUL) << PAGE_SHIFT; return (get_random_int() & BRK_RND_MASK) << PAGE_SHIFT; } unsigned long arch_randomize_brk(struct mm_struct *mm) Loading
arch/parisc/kernel/sys_parisc.c +8 −10 Original line number Diff line number Diff line Loading @@ -225,19 +225,17 @@ static unsigned long mmap_rnd(void) { unsigned long rnd = 0; /* * 8 bits of randomness in 32bit mmaps, 20 address space bits * 28 bits of randomness in 64bit mmaps, 40 address space bits */ if (current->flags & PF_RANDOMIZE) { if (is_32bit_task()) rnd = get_random_int() % (1<<8); else rnd = get_random_int() % (1<<28); } if (current->flags & PF_RANDOMIZE) rnd = get_random_int() & MMAP_RND_MASK; return rnd << PAGE_SHIFT; } unsigned long arch_mmap_rnd(void) { return (get_random_int() & MMAP_RND_MASK) << PAGE_SHIFT; } static unsigned long mmap_legacy_base(void) { return TASK_UNMAPPED_BASE + mmap_rnd(); Loading