mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
fsopen() records the caller's user namespace in fc->user_ns and hands back an ordinary file descriptor, so the task that issues FSCONFIG_CMD_CREATE need not be the one that created the context. mount_capable() authorizes that for a caller holding CAP_SYS_ADMIN in an ancestor of fc->user_ns, which any unprivileged user has over a user namespace it just created. binfmt_misc and overlayfs used to WARN_ON() the mismatch. Add a test for both. Also cover the handover within one user namespace. That is a supported thing to do and has to keep working. Link: https://patch.msgid.link/20260802-work-fill_super-warn-v1-3-4e987911a39a@kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
11 lines
265 B
Makefile
11 lines
265 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
TEST_GEN_PROGS := fscontext_ns_test
|
|
|
|
CFLAGS += -Wall -O0 -g $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
|
|
LDLIBS := -lcap
|
|
|
|
include ../../lib.mk
|
|
|
|
$(OUTPUT)/fscontext_ns_test: fscontext_ns_test.c ../utils.c
|
|
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
|