Bug 1733743
| Summary: | [armv7] Unix.LargeFile.ftruncate 2^32 is miscompiled | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Richard W.M. Jones <rjones> |
| Component: | ocaml | Assignee: | Richard W.M. Jones <rjones> |
| Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | alciregi, c.david86, esandeen, gemi, josef, kasal, kzak, lczerner, oliver, rjones |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | armv7hl | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2019-07-31 20:10:32 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 245418, 910269 | ||
|
Description
Richard W.M. Jones
2019-07-28 09:06:37 UTC
(In reply to Richard W.M. Jones from comment #0) > Description of problem: > > $ rm -f root > $ truncate -s 4G root > $ /usr/sbin/mke2fs -t ext2 -Fq root > mke2fs: Device size reported to be zero. Invalid partition specified, or > partition table wasn't reread after running fdisk, due to > a modified partition being busy and in use. You may need to reboot > to re-read your partition table. I read your message on the devel mailing list. Issuing the above commands on a Raspberry Pi 3 these are the results $ uname -a Linux rpi3 5.3.0-0.rc1.git3.1.fc31.armv7hl #1 SMP Thu Jul 25 15:54:45 UTC 2019 armv7l armv7l armv7l GNU/Linux $ cat /etc/redhat-release Fedora release 31 (Rawhide) $ rpm -qv e2fsprogs e2fsprogs-1.45.2-1.fc31.armv7hl $ rm -f root $ truncate -s 4G root $ /usr/sbin/mke2fs -t ext2 -Fq root warning: Unable to get device geometry for root Interesting thanks. I wonder why this fails in Koji :-? I guess I've got to do a bit more testing ... FWIW $ rm -f root $ touch root $ /usr/sbin/mke2fs -t ext4 -Fq root mke2fs: Device size reported to be zero. Invalid partition specified, or partition table wasn't reread after running fdisk, due to a modified partition being busy and in use. You may need to reboot to re-read your partition table. I modified a Koji build to run supermin, but also print the kernel etc. Linux buildvm-armv7-05.arm.fedoraproject.org 5.2.2-200.fc30.armv7hl+lpae #1 SMP Sun Jul 21 15:36:24 UTC 2019 armv7l armv7l armv7l GNU/Linux e2fsprogs-1.45.2-1.fc31.armv7hl supermin: ext2: creating empty ext2 filesystem 'd2.4r818cjh/root' RPM build errors: BUILDSTDERR: mke2fs 1.45.2 (27-May-2019) BUILDSTDERR: mke2fs: Device size reported to be zero. Invalid partition specified, or BUILDSTDERR: partition table wasn't reread after running fdisk, due to BUILDSTDERR: a modified partition being busy and in use. You may need to reboot BUILDSTDERR: to re-read your partition table. BUILDSTDERR: supermin: /usr/sbin/mke2fs -t ext2 -F 'd2.4r818cjh/root': command failed, see earlier errors BUILDSTDERR: error: Bad exit status from /var/tmp/rpm-tmp.hycBi4 (%check) BUILDSTDERR: Bad exit status from /var/tmp/rpm-tmp.hycBi4 (%check) All that supermin is doing here is basically the commands as outlined above: https://github.com/libguestfs/supermin/blob/c97b3917068597a0e68e88d9a905da766ade40da/src/format_ext2.ml#L40-L55 I wonder if there's some problem with the page cache, for example mke2fs is using O_DIRECT but the previous write to the filesystem hasn't been committed yet. (In reply to Alessio from comment #3) > FWIW > > $ rm -f root > $ touch root > $ /usr/sbin/mke2fs -t ext4 -Fq root > mke2fs: Device size reported to be zero. Invalid partition specified, or > partition table wasn't reread after running fdisk, due to > a modified partition being busy and in use. You may need to reboot > to re-read your partition table. This is expected because "touch" creates a zero length file. See the code linked in the previous comment for what we actually do to create a 4G file. I tried to fsync the directory before calling mke2fs but it made no difference. Oh lovely, this is actually a compiler bug.
$ cat test.ml
let size = Int64.shift_left 1L 32 in
Unix.LargeFile.ftruncate Unix.stdout size
$ ocamlopt unix.cmxa test.ml -o test
$ strace ./test > /tmp/file
...
ftruncate64(1, 0) = 0
^
this should be 2^32
Proposed patch: https://github.com/ocaml/ocaml/pull/8843 Will be included in OCaml 4.08.1 which we'll upgrade to when it is released. |