Re: [PATCH v2 0/3] sparc64: Randomize mmap base and PIE executables

From: John Paul Adrian Glaubitz

Date: Sun Oct 18 2026 - 09:10:11 EST


Hi Stian,

On Sun, 2026-10-18 at 14:27 +0200, Stian Halseth wrote:
> On sparc64 a 64-bit process gets little address space randomization:
> the stack moves, but shared libraries, anonymous mappings, PIE
> executables and the brk heap land at the same address on every run.
>
> Patch 1 makes arch_get_unmapped_area() start at the randomized
> mm->mmap_base again, which it has ignored since v3.8. Patch 2 moves the
> 32-bit PIE base out of the legacy mmap area, so that patch 3 can select
> ARCH_HAS_ELF_RANDOMIZE and randomize PIE executables and brk as on
> other architectures.
>
> Found while adding PIE support to the sparc64 Go port:
> https://github.com/sparclinux/issues/issues/119
>
> Tested on a T4-1 and a T7-1 (sun4v) and a V240 (sun4u), with 64-bit and
> 32-bit userland. With the series the program image, brk, shared
> libraries and mmap base move between runs, and with
> randomize_va_space=0 or setarch -R the layout is the same as before.
> The exec and mm selftests, glibc's elf and nptl tests, the Python test
> suite and a kernel build give the same results with and without the
> series.

What about sparc32? Does it use address base randomization at all?

Adrian

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913