possible bug in powerpc LE compat syscalls with 64-bit args

Chris Metcalf cmetcalf at mellanox.com
Fri Jun 17 01:36:59 AEST 2016


Adhemerval Zanella is cleaning up the preadv/pwritev implementation in glibc
and came across an issue with the tilepro/tilegx32 implementation of argument
passing for 64-bit arguments in split register pairs.

The glibc code base uses __LONG_LONG_PAIR to split 64-bit arguments,
passing "hi, lo" for BE systems and "lo, hi" for LE systems.  Tile is almost uniformly
LE, but we do support BE for specific customers.  The 32-bit compat mode on
tilegx was getting passed "hi, lo" arguments by glibc but looking for them to
be "lo, hi" arguments on the kernel side.  I fixed this here:

https://lkml.kernel.org/g/1466019219-10462-1-git-send-email-cmetcalf@mellanox.com

Reviewing what other platforms do, it seems like powerpc compat mode may
have the opposite problem in little-endian mode, since arguments are passed
in "hi, lo" order unconditionally in arch/powerpc/kernel/sys_ppc32.c.  You may
want to adopt the solution in the patch cited above, or similar solutions
elsewhere, eg regs_to_64 in arch/arm64/include/asm/assembler.h, or
merge_64 in arch/mips/kernel/linux32.c.

Here's the email thread from libc-alpha:

https://sourceware.org/ml/libc-alpha/2016-06/msg00638.html

-- 
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com



More information about the Linuxppc-dev mailing list