google / fscrypt

Go tool for managing Linux filesystem encryption
Apache License 2.0
905 stars 99 forks source link

fscrypt tests fail on non x86_64 arches (aarch64, ppc64le, s390x) #382

Open Conan-Kudo opened 1 year ago

Conan-Kudo commented 1 year ago

While packaging fscrypt for Fedora Linux, I encountered that the tests fail on non-x86_64 arches.

On those architectures, I get a variation of this error:

Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.WrCoy3
+ umask 022
+ cd /builddir/build/BUILD
+ cd fscrypt-0.3.4
+ LDFLAGS=' -X github.com/google/fscrypt/version=0.3.4'
+ GO_TEST_FLAGS='-buildmode pie -compiler gc'
+ GO_TEST_EXT_LD_FLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  '
+ go-rpm-integration check -i github.com/google/fscrypt -b /builddir/build/BUILD/fscrypt-0.3.4/_build/bin -s /builddir/build/BUILD/fscrypt-0.3.4/_build -V 0.3.4-1.fc40 -p /builddir/build/BUILDROOT/fscrypt-0.3.4-1.fc40.aarch64 -g /usr/share/gocode -r '.*example.*'
Testing    in: /builddir/build/BUILD/fscrypt-0.3.4/_build/src
         PATH: /builddir/build/BUILD/fscrypt-0.3.4/_build/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin
       GOPATH: /builddir/build/BUILD/fscrypt-0.3.4/_build:/usr/share/gocode
  GO111MODULE: off
      command: go test -buildmode pie -compiler gc -ldflags " -X github.com/google/fscrypt/version=0.3.4 -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  '"
      testing: github.com/google/fscrypt
github.com/google/fscrypt/actions
skipping integration test
ok      github.com/google/fscrypt/actions   0.005s
github.com/google/fscrypt/actions
skipping integration test
ok      github.com/google/fscrypt/actions   0.005s
github.com/google/fscrypt/cmd/fscrypt
PASS
ok      github.com/google/fscrypt/cmd/fscrypt   0.007s
github.com/google/fscrypt/crypto
2023/09/02 22:48:55 WARNING: Truncating parallelism cost of 257 to 1
PASS
ok      github.com/google/fscrypt/crypto    0.103s
github.com/google/fscrypt/crypto
2023/09/02 22:48:56 WARNING: Truncating parallelism cost of 257 to 1
PASS
ok      github.com/google/fscrypt/crypto    0.105s
github.com/google/fscrypt/filesystem
2023/09/02 22:48:56 WARNING: "/tmp/fscrypt2504712535/file" is owned by uid 1000, but expected 4294967295 or 0
2023/09/02 22:48:56 ignoring mountpoint "/proc/filesystems" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/btrfs-control" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/loop-control" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/loop0" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/loop1" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/loop10" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/loop11" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/loop2" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/loop3" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/loop4" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/loop5" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/loop6" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/loop7" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/loop8" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/loop9" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/dev/mapper/control" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/run/host/os-release" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/etc/resolv.conf" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/proc/sys/kernel/random/boot_id" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/proc/sys/kernel/random/boot_id" because it is not a directory
2023/09/02 22:48:56 ignoring mountpoint "/proc/kmsg" because it is not a directory
2023/09/02 22:48:56 ignoring invalid mountinfo line ""
2023/09/02 22:48:56 ignoring invalid mountinfo line ""
--- FAIL: TestLoadSourceDevice (0.00s)
    mountpoint_test.go:112: mnt.Device wasn't set to source device
2023/09/02 22:48:56 ignoring mountpoint "/tmp/fscrypt_regfile2324297373" because it is not a directory
2023/09/02 22:48:56 ignoring invalid mountinfo line ""
2023/09/02 22:48:56 ignoring invalid mountinfo line "a"
2023/09/02 22:48:56 ignoring invalid mountinfo line "a a a a a a a a a a a a a a a"
2023/09/02 22:48:56 ignoring invalid mountinfo line "a a a a a a a a a a a a - a a"
2023/09/02 22:48:56 ignoring invalid mountinfo line "15 0 BAD:3 / / rw,relatime shared:1 - ext4 /dev/root rw,data=ordered"
2023/09/02 22:48:56 ignoring invalid mountinfo line ""
2023/09/02 22:48:56 ignoring invalid mountinfo line ""
2023/09/02 22:48:56 ignoring invalid mountinfo line ""
2023/09/02 22:48:56 ignoring invalid mountinfo line ""
2023/09/02 22:48:56 ignoring invalid mountinfo line ""
2023/09/02 22:48:56 ignoring invalid mountinfo line ""
2023/09/02 22:48:56 ignoring invalid mountinfo line ""
2023/09/02 22:48:56 ignoring invalid mountinfo line ""
FAIL
exit status 1
FAIL    github.com/google/fscrypt/filesystem    0.009s
error: Bad exit status from /var/tmp/rpm-tmp.WrCoy3 (%check)
    Bad exit status from /var/tmp/rpm-tmp.WrCoy3 (%check)

Full build logs:

ebiggers commented 1 year ago

https://github.com/google/fscrypt/commit/b928729b995fbbc007e47ec39a111ef059fcb29c probably fixed this. Can you try the latest master branch?

Conan-Kudo commented 1 year ago

Well, now POWER works, but IBM Z and AArch64 don't: https://koji.fedoraproject.org/koji/taskinfo?taskID=105965161

ebiggers commented 1 year ago

So the tests do work on AArch64; I just tested it. You seem to be doing your builds in containers, and I think this failure is actually related to that. Is /sys mounted in your containers?

Conan-Kudo commented 1 year ago

I'm not sure... @nirik or @praiskup would be able to answer that confidently for the build system environments.

nirik commented 1 year ago

It's mock using (default) systemd-nspawn container. /sys should be there...

praiskup commented 1 year ago

@nirik is right; rpmbuild in mock is wrapped with systemd-nspawn, and it provides it's own /sys (Mock actually pre-creates one as well, but nspawn overmounts it).

praiskup commented 1 year ago

Actually, there's a reported Copr issue that relates to /proc/sys. Is this /sys or /proc/sys related?