* [PATCH] x86/elf: Correct comment for STACK_RND_MASK()
@ 2026-07-22 18:44 Lorenzo Stoakes (ARM)
2026-07-23 0:25 ` SJ Park
2026-07-23 3:45 ` Kees Cook
0 siblings, 2 replies; 3+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-07-22 18:44 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Kees Cook, Andi Kleen
Cc: linux-kernel, linux-mm, ljs
Commit 913bd9060195 ("[PATCH] x86_64: Increase the variability of the
process stack on 64bit architectures"), merged in 2006, increased stack
randomisation from 8 MiB to an ostensible 1 GiB for 64-bit systems.
However the commit actually introduced a mask of 0x3fffff * 4 KiB pages
which provides 16 GiB of randomisation, not 1 GiB.
It appears Andi perhaps typo'd an additional 'f', as 0x3ffff would indeed
provide the stated 1 GiB.
Since this value has been in use for 20 years it seems sensible to retain
it, so correct the comment instead.
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
---
| 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 0de9df759c99..4133c790e71a 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -322,7 +322,7 @@ extern unsigned long get_sigframe_size(void);
#else /* CONFIG_X86_32 */
-/* 1GB for 64bit, 8MB for 32bit */
+/* 16GB for 64bit, 8MB for 32bit */
#define __STACK_RND_MASK(is32bit) ((is32bit) ? 0x7ff : 0x3fffff)
#define STACK_RND_MASK __STACK_RND_MASK(mmap_is_ia32())
---
base-commit: 248951ddc14de84de3910f9b13f51491a8cd91df
change-id: 20260722-fix-x86-comment-af666535315d
Cheers,
--
Lorenzo Stoakes (ARM) <ljs@kernel.org>
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] x86/elf: Correct comment for STACK_RND_MASK()
2026-07-22 18:44 [PATCH] x86/elf: Correct comment for STACK_RND_MASK() Lorenzo Stoakes (ARM)
@ 2026-07-23 0:25 ` SJ Park
2026-07-23 3:45 ` Kees Cook
1 sibling, 0 replies; 3+ messages in thread
From: SJ Park @ 2026-07-23 0:25 UTC (permalink / raw)
To: Lorenzo Stoakes (ARM)
Cc: SJ Park, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, H. Peter Anvin, Kees Cook, Andi Kleen,
linux-kernel, linux-mm
On Wed, 22 Jul 2026 19:44:43 +0100 "Lorenzo Stoakes (ARM)" <ljs@kernel.org> wrote:
> Commit 913bd9060195 ("[PATCH] x86_64: Increase the variability of the
> process stack on 64bit architectures"), merged in 2006, increased stack
> randomisation from 8 MiB to an ostensible 1 GiB for 64-bit systems.
>
> However the commit actually introduced a mask of 0x3fffff * 4 KiB pages
> which provides 16 GiB of randomisation, not 1 GiB.
>
> It appears Andi perhaps typo'd an additional 'f', as 0x3ffff would indeed
> provide the stated 1 GiB.
>
> Since this value has been in use for 20 years it seems sensible to retain
> it, so correct the comment instead.
Good catch, and sounds reasonable fix to me.
>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: SJ Park <sj@kernel.org>
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] x86/elf: Correct comment for STACK_RND_MASK()
2026-07-22 18:44 [PATCH] x86/elf: Correct comment for STACK_RND_MASK() Lorenzo Stoakes (ARM)
2026-07-23 0:25 ` SJ Park
@ 2026-07-23 3:45 ` Kees Cook
1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2026-07-23 3:45 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Andi Kleen, Lorenzo Stoakes (ARM)
Cc: Kees Cook, linux-kernel, linux-mm
On Wed, 22 Jul 2026 19:44:43 +0100, Lorenzo Stoakes (ARM) wrote:
> Commit 913bd9060195 ("[PATCH] x86_64: Increase the variability of the
> process stack on 64bit architectures"), merged in 2006, increased stack
> randomisation from 8 MiB to an ostensible 1 GiB for 64-bit systems.
>
> However the commit actually introduced a mask of 0x3fffff * 4 KiB pages
> which provides 16 GiB of randomisation, not 1 GiB.
>
> [...]
Applied to for-next/execve, thanks!
[1/1] x86/elf: Correct comment for STACK_RND_MASK()
https://git.kernel.org/kees/c/ab11176bd3a7
Take care,
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-23 3:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-22 18:44 [PATCH] x86/elf: Correct comment for STACK_RND_MASK() Lorenzo Stoakes (ARM)
2026-07-23 0:25 ` SJ Park
2026-07-23 3:45 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox