Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200907221151.GP3265@brightrain.aerifal.cx>
Date: Mon, 7 Sep 2020 18:11:51 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: riscv32 v2

On Mon, Sep 07, 2020 at 11:58:20PM +0200, Arnd Bergmann wrote:
> On Mon, Sep 7, 2020 at 11:46 PM Rich Felker <dalias@...c.org> wrote:
> > On Mon, Sep 07, 2020 at 11:35:45PM +0200, Arnd Bergmann wrote:
> > > On Mon, Sep 7, 2020 at 8:06 PM Rich Felker <dalias@...c.org> wrote:
> > > > On Mon, Sep 07, 2020 at 06:47:00AM -0400, Stefan O'Rear wrote:
> > >
> > > > > * Copy the IPC_TIME64 bits from arch/arm/bits to trigger the musl code
> > > > >   for fixing time64 IPC_STAT results.  I'm not super happy with this,
> > > > >   maybe there should be a new mechanism in musl for fixing IPC_STAT for
> > > > >   unconditionally-time64 architectures.
> > > >
> > > > If the riscv32 IPC syscalls don't actually provide in-place time64 but
> > > > require translation, I think it's fairly appropriate as-is.
> > > >
> > > > From the definitions in your patch, it looks like all the time fields
> > > > are fixed-word-order (little endian) and possibly not aligned, so it
> > > > seems like they can't be used in-place. Is this correct?
> > >
> > > Yes, rv32 uses the generic system call arguments, which are
> > > unfortunately defined this way. In retrospect I wish I had
> > > replaced the ipc syscalls with a sane version for time64, but at
> > > the time time it seemed as easy way out to use the fields that
> > > had been reserved for this purpose despite the broken
> > > byte order and alignment.
> >
> > Thanks for clarifying. BTW does passing IPC_64 produce an error on
> > rv32? If so, this is another advantage of keeping the IPC_TIME64 bit
> > -- it would catch programs bypassing libc and making the syscalls
> > directly.
> 
> Yes, this is now the generic behavior for the split IPC syscalls

Great!

> (as opposed to sys_ipc on older architectures). The only architectures
> that parse the version in the split ipc syscalls are the ones that
> already had these and were interpreting IPC_64 before linux-5.1:
> alpha, arm32, microblaze, mips-n32, mips-n64, and xtensa.
> 
> There are additional architectures that require passing IPC_64
> in sys_ipc() but reject it in the split syscalls: m68k, mips-o32,
> powerpc, s390, sh, sparc, and x86.

Uhg, good to know. I just re-checked, and at present we don't use the
new split syscalls unless SYS_ipc doesn't exist. musl's arch-specific
IPC_64 definition (0 or 0x100) serves as the value needed for SYS_ipc
if SYS_ipc is defined, and as the value needed for the split syscalls
if SYS_ipc is not defined. So if in the future we want to use the new
ones with fallback to SYS_ipc, we'd need the archs to define the
needed IPC_64 flag separately for each...

As an aside, I should probably cleanup the current definition
framework where IPC_64==0x100 is the default and archs that want 0
have to define it explicitly. It looks like, for the most part, IPC_64
is needed iff SYS_ipc is defined. Of the archs we support, arm
(32-bit) and mips{n32,64} seem to be the only ones that lack SYS_ipc
but need the IPC_64 bit set. Does this agree with your assessment?

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.