You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c62fcd1
Browse filesBrowse the repository at this point in the historyBrowse files
fix(libcontainer): label mqueue with an xattr instead of context= (#3773)
* fix(libcontainer): label mqueue with an xattr instead of context=
With linux.mountLabel set on an SELinux host, youki adds context=<label>
to every mount but proc and sysfs. mqueue refuses it with EINVAL (its
superblock belongs to the IPC namespace), so every container with a
mount label and a /dev/mqueue mount, which is every container Podman
creates on an SELinux host, fails with "failed to prepare rootfs".
Label mqueue's root with the security.selinux xattr after fsmount()
instead, as crun (get_mount_label_how: LABEL_XATTR) and runc
(label.SetFileLabel after the mqueue mount) do.
Signed-off-by: Emilio Persson <93738720+ItzExotical@users.noreply.github.com>
* fix(libcontainer): keep find_parent_mount's doc comment on it
The new helper was added between find_parent_mount and its doc comment.
Signed-off-by: Emilio Persson <93738720+ItzExotical@users.noreply.github.com>
* fix(libcontainer): label mqueue before mount_setattr
An mqueue mount with "ro" is read-only once mount_setattr runs, so the
security.selinux xattr set after it failed with EROFS. Set the label
right after fsmount(), before mount_setattr.
The contest test creates a container with linux.mountLabel and a
read-only /dev/mqueue; it is skipped unless SELinux is enabled and the
policy knows container_file_t.
Signed-off-by: Emilio Persson <93738720+ItzExotical@users.noreply.github.com>
* test(libcontainer): a labelled mqueue refuses the mount(2) fallback
The legacy mount is read-only at once when the spec says ro, so the xattr label
could not be set afterwards; the mount refuses the fallback instead of starting
unlabelled, as the copy-up already does.
Signed-off-by: Emilio Persson <93738720+ItzExotical@users.noreply.github.com>
* fix(libcontainer): label mqueue with fsetxattr through the Syscall trait
Reopen the fsmount fd through pathrs' verified procfs (open_follow on
/proc/self/fd/N) and set security.selinux with fsetxattr, as crun's
apply_selinux_xattr does, instead of setxattr on a /proc/self/fd path.
fsetxattr is a new Syscall method, so the test syscall records it and
can fail it.
Whether SELinux is enabled is read once when the Mount is built, so
the tests set it instead of depending on the host. The new test checks
the label goes to the reopened mount fd before mount_setattr makes it
read-only, that a failed label aborts the mount, and that other
filesystems keep context=. The fsmount-fallback test now fails every
fsconfig: mount_into_container retries once on EINVAL, so a single
failure only held on hosts without SELinux.
Signed-off-by: Emilio Persson <93738720+ItzExotical@users.noreply.github.com>
* test(contest): check /dev/mqueue's SELinux label and read-only mount
mount_label_test now runs runtimetest inside the container, which reads
/dev/mqueue's security.selinux xattr against linux.mountLabel and checks
the mount is read-only as the spec asks. It still runs only where
SELinux is enabled and the policy knows container_file_t.
Signed-off-by: Emilio Persson <93738720+ItzExotical@users.noreply.github.com>
---------
Signed-off-by: Emilio Persson <93738720+ItzExotical@users.noreply.github.com>
0 commit comments