Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 16 Jul 2014 00:15:56 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: More MIPS stat.h breakage...?

I thought all of these issues were addressed a long time ago, but I
think we still may have at least one bits-header bug on MIPS big
endian: stat.h. The kernel version of this structure has:

struct stat64 {
        unsigned long   st_dev;
        unsigned long   st_pad0[3];     /* Reserved for st_dev expansion  */
        ...

whereas st_dev needs to be dev_t, which is 64-bit.

We're handling this now simply by using the following definition:

struct stat
{
        dev_t st_dev;
        long __st_padding1[2];
        ...

i.e. incorporating one of the padding slots into st_dev. But this only
yields the correct value for little endian. For big endian, I think
device numbers are appearing in the upper 32 bits rather than the
lower ones. This renders the major, minor, etc. macros incorrect.

I think the cleanest fix for this is probably to add an arch-specific,
nop-by-default function __stat_fixup or similar that gets called
whenever any stat-family syscall succeeds in order to patch up the
results as needed. Alternatively, we clould do the patchup at the
syscall level for mips' syscall_arch.h, much like how x32 works.

Anyone have strong opinions on how this should be handled?

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.