Skip to content

Commit 44c7682

Browse files
keesKAGA-KOKO
authored andcommitted
x86: Increase brk randomness entropy for 64-bit systems
In commit c1d171a ("x86: randomize brk"), arch_randomize_brk() was defined to use a 32MB range (13 bits of entropy), but was never increased when moving to 64-bit. The default arch_randomize_brk() uses 32MB for 32-bit tasks, and 1GB (18 bits of entropy) for 64-bit tasks. Update x86_64 to match the entropy used by arm64 and other 64-bit architectures. Reported-by: y0un9n132@gmail.com Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Jiri Kosina <jkosina@suse.com> Closes: https://lore.kernel.org/linux-hardening/CA+2EKTVLvc8hDZc+2Yhwmus=dzOUG5E4gV7ayCbu0MPJTZzWkw@mail.gmail.com/ Link: https://lore.kernel.org/r/20240217062545.1631668-1-keescook@chromium.org
1 parent 3c6539b commit 44c7682

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/x86/kernel/process.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,10 @@ unsigned long arch_align_stack(unsigned long sp)
10301030

10311031
unsigned long arch_randomize_brk(struct mm_struct *mm)
10321032
{
1033-
return randomize_page(mm->brk, 0x02000000);
1033+
if (mmap_is_ia32())
1034+
return randomize_page(mm->brk, SZ_32M);
1035+
1036+
return randomize_page(mm->brk, SZ_1G);
10341037
}
10351038

10361039
/*

0 commit comments

Comments
 (0)