buildah/chroot
Jonah Bull 939a58b967
fix secret mounts for env vars when using chroot isolation
Before #5083, when running with chroot isolation ro mounts like secrets
from env vars would explicitly have the unix.MS_NOEXEC, unix.MS_NOSUID
and unix.MS_NODEV flags set when they were remounted. Now when running
with chroot isolation ro mounts like secrets from env vars are not
getting those same flags set and so the remount operation fails.
Specifically it looks like we are missing the unix.MS_NOSUID and
unix.MS_NODEV flags.

This change adds special handling for read-only mounts when we need to do
a remount to try to get the desired flags to stick. If we've requested
a read-only mount (unix.ST_RDONLY is set in requestFlags), then we add any
possibleImportantFlags that are set in fs.Flags to remountFlags so the remount
operation doesn't fail because they are missing. I've also added a test to
bud.bats that covers this case.

Signed-off-by: Jonah Bull <jonah.bull@elastic.co>
2024-05-25 15:49:51 -05:00
..
pty_posix.go chroot: Add FreeBSD support for run with chroot isolation 2022-09-01 13:50:47 +01:00
pty_ptmx.go Fix stutters 2022-09-19 07:11:44 -04:00
pty_unsupported.go chroot: Fix cross build break 2022-09-01 13:50:48 +01:00
run_common.go Set CONTAINERS_CONF in the chroot-mount-flags integration test 2024-02-07 11:48:29 -05:00
run_freebsd.go chroot: use fileutils.(Le|E)xists 2024-04-12 09:58:13 +02:00
run_linux.go fix secret mounts for env vars when using chroot isolation 2024-05-25 15:49:51 -05:00
run_test.go Use golang.org/x/exp/slices.Contains 2024-02-07 11:50:41 -05:00
seccomp.go chroot.setupChrootBindMounts: pay more attention to flags 2023-10-20 09:46:58 -04:00
seccomp_freebsd.go chroot.setupChrootBindMounts: pay more attention to flags 2023-10-20 09:46:58 -04:00
seccomp_unsupported.go chroot.setupChrootBindMounts: pay more attention to flags 2023-10-20 09:46:58 -04:00
selinux.go Fix stutters 2022-09-19 07:11:44 -04:00
selinux_unsupported.go chroot: Fix runUsingChrootExecMain on FreeBSD 2022-09-01 13:50:47 +01:00
unsupported.go chroot: Add FreeBSD support for run with chroot isolation 2022-09-01 13:50:47 +01:00