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
On macOS, Running mkdirat(., ., 0) (first arguments irrelevant, except that the parent directory is on a virtiofs mount) inside a continer fails with EACCES when a vfkit-based machine is used. I have not tested other types of machine (e.g. libkrun).
This issue arises when running useradd --create-home in debian:bookworm-20240513-slim, which is used as part of the Redox build process here. useradd uses mkdir (rather than mkdirat) here and suffers the same failure.
I believe the underlying issue is with Apple's virtiofs implementation; I have FB16008360 open with Apple to track this. Please see "Additional information" below.
mkdir fails with a permissions error, but the directory is successfully created; strace, not present on the FCOS image, shows the mkdirat syscall failing with -EACCES).
host:
arch: arm64buildahVersion: 1.38.0cgroupControllers:
- cpu
- io
- memory
- pidscgroupManager: systemdcgroupVersion: v2conmon:
package: conmon-2.1.12-2.fc40.aarch64path: /usr/bin/conmonversion: 'conmon version 2.1.12, commit: 'cpuUtilization:
idlePercent: 94.52systemPercent: 1.63userPercent: 3.84cpus: 7databaseBackend: sqlitedistribution:
distribution: fedoravariant: coreosversion: "40"eventLogger: journaldfreeLocks: 2045hostname: localhost.localdomainidMappings:
gidmap:
- container_id: 0host_id: 1000size: 1
- container_id: 1host_id: 100000size: 1000000uidmap:
- container_id: 0host_id: 501size: 1
- container_id: 1host_id: 100000size: 1000000kernel: 6.11.3-200.fc40.aarch64linkmode: dynamiclogDriver: journaldmemFree: 4222513152memTotal: 15561142272networkBackend: netavarknetworkBackendInfo:
backend: netavarkdns:
package: aardvark-dns-1.12.2-2.fc40.aarch64path: /usr/libexec/podman/aardvark-dnsversion: aardvark-dns 1.12.2package: netavark-1.12.2-1.fc40.aarch64path: /usr/libexec/podman/netavarkversion: netavark 1.12.2ociRuntime:
name: crunpackage: crun-1.17-1.fc40.aarch64path: /usr/bin/crunversion: |- crun version 1.17 commit: 000fa0d4eeed8938301f3bcf8206405315bc1017 rundir: /run/user/501/crun spec: 1.0.0 +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJLos: linuxpasta:
executable: /usr/bin/pastapackage: passt-0^20240906.g6b38f07-1.fc40.aarch64version: | pasta 0^20240906.g6b38f07-1.fc40.aarch64-pasta Copyright Red Hat GNU General Public License, version 2 or later <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.remoteSocket:
exists: truepath: unix:///run/user/501/podman/podman.sockrootlessNetworkCmd: pastasecurity:
apparmorEnabled: falsecapabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOTrootless: trueseccompEnabled: trueseccompProfilePath: /usr/share/containers/seccomp.jsonselinuxEnabled: trueserviceIsRemote: trueslirp4netns:
executable: /usr/bin/slirp4netnspackage: slirp4netns-1.2.2-2.fc40.aarch64version: |- slirp4netns version 1.2.2 commit: 0ee2d87523e906518d34a6b423271e4826f71faf libslirp: 4.7.0 SLIRP_CONFIG_VERSION_MAX: 4 libseccomp: 2.5.5swapFree: 0swapTotal: 0uptime: 2h 41m 16.00s (Approximately 0.08 days)variant: v8plugins:
authorization: nulllog:
- k8s-file
- none
- passthrough
- journaldnetwork:
- bridge
- macvlan
- ipvlanvolume:
- localregistries:
search:
- docker.iostore:
configFile: /var/home/core/.config/containers/storage.confcontainerStore:
number: 1paused: 0running: 1stopped: 0graphDriverName: overlaygraphOptions: {}graphRoot: /var/home/core/.local/share/containers/storagegraphRootAllocated: 106769133568graphRootUsed: 16266203136graphStatus:
Backing Filesystem: xfsNative Overlay Diff: "true"Supports d_type: "true"Supports shifting: "false"Supports volatile: "true"Using metacopy: "false"imageCopyTmpDir: /var/tmpimageStore:
number: 21runRoot: /run/user/501/containerstransientStore: falsevolumePath: /var/home/core/.local/share/containers/storage/volumesversion:
APIVersion: 5.3.1Built: 1732147200BuiltTime: Thu Nov 21 00:00:00 2024GitCommit: ""GoVersion: go1.22.7Os: linuxOsArch: linux/arm64Version: 5.3.1
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
Apple Silicon M3 Max (aarch64), Sequoia 15.1.1.
Additional information
To try to isolate where exactly the EACCES comes from, I ran Alpine Linux Virt 3.20 in vfkit directly. I built a custom Kernel to add some additional pr_debug instrumentation around the relevant parts of the FUSE and virtiofs implementations.
A vfkit VM running Alpine Linux with the patched Kernel was run with --device virtio-fs,sharedDir="${SCRATCH_DIR}"/,mountTag=vfkit-share, and the following experiment performed:
We see that the source of the EACCES error is the FUSE server backing the virtiofs mount; in this context, the server is the macOS Virtualization Framework via a VZVirtioFileSystemDeviceConfiguration, so I have raised an issue with Apple.
Note that the mkdirat_test is necessary rather than just running mkdir -m0 foo because Alpine's busybox mkdir does a two stage mkdir/chmod rather than using mkdirat(., ., 0).
The text was updated successfully, but these errors were encountered:
I would assume this is the same issue as I already described here: #23018
If anything chmod 0 any file/dir it will not longer be accessible as we launch the VM (thus virtofs) as user so there is no way to read such a file on the host.
I would assume this is the same issue as I already described here: #23018
If anything chmod 0 any file/dir it will not longer be accessible as we launch the VM (thus virtofs) as user so there is no way to read such a file on the host.
They may share a common cause somewhere inside Apple's virtiofs implementation, but I believe the manifestation in the VM is different: in your case, you find that once a file has a mode of 0, it's impossible to access it; in my case, I find that creating a file with a mode of 0 claims to fail, even though it succeeds.
I could imagine that Apple's FUSE implementation of mkdir involves several APFS operations, including (for example) a final stat after the file has been created, and this stat fails for the same reason as your issue, leading the overall mkdir operation to appear to fail. If this is the case, then I think there is still a separate bug on Apple's side, namely that the mkdir operation isn't sufficiently atomic.
Issue Description
On macOS, Running
mkdirat(., ., 0)
(first arguments irrelevant, except that the parent directory is on a virtiofs mount) inside a continer fails withEACCES
when a vfkit-based machine is used. I have not tested other types of machine (e.g. libkrun).This issue arises when running
useradd --create-home
indebian:bookworm-20240513-slim
, which is used as part of the Redox build process here.useradd
usesmkdir
(rather thanmkdirat
) here and suffers the same failure.I believe the underlying issue is with Apple's virtiofs implementation; I have
FB16008360
open with Apple to track this. Please see "Additional information" below.Steps to reproduce the issue
Steps to reproduce the issue
podman machine reset && podman machine init
podman machine start
podman machine ssh
cd /Users/${MACOS_USERNAME}
mkdir -m0 foo
ls
Describe the results you received
mkdir
fails with a permissions error, but the directory is successfully created;strace
, not present on the FCOS image, shows themkdirat
syscall failing with-EACCES
).Describe the results you expected
Either:
podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
Apple Silicon M3 Max (aarch64), Sequoia 15.1.1.
Additional information
To try to isolate where exactly the
EACCES
comes from, I ran Alpine Linux Virt 3.20 invfkit
directly. I built a custom Kernel to add some additionalpr_debug
instrumentation around the relevant parts of the FUSE and virtiofs implementations.This patch was applied to Linux v6.6.63.
A
vfkit
VM running Alpine Linux with the patched Kernel was run with--device virtio-fs,sharedDir="${SCRATCH_DIR}"/,mountTag=vfkit-share
, and the following experiment performed:We see that the source of the
EACCES
error is the FUSE server backing thevirtiofs
mount; in this context, the server is the macOS Virtualization Framework via aVZVirtioFileSystemDeviceConfiguration
, so I have raised an issue with Apple.Note that the
mkdirat_test
is necessary rather than just runningmkdir -m0 foo
because Alpine's busyboxmkdir
does a two stagemkdir
/chmod
rather than usingmkdirat(., ., 0)
.The text was updated successfully, but these errors were encountered: