mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: More MIPS stat.h breakage...?
Date: Wed, 16 Jul 2014 00:15:56 -0400	[thread overview]
Message-ID: <20140716041556.GA26058@brightrain.aerifal.cx> (raw)

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


             reply	other threads:[~2014-07-16  4:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-16  4:15 Rich Felker [this message]
2014-07-16 11:40 ` Isaac Dunham
2014-07-16 14:41   ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140716041556.GA26058@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).