On 28/03/2023 13.48, Luca Bonissi wrote:
On qemu-sparc64 (userspace) the struct "target_stat64" is not correctly
padded, so the field st_rdev is not correctly aligned and will report wrong
major/minor (e.g. for /dev/zero it reports 0,0x10500000 instead of 1,5).
Here patch to solve the issue (it also fixes incorrect size on some fields):
--- qemu-20230327/linux-user/syscall_defs.h 2023-03-27 15:41:42.000000000
+0200
+++ qemu-20230327/linux-user/syscall_defs.h.new 2023-03-27
21:43:25.615115126 +0200
@@ -1450,7 +1450,7 @@ struct target_stat {
unsigned int st_dev;
abi_ulong st_ino;
unsigned int st_mode;
- unsigned int st_nlink;
+ short int st_nlink;
unsigned int st_uid;
That looks wrong at a first glance. IIRC Sparc is a very strictly aligned
architecture, so if the previous field "st_mode" was aligned to a 4-byte
boundary, the "st_uid" field now would not be aligned anymore... are you
sure about this change? Maybe it needs a padding field now?
Thomas