-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Compiler doesn't work when using Docker #65662
Comments
Nominating for libs team as this is a recent regression caused by #65094 -- cc @alexcrichton Personally this leads me to believe we should either be happier to fallback to the previous code (e.g., for any error) or revert the PR entirely since breaking usage of Rust code in Docker is not really feasible (even if this is arguably a Docker bug). |
Alternatively, we can try statx on something that should always succeed (maybe |
Cannot it match ENOSYS or EPERM just like getrandom syscall does? rust/src/libstd/sys/unix/rand.rs Line 51 in ad7c55e
|
Unlike for |
Thanks for investigating this down to I was searching around for other instances of this, and definitely turns out we're not the only ones running into this
Overaall I don't think there's a lot of prior art for this to draw from, it seems that everyone's working around the seccomp issue rather than addressing it directly. I think a reasonable solution might be to do something like try to stat |
@alexcrichton |
@oxalica yeah that's what I'm thinking, the idea being that if we don't know whether |
We are encountering a similar issue while building an Docker image with rustc & cargo on CircleCI. We are basically doing: rustup-init -y --no-modify-path --default-toolchain nightly
rustup --version
cargo --version
rustc --version
cargo fmt --version and are getting:
This errors happens since yesterday. Our last successful build with the same script was 2 days ago, with these versions:
So basically between After many tests on different Docker hosts, we haved narrowed the issue to the following: if the Docker host is using the |
@mguillemot-tel On the hosts where things don't work, what is the docker version and host kernel version? Also, can you run your command with |
I tried root@86646b35b199:~# cat >test.c
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/syscall.h>
#define SYS_statx 332 // x86_64
#define STATX_ALL 0xFFF
int main (void) {
char buf[0x100] = {};
int ret = syscall(SYS_statx, 0, "/", 0, STATX_ALL, buf);
if (ret == 0)
puts("ok");
else {
int e = errno;
perror("err");
printf("errno = %d\n", e);
}
return 0;
}
root@86646b35b199:~# gcc test.c
root@86646b35b199:~# ./a.out
ok Maybe need to update docker? |
Related? containers/buildah#1568 |
You need rather recent Docker and libseccomp packges.
Old Docker versions (or new versions running on the old systems) default to aufs but in recent versions this has changed to overlay2. That's possible explanation of what you are seeing. |
On CircleCI you cannot choose the storage driver, though you can opt in to newer Docker versions, which we've done.
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.09.3
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 7
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: e6b3f5632f50dbc4e9cb6288d911bf4f5e95b18e
runc version: 6635b4f0c6af3810594d2770f662f34ddc15b40d
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.15.0-1027-gcp
Operating System: Ubuntu 16.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.298GiB
Name: default-ccdb4d48-4a1e-40b1-90af-0ccd64a89a94
ID: LYQL:2PXY:AHV3:PLE6:H4ZU:CQQR:IY7N:TE53:LP4R:4ECZ:ZUN5:OGKJ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
provider=generic
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
WARNING: No swap limit support Kernel and Docker versions are fairly recent, but aufs is indeed being used. I also tried @oxalica 's snippet on a standard
Now, CircleCI may or may not be doing something unorthodox here, but I think it is clear that this change has broken things for potentially quite a few users who do not have the capability to simply update or reconfigure their docker environment by themselves. |
Fix check of `statx` and handle EPERM Should fix rust-lang#65662 rust-lang#65662 (comment) > I think a reasonable solution might be to do something like try to stat AT_CWD initially and if that fails with EPERM or ENOSYS we disable the syscall entirely, otherwise it's cached as always good to use. r? @alexcrichton
@mguillemot-tel can you confirm your issue was solved with the latest nightly? |
I can confirm it seems to work well in docker again 👍 We were having these issues with |
@jethrogb Yes, it's working perfectly again! Thank you! |
When I run this sequence of commands:
I get this error:
This happens due to the
statx
syscall failing with EPERM. I believe Docker uses seccomp to limit which system calls may be made, and thestatx
call is too new, so it's not whitelisted. Because the syscall fails with EPERM instead of ENOSYS, the fallback to regularstat
doesn't work.Host kernel: 4.15.0-65-generic
docker version
The text was updated successfully, but these errors were encountered: