s390x: copy_file_range error in container

Open
#135 6 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
go

Research direction

Start in fs/copy_linux.go at the copy_file_range handling around line 74, then read fs/copy.go and fs/copy_test.go, especially TestCopyDirectory and the copyFileContent path shown in the failure. Reproduce the test in a limited-capability s390x container and confirm directory copying succeeds when the syscall returns EPERM, while the existing fallback behavior remains intact.

Written by the indexing model from the issue text.

Description

On s390x the copy package fails if run inside a container because it fails to detect the existence of copy_file_range properly.

If ran on host https://github.com/containerd/continuity/blob/7f53d412b9eb1cbf744c2063185d703a0ee34700/fs/copy_linux.go#L74 fails with ENOSYS and fallback method will be used.

But if the same code is run under limited capabilities it produces EPERM instead(even though it doesn't seem to be allowed error for this syscall) and the copy fails.

--- FAIL: TestCopyDirectory (0.00s)
    copy_test.go:47: Copy test failed: operation not permitted
        copy file range failed
        github.com/containerd/continuity/fs.copyFileContent
        	/root/go/src/github.com/containerd/continuity/fs/copy_linux.go:79
        github.com/containerd/continuity/fs.CopyFile
        	/root/go/src/github.com/containerd/continuity/fs/copy.go:137
        github.com/containerd/continuity/fs.copyDirectory
        	/root/go/src/github.com/containerd/continuity/fs/copy.go:92
        github.com/containerd/continuity/fs.copyDirectory
        	/root/go/src/github.com/containerd/continuity/fs/copy.go:79
        github.com/containerd/continuity/fs.CopyDir
        	/root/go/src/github.com/containerd/continuity/fs/copy.go:40
        github.com/containerd/continuity/fs.testCopy
        	/root/go/src/github.com/containerd/continuity/fs/copy_test.go:97
        github.com/containerd/continuity/fs.TestCopyDirectory
        	/root/go/src/github.com/containerd/continuity/fs/copy_test.go:46
        testing.tRunner
        	/usr/local/go/src/testing/testing.go:827
        runtime.goexit
        	/usr/local/go/src/runtime/asm_s390x.s:782
        failed to copy files
        github.com/containerd/continuity/fs.copyDirectory
        	/root/go/src/github.com/containerd/continuity/fs/copy.go:93
        github.com/containerd/continuity/fs.copyDirectory
        	/root/go/src/github.com/containerd/continuity/fs/copy.go:79
        github.com/containerd/continuity/fs.CopyDir
        	/root/go/src/github.com/containerd/continuity/fs/copy.go:40
        github.com/containerd/continuity/fs.testCopy
        	/root/go/src/github.com/containerd/continuity/fs/copy_test.go:97
        github.com/containerd/continuity/fs.TestCopyDirectory
        	/root/go/src/github.com/containerd/continuity/fs/copy_test.go:46
        testing.tRunner
        	/usr/local/go/src/testing/testing.go:827
        runtime.goexit
        	/usr/local/go/src/runtime/asm_s390x.s:782
        failed to copy
        github.com/containerd/continuity/fs.testCopy
        	/root/go/src/github.com/containerd/continuity/fs/copy_test.go:98
        github.com/containerd/continuity/fs.TestCopyDirectory
        	/root/go/src/github.com/containerd/continuity/fs/copy_test.go:46
        testing.tRunner
        	/usr/local/go/src/testing/testing.go:827
        runtime.goexit
        	/usr/local/go/src/runtime/asm_s390x.s:782
FAIL
root@s390x-ubuntu-17:/home/ubuntu# uname -a
Linux s390x-ubuntu-17 4.4.0-130-generic #156-Ubuntu SMP Thu Jun 14 09:18:59 UTC 2018 s390x s390x s390x GNU/Linux

@estesp

Dominant language
Go
Stars
155
Forks
77
Avg merge
4d 11h
Merged PRs (30d)
8

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from containerd/continuity

All issues in containerd/continuity

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.