Re: [PATCH 2/2] selftests/exec: test the argument block's in-page offset

From: Rik van Riel

Date: Tue Dec 01 2026 - 20:49:18 EST


On Fri, 2026-10-23 at 03:54 +0200, Brian Witte wrote:
> Exec a helper, argblock-report, 64 times per case. Each case checks
> that
> the in-page offset of argv[0] varies exactly when the stack top
> chosen
> by the ELF loader does:
>  - under ADDR_NO_RANDOMIZE: fixed;
>  - by default: random;
>  - a set-user-ID copy under ADDR_NO_RANDOMIZE: random;
>  - that copy on a nosuid mount, under no_new_privs, or in a new user
>    namespace where its owner has no mapping: fixed.
>
> The tests use the kselftest harness. The fixture keeps the copy in a
> private temporary directory and removes it on teardown. The copy is
> owned by the caller, so no privilege is needed.

Given that the kernel does not seem to have any
selftest for address randomization yet, I think
it may make more sense to replace this very
specific test with something that tests more of
address randomization.

The execed helper could also test that its
executable got mapped at randomized offsets,
and for the argument block we could check
that both the page, and the in-page offset
are randomized.

Can you re-send the series with this test
replaced with a generic address randomization
test?

Also, if someone runs all tests on a kernel
without address randomization enabled, should
the test return an error, or should it just
skip?

--
All Rights Reversed.