selftests/exec: Build both static and non-static load_address tests
authorKees Cook <kees@kernel.org>
Wed, 8 May 2024 17:31:46 +0000 (10:31 -0700)
committerKees Cook <kees@kernel.org>
Wed, 19 Jun 2024 19:44:39 +0000 (12:44 -0700)
commitb57a2907c9d96c56494ef25f8ec821cd0b355dd6
treede6171704cae0f0cb68a7bf74e5e3dd59094016e
parentc3f38fa61af77b49866b006939479069cd451173
selftests/exec: Build both static and non-static load_address tests

After commit 4d1cd3b2c5c1 ("tools/testing/selftests/exec: fix link
error"), the load address alignment tests tried to build statically.
This was silently ignored in some cases. However, after attempting to
further fix the build by switching to "-static-pie", the test started
failing. This appears to be due to non-PT_INTERP ET_DYN execs ("static
PIE") not doing alignment correctly, which remains unfixed[1]. See commit
aeb7923733d1 ("revert "fs/binfmt_elf: use PT_LOAD p_align values for
static PIE"") for more details.

Provide rules to build both static and non-static PIE binaries, improve
debug reporting, and perform several test steps instead of a single
all-or-nothing test. However, do not actually enable static-pie tests;
alignment specification is only supported for ET_DYN with PT_INTERP
("regular PIE").

Link: https://bugzilla.kernel.org/show_bug.cgi?id=215275
Link: https://lore.kernel.org/r/20240508173149.677910-1-keescook@chromium.org
Signed-off-by: Kees Cook <kees@kernel.org>
tools/testing/selftests/exec/Makefile
tools/testing/selftests/exec/load_address.c