Description of problem: Note: This is on armv7hl only. Simple qemu-img commands fail with odd errors, eg: $ qemu-img create -f qcow2 -o preallocation=metadata blank-disk-1s.qcow2 512 qemu-img: blank-disk-1s.qcow2: The image size is too large for file format 'qcow2' (try using a larger cluster size) Formatting 'blank-disk-1s.qcow2', fmt=qcow2 size=512 encryption=off cluster_size=65536 preallocation=metadata lazy_refcounts=off refcount_bits=16 $ qemu-img create -f qcow2 -o preallocation=metadata blank-disk-1K.qcow2 1K qemu-img: blank-disk-1K.qcow2: The image size is too large for file format 'qcow2' (try using a larger cluster size) Formatting 'blank-disk-1K.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 preallocation=metadata lazy_refcounts=off refcount_bits=16 Version-Release number of selected component (if applicable): qemu 2:2.6.0-3.fc25 How reproducible: Unknown, but at least once. Steps to Reproduce: 1. See commands above.
Weirdly this does *not* happen with qemu 2:2.6.0-3.fc24. The only apparent difference is F24 vs F25 (so glibc? kernel?) I can reproduce this in upstream qemu on Rawhide/armv7l.
Created attachment 1167837 [details] pwritev-test.c Please try the attached program with glibc-2.23.90-21.fc25.armv7hl $ gcc -Wall pwritev-test.c -o pwritev-test $ ./pwritev-test pwritev: File too large It works on x86-64, and it also works on armv7 in Fedora 24. The reason is because glibc is mangling (byte swapping, I think?) the 'offset' parameter. I passed offset = 32, but: $ strace ./pwritev-test ... pwritev(3, [{"\0\0\0\0\0\0\0\0\0\0", 10}, {"\0\0\0\0\0\0", 6}], 2, 137438953472) = -1 EFBIG (File too large) where 137438953472 == 0x2000000000
Might be caused by this. commit af5fdf5a358329161cc3960f5e54fac16dbb8063 Author: Adhemerval Zanella <adhemerval.zanella> Date: Mon Apr 11 15:07:12 2016 -0300 Consolidate pwritev/pwritev64 implementations This patch consolidates all the pwritev{64} implementation for Linux in only one (sysdeps/unix/sysv/linux/pwritev{64}.c). It also removes the syscall from the auto-generation using assembly macros. It was based on previous pwrite/pwrite64 consolidation patch. The new macro SYSCALL_LL{64} is used to handle the offset argument and alias is created for __ASSUME_OFF_DIFF_OFF64 in case of pread64. Checked on x86_64, i386, aarch64, and powerpc64le.
I sent a fix for this issue for review [1]. [1] https://sourceware.org/ml/libc-alpha/2016-06/msg00559.html