-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fchownat not respecting AT_EMPTY_PATH on file descriptors opened with O_PATH #9453
Comments
Small note: |
@EtiennePerot thanks for the reply. I'm not too surprised to be honest. The install of |
Again, thanks for the detailed bug report and doing a lot of the debugging on our behalf. I am sending a fix. |
This way, we get the correct implementation for Stat, SetStat, StatFS and Xattr for free. Fixes #9453 PiperOrigin-RevId: 570753850
Hmm, open(2) says:
But it seems like O_PATH FD is allowed to make fchown(2) with AT_EMPTY_PATH? |
Yes that's my interpretation of the
|
#9468 should be the right fix. |
Nice one! |
Description
apt-get install systemd
was failing within gvisor, and using the debugger I think I've tracked it down to a failedfchownat
syscall.fchownat(0x4 /var/log/journal, 0x55937991a725 , 0x0, 0x66, 0x1000) = 0 (0x0) errno=9 (bad file number)
To implement the syscall gvisor is using the
gvisor.dev/gvisor/pkg/sentry/vfs.opathFD
FD implementation (which expectedly doesn't support the operation) even though theAT_EMPTY_PATH
flag has been passed. Per fchownat (2) I think gvisor should operate on the file referred tobeby the FD in order to fulfil thefchownat
operation successfully.Here is the relevant
strace
output from thesystemd
install:Here is the relevant
delve
debugger outputThis is acquired by attaching a debugger to the docker container given below:
Steps to reproduce
The following is sufficient to reproduce the error, and is how the problem was originally discovered:
The installation of
systemd
will not succeed, stemming frominstalled systemd package post-installation script subprocess returned error exit status 73
. The cause of the failure in thepost-installation
script isfchownat() of /var/log/journal failed: Bad file descriptor
.The problem being the post-installation script was confirmed by unpacking the install into separate steps:
runsc version
docker version (if using docker)
Client: Docker Engine - Community Version: 24.0.6 API version: 1.43 Go version: go1.20.7 Git commit: ed223bc Built: Mon Sep 4 12:32:12 2023 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 24.0.6 API version: 1.43 (minimum version 1.12) Go version: go1.20.7 Git commit: 1a79695 Built: Mon Sep 4 12:32:12 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.22 GitCommit: 8165feabfdfe38c65b599c4993d227328c231fca runc: Version: 1.1.8 GitCommit: v1.1.8-0-g82f18fe docker-init: Version: 0.19.0 GitCommit: de40ad0
uname
Linux ip-10-1-8-45 5.15.0-1044-aws #49~20.04.1-Ubuntu SMP Mon Aug 21 17:09:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
kubectl (if using Kubernetes)
No response
repo state (if built from source)
No response
runsc debug logs (if available)
This is the relevant slice
grep -C100 "fchownat(0x4 /var/log/journal, 0x55937991a725 , 0x0, 0x66, 0x1000) = 0 (0x0) errno=9"
of the boot logs. Overall file was 98MB and too large for Github's 25MB limit.boot_logs_slice.txt
The text was updated successfully, but these errors were encountered: