-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/link: panic: operation not permitted #41356
Comments
This line is the error when mmap failed. Does the machine you are using not support mmap? We dropped the fallback path when mmap fails. Maybe we should add them back? @jeremyfaller |
Seems to be the OS is returning a different error than one we've seen before. We check for "operation not supported", not "operation not permitted". This error seems related to using CONFIG_STRICT_DEVMEM in the kernel. Although this could result in a game of whack-a-mole with error codes, since this is the only currently reported error, I'll send a CL to also fail gracefully with that error. If any more come up, I'll come up with a better pattern. ** Thinking about this more, and digging into the code more. I think I will default to not failing. Reading about that flag makes me hesitant to accept I have all the failure cases in mind. |
The old linker uses a fallback path if mmap fails with any reason. Maybe we want to add that back? |
Yes, that's what I'm gonna do. |
SGTM. Thanks. |
Change https://golang.org/cl/254777 mentions this issue: |
Thank you! |
Wait, backing up a moment, I don't see at all what this would have to do with |
@fogfish, it would be helpful to see an strace of the failing link. Could you run |
Thank you! I'll try. This is CI/CD instance, which is fully managed by AWS. There are no shell access to it. |
Yeah, taking another look, it seems this fails with EPERM, which is rather weird. Looking at the manpages, I don't think any of the EPERM cases of mmap or fallocate can happen in our case. Maybe ftruncate? |
@fogfish, thanks. You don't happen to know what file system it's running on, do you (or what your test instance from your initial report was running on)? |
It runs on top of |
Let me try to reproduce it with given kernel on EC2 |
If you can run w.r.t. |
The environment is hardened enough and I cannot use
|
Various sandbox environments that restrict the set of permitted system calls can cause a result of |
@ianlancetaylor , that's a good point. It wouldn't surprise me at all of fallocate in particular simply wasn't on the allow list. |
Indeed |
Here is the all info, I've managed to collect about the environment
I can mock a simple program that uses some of system calls or build excessive debug logging of cmd/link if you just give an advice what direction to look ignorer to isolate and understand linker issue. |
I tend to agree with @ianlancetaylor that this looks like a sandboxed environment. Is this AWS CodePipeline? I've been trying to find docs about its execution environment, though I haven't found much. |
Maybe the path forward here is to add EPERM to the allowed errors of fallocate (along with ENOTSUP/EOPNOTSUPP which we already do), but not accepting arbitrary errors (for one, we do want to catch "not enough space" error, which is the whole purpose of fallocate), also not accepting errors on Mmap. |
That seems fine; the fallocate is just a hint and if there really is a permission error it should come up again on mmap. |
the issue is still waiting for info. How I can help you to dig more info? |
@fogfish thanks. I think we have enough information and a proposed solution (#41356 (comment)). |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
The issue exists in a family of 1.15.x releases, most probably it relates to linker changes introduced at https://golang.org/doc/go1.15#linker
Previous family of 1.14.x releases are not impacted by the issue
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
No error
What did you see instead?
The following command fail at Amazon Linux only while running in the cloud
It fails with
The text was updated successfully, but these errors were encountered: