From: Brian Witte <brianwitte@mailfence.com>
To: Kees Cook <kees@kernel.org>
Cc: Brian Witte <brianwitte@mailfence.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Lorenzo Stoakes <ljs@kernel.org>, Jann Horn <jannh@google.com>,
Helge Deller <deller@gmx.de>,
Justin Stitt <justinstitt@google.com>,
Daniel Micay <danielmicay@gmail.com>,
Shuah Khan <shuah@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-hardening@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] exec: randomize the argument block's in-page offset
Date: Fri, 23 Oct 2026 03:54:37 +0200 (CEST) [thread overview]
Message-ID: <20261023015345.1594514-1-brianwitte@mailfence.com> (raw)
Patch 1 randomizes where the argv, envp and execfn strings sit within
the first stack page, as KSPP issue 283 asks; today their low address
bits never change. Patch 2 adds a selftest.
Patch 1 repeats bprm_fill_uid()'s set-id checks; I can send a shared
helper as a preparatory patch if preferred.
Tested in QEMU, compared with unpatched for-next/execve (b36b990c50b1),
on x86_64 with ia32, arm64 (4K pages with AArch32, and 64K pages), and
parisc 32-bit and 64-bit (STACK_GROWSUP):
- The selftest passes; unpatched, it fails.
- 10000 execs give 3709-3764 distinct offsets with 4K pages and 9259
with 64K, as a uniform draw predicts.
- Cost: about 0.5 more minor page faults per exec on average, and up
to a page of RLIMIT_STACK; exec time is within noise.
- No change in LTP execve and execveat, CRIU dump and restore, or
programs that rewrite argv[0] (setproctitle(), sshd, postgres), and
no KASAN, UBSAN or lockdep reports under exec and chmod races.
The series is based on mainline (864c07de0c7d), which now includes
for-next/execve and the const mnt_idmap conversion. On that base it adds
no W=1 warnings with GCC 14 or clang 19 on x86_64 and arm64, and the
selftest passes on x86_64.
Brian Witte (2):
exec: randomize the argument block's offset within its page
selftests/exec: test the argument block's in-page offset
fs/exec.c | 32 +++
tools/testing/selftests/exec/.gitignore | 3 +
tools/testing/selftests/exec/Makefile | 5 +
.../testing/selftests/exec/argblock-offset.c | 214 ++++++++++++++++++
.../testing/selftests/exec/argblock-report.c | 24 ++
5 files changed, 278 insertions(+)
create mode 100644 tools/testing/selftests/exec/argblock-offset.c
create mode 100644 tools/testing/selftests/exec/argblock-report.c
base-commit: 864c07de0c7dcbca58b61625dfa2e461ae63b242
--
2.47.3
next reply other threads:[~2026-10-23 1:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 1:54 Brian Witte [this message]
2026-10-23 1:54 ` [PATCH 1/2] exec: randomize the argument block's offset within its page Brian Witte
2026-10-23 1:54 ` [PATCH 2/2] selftests/exec: test the argument block's in-page offset Brian Witte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261023015345.1594514-1-brianwitte@mailfence.com \
--to=brianwitte@mailfence.com \
--cc=brauner@kernel.org \
--cc=danielmicay@gmail.com \
--cc=deller@gmx.de \
--cc=jack@suse.cz \
--cc=jannh@google.com \
--cc=justinstitt@google.com \
--cc=kees@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=shuah@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®