* [PATCH] riscv: defconfig: Disable COMPAT_BRK
@ 2026-10-29 12:07 Michael Ellerman
2026-11-04 9:06 ` Paul Walmsley
0 siblings, 1 reply; 2+ messages in thread
From: Michael Ellerman @ 2026-10-29 12:07 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: linux-riscv, linux-kernel, Michael Ellerman
COMPAT_BRK defaults to y, which disables brk (heap) randomisation by
default (ie. randomize_va_space=1 by default) for compatibility with
"ancient" binaries, in particular libc5 based binaries.
libc5 predates RISC-V, so there can't be any libc5 binaries for RISC-V.
COMPAT_BRK was introduced in 2008, commit 32a932332c8b
("brk randomization: introduce CONFIG_COMPAT_BRK"). But even then the
only non-libc5 binaries mentioned as being broken were ~5 year old
versions of emacs (see commit c1d171a00294 ("x86: randomize brk")).
Distro kernels for riscv64 also disable it, including Debian, Fedora,
openSUSE and Ubuntu. So even if there were riscv binaries out there
that rely on it, no mainstream distro would support them.
Most other architectures already disable COMPAT_BRK in their primary
defconfigs, including arm64, x86_64, powerpc, s390, loongarch and
sparc64, as do the riscv nommu defconfigs. It is also disabled in
kernel/configs/hardening.config.
So disable COMPAT_BRK in the riscv defconfig so that brk is randomised
by default, matching distro and other arch configs.
Signed-off-by: Michael Ellerman <mpe@kernel.org>
---
arch/riscv/configs/defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
index 04ae305d5511..933cbf2735ec 100644
--- a/arch/riscv/configs/defconfig
+++ b/arch/riscv/configs/defconfig
@@ -52,6 +52,7 @@ CONFIG_JUMP_LABEL=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_BLK_DEV_THROTTLING=y
+# CONFIG_COMPAT_BRK is not set
CONFIG_SPARSEMEM_MANUAL=y
CONFIG_NET=y
CONFIG_PACKET=y
---
base-commit: 6d0933ae9d46674a6ea63a87e9e9ab4e662670c9
change-id: 20261029-compat-brk-77626d45bd4b
Best regards,
--
Michael Ellerman <mpe@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] riscv: defconfig: Disable COMPAT_BRK
2026-10-29 12:07 [PATCH] riscv: defconfig: Disable COMPAT_BRK Michael Ellerman
@ 2026-11-04 9:06 ` Paul Walmsley
0 siblings, 0 replies; 2+ messages in thread
From: Paul Walmsley @ 2026-11-04 9:06 UTC (permalink / raw)
To: Michael Ellerman
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
linux-riscv, linux-kernel
On Thu, 29 Oct 2026, Michael Ellerman wrote:
> COMPAT_BRK defaults to y, which disables brk (heap) randomisation by
> default (ie. randomize_va_space=1 by default) for compatibility with
> "ancient" binaries, in particular libc5 based binaries.
>
> libc5 predates RISC-V, so there can't be any libc5 binaries for RISC-V.
>
> COMPAT_BRK was introduced in 2008, commit 32a932332c8b
> ("brk randomization: introduce CONFIG_COMPAT_BRK"). But even then the
> only non-libc5 binaries mentioned as being broken were ~5 year old
> versions of emacs (see commit c1d171a00294 ("x86: randomize brk")).
>
> Distro kernels for riscv64 also disable it, including Debian, Fedora,
> openSUSE and Ubuntu. So even if there were riscv binaries out there
> that rely on it, no mainstream distro would support them.
>
> Most other architectures already disable COMPAT_BRK in their primary
> defconfigs, including arm64, x86_64, powerpc, s390, loongarch and
> sparc64, as do the riscv nommu defconfigs. It is also disabled in
> kernel/configs/hardening.config.
>
> So disable COMPAT_BRK in the riscv defconfig so that brk is randomised
> by default, matching distro and other arch configs.
>
> Signed-off-by: Michael Ellerman <mpe@kernel.org>
Thanks, queued for v7.4-rc.
- Paul
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-04 9:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29 12:07 [PATCH] riscv: defconfig: Disable COMPAT_BRK Michael Ellerman
2026-11-04 9:06 ` Paul Walmsley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®