Skip to contentSkip to conversation

fstat bug on armeb stll exists!

Qemu-devel Claudio Scordino 2 participants 2 messages Nov 29, 2007 – Dec 2, 2007

lore
Share & tools
lore
#0 lore raw

Hi all,

more than one year ago we sent a patch on this mailing list to fix
a problem of the fstat syscall for armeb. See

http://lists.gnu.org/archive/html/qemu-devel/2006-09/msg00137.html

We found the bug compiling a Linux kernel for armeb on scratchbox.

Qemu seemed to ignore the fact that in big endian systems the fields
st_blocks and its padding are swapped (to allow future expansion of the field,) so the fix consisted only in swapping the two fields (only in big endian systems, of course).

The patch just changed qemu/linux-user/syscall_defs.h to

#ifndef TARGET_WORDS_BIGENDIAN
       target_ulong    st_blocks;
       target_ulong    __pad4;
#else
      target_ulong    __pad4;
      target_ulong    st_blocks;

#endif

I've just dowloaded a fresh 0.9 Qemu, and I saw that there is still the bug...

Do you mind integrate such change, so we don't have to patch Qemu any time ?

Regards,

Claudio Scordino

Signature · 8 lines
=================================
Claudio Scordino		
Software Engineer

Evidence Srl
Embedded Real-Time solutions
http://www.evidence.eu.com
=================================
#1 lore raw
Quoted 16 lines · Claudio Scordino

Hi all,

more than one year ago we sent a patch on this mailing list to fix a
problem of the fstat syscall for armeb. See

http://lists.gnu.org/archive/html/qemu-devel/2006-09/msg00137.html

We found the bug compiling a Linux kernel for armeb on scratchbox.

Qemu seemed to ignore the fact that in big endian systems the fields st_blocks and its padding are swapped (to allow future expansion of the field,) so the fix consisted only in swapping the two fields (only in big endian systems, of course).

The patch just changed qemu/linux-user/syscall_defs.h to

Quoted 7 lines
#ifndef TARGET_WORDS_BIGENDIAN
       target_ulong    st_blocks;
       target_ulong    __pad4;
#else
      target_ulong    __pad4;
      target_ulong    st_blocks;

#endif

AFAICS this assumption matches neither the glibc 2.6 nor the Linux 2.6.23 definitions. There is, however, an endianness difference in handling the st_dev and st_rdev fields which is not handled properly in QEMU.

I think this needs a separate struct stat definition for (non-EABI) big endian ARM.

Thiemo