-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix xattr copy failures on SELinux systems #6015
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
base: master
Are you sure you want to change the base?
Conversation
dd0e37e
to
c55e4c0
Compare
How did you test this? |
I won't be able to test this as I do not have time to build all the associated components I require. I am simply PR'ing the root cause of the issues I am having, and leaning on this project maintainers to get it merged. |
solver/llbsolver/ops/exec_binfmt.go
Outdated
@@ -64,6 +65,15 @@ func (m *staticEmulatorMount) Mount() ([]mount.Mount, func() error, error) { | |||
if err := copy.Copy(context.TODO(), filepath.Dir(m.path), filepath.Base(m.path), tmpdir, qemuMountName, func(ci *copy.CopyInfo) { | |||
m := 0555 | |||
ci.Mode = &m | |||
ci.XAttrErrorHandler = func(dst, src, xattrKey string, err error) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there's also functional arguments for this;
buildkit/vendor/github.com/tonistiigi/fsutil/copy/copy.go
Lines 231 to 242 in cd3d075
func WithXAttrErrorHandler(h XAttrErrorHandler) Opt { | |
return func(ci *CopyInfo) { | |
ci.XAttrErrorHandler = h | |
} | |
} | |
func AllowXAttrErrors(ci *CopyInfo) { | |
h := func(string, string, string, error) error { | |
return nil | |
} | |
WithXAttrErrorHandler(h)(ci) | |
} |
(but not sure if we can unconditionally ignore all syscall.ENOTSUP
errors)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
69482ed
to
12d70b7
Compare
7e225a6
to
e65bc1c
Compare
When copying the buildkit-qemu-emulator binary on systems with SELinux enabled, the copy operation fails with "operation not supported" errors when attempting to copy security.selinux xattrs. This change adds an XAttrErrorHandler to the copy.Copy call that ignores ENOTSUP errors, allowing the copy to succeed on SELinux-enabled systems. Fixes moby#5544 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>
…ndler function Signed-off-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>
Signed-off-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>
e65bc1c
to
b613010
Compare
Signed-off-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>
b613010
to
ca8238c
Compare
Summary
Description
When copying the buildkit-qemu-emulator binary on systems with SELinux enabled, the copy operation fails with "operation not supported" errors when attempting to copy security.selinux xattrs.
This PR adds an XAttrErrorHandler to the copy.Copy call that ignores ENOTSUP errors, allowing the copy to succeed on SELinux-enabled systems.
Related Issues
Fixes #5544
Test plan
🤖 Generated with Claude Code