]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests/exec: test the pre-opened interpreter limit
authorChristian Brauner <brauner@kernel.org>
Mon, 3 Aug 2026 12:15:01 +0000 (14:15 +0200)
committerChristian Brauner <brauner@kernel.org>
Mon, 3 Aug 2026 21:36:18 +0000 (23:36 +0200)
commitf2b69ea2d1a017f0c8e848ff875f4cf2492d2bd0
tree29bf4dd83ae5d3fa58f7187d05497543f27b76ed
parentb604897764047229c6a931e1980cac1b2197d9d2
selftests/exec: test the pre-opened interpreter limit

- an interpreter opened at registration is charged
- an interpreter a 'B' entry binds is charged too
- an entry that opens none is not
- removing an entry gives the charge back
- a nested user namespace cannot buy itself budget by raising its own limit

Skips where the sysctl or binfmt_misc is missing. The 'B' case lives in
binfmt_misc_bpf.c because binding needs a handler. It binds from a child
in a user namespace of its own, through the fd the child inherited, so
the charge lands on the child while the interpreter is still opened with
the entry file's credentials, and nothing outside the child sees a
changed limit.

Link: https://patch.msgid.link/20260803-work-binfmt_misc-interplimit-v1-2-4a2435500bd9@kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
tools/testing/selftests/exec/.gitignore
tools/testing/selftests/exec/Makefile
tools/testing/selftests/exec/binfmt_misc_bpf.c
tools/testing/selftests/exec/binfmt_misc_interplimit.c [new file with mode: 0644]