mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: broken __kernel_mode_t affecting some big endian archs
Date: Thu, 14 Jun 2018 10:20:45 -0400	[thread overview]
Message-ID: <20180614142045.GL1392@brightrain.aerifal.cx> (raw)
In-Reply-To: <20180614131931.1a7a768a@ncopa-desktop.copa.dup.pw>

On Thu, Jun 14, 2018 at 01:19:31PM +0200, Natanael Copa wrote:
> On Wed, 13 Jun 2018 20:54:42 -0400
> Rich Felker <dalias@libc.org> wrote:
> 
> > It's been semi-known for a long time (I say semi-, because nobody's
> > had the setup to test most of them well, or at least nobody I'm
> > communicating with regularly) that some archs are failing libc-test
> > sysvipc tests. I think I've tracked down the root cause.
> > 
> > Linux defined __kernel_mode_t as short on some old archs, and used it
> > in place of mode_t in the ipc_perm structure. The field is padded out
> > to 32 bits, so on little endian archs it's no problem for us to just
> > (as we do) ignore the incorrect type and declare the structure with
> > mode_t, as POSIX requires. However on big-endian archs, the padding is
> > on the wrong side and this trick doesn't work.
> > 
> > On MIPS we fixed a similar issue in struct stat, where dev_t was
> > incorrectly padded, with a fixup in syscall_arch.h. However this time
> > a large number of archs are affected, and patching them all up
> > individually seems nasty.
> > 
> > My leaning is to have syscall_arch.h expose a macro indicating the
> > bug, and have msgctl, semctl, and shmctl each do the fixup if it's
> > set.
> > 
> > FWIW the affected archs seem to be (only in big endian variants):
> > - ARM
> > - M68k (in-progress port)
> > - Microblaze
> > - SH
> > - Sparc (future port)
> 
> Is s390s affected too?

Presumably you mean s390x, and it's not affected -- the bad (short)
definition of __kernel_mode_t is contingent on 32-bit s390 in the s390
version of asm/posix_types.h. This seems to be a pattern across
several archs with 32/64 bit variants, and there doesn't seem to be
any explanation for why it should be except possibly that, when adding
the 64-bit variant, somebody noticed the awful legacy __kernel_mode_t
definition and thought to fix it...

Rich


  reply	other threads:[~2018-06-14 14:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-14  0:54 Rich Felker
2018-06-14 11:19 ` Natanael Copa
2018-06-14 14:20   ` Rich Felker [this message]
2018-06-15  2:00 ` Rich Felker
2018-06-15  2:01   ` Rich Felker
2018-06-16  0:14     ` Szabolcs Nagy

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=20180614142045.GL1392@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).