linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* possible bug in powerpc LE compat syscalls with 64-bit args
@ 2016-06-16 15:36 Chris Metcalf
  2016-06-16 15:56 ` Adhemerval Zanella
  2016-06-17  1:52 ` Michael Ellerman
  0 siblings, 2 replies; 5+ messages in thread
From: Chris Metcalf @ 2016-06-16 15:36 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	linuxppc-dev, Adhemerval Zanella, Mike Frysinger

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: possible bug in powerpc LE compat syscalls with 64-bit args
  2016-06-16 15:36 possible bug in powerpc LE compat syscalls with 64-bit args Chris Metcalf
@ 2016-06-16 15:56 ` Adhemerval Zanella
  2016-06-17  1:52 ` Michael Ellerman
  1 sibling, 0 replies; 5+ messages in thread
From: Adhemerval Zanella @ 2016-06-16 15:56 UTC (permalink / raw)
  To: Chris Metcalf, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, linuxppc-dev, Mike Frysinger



On 16/06/2016 12:36, Chris Metcalf wrote:
> 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
> 

I am not fully familiar with kernel policy regarding ABI so is this considered
an ABI breakage or a real defect?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: possible bug in powerpc LE compat syscalls with 64-bit args
       [not found] <28c367c1-0f60-cd1d-b443-d3876798a627__12262.0927206755$1466112970$gmane$org@mellanox.com>
@ 2016-06-16 21:42 ` Andreas Schwab
  2016-06-17 20:46   ` Chris Metcalf
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2016-06-16 21:42 UTC (permalink / raw)
  To: Chris Metcalf
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	linuxppc-dev, Adhemerval Zanella, Mike Frysinger

Chris Metcalf <cmetcalf@mellanox.com> writes:

> 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.

PPC32 is always big-endian.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: possible bug in powerpc LE compat syscalls with 64-bit args
  2016-06-16 15:36 possible bug in powerpc LE compat syscalls with 64-bit args Chris Metcalf
  2016-06-16 15:56 ` Adhemerval Zanella
@ 2016-06-17  1:52 ` Michael Ellerman
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2016-06-17  1:52 UTC (permalink / raw)
  To: Chris Metcalf, Benjamin Herrenschmidt, Paul Mackerras,
	linuxppc-dev, Adhemerval Zanella, Mike Frysinger

On Thu, 2016-06-16 at 11:36 -0400, Chris Metcalf wrote:

> 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.

We don't support compat mode on ppc64le. So I think we're OK?

Thanks for letting us know.

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: possible bug in powerpc LE compat syscalls with 64-bit args
  2016-06-16 21:42 ` Andreas Schwab
@ 2016-06-17 20:46   ` Chris Metcalf
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Metcalf @ 2016-06-17 20:46 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	linuxppc-dev, Adhemerval Zanella, Mike Frysinger

On 6/16/2016 5:42 PM, Andreas Schwab wrote:
> Chris Metcalf <cmetcalf@mellanox.com> writes:
>
>> 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.
> PPC32 is always big-endian.

Sounds good then.

Commit 422b9b9684db ("powerpc/compat: 32-bit little endian machine
name is ppcle, not ppc") made me think there was support for a
little-endian 32-bit mode.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-17 20:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-16 15:36 possible bug in powerpc LE compat syscalls with 64-bit args Chris Metcalf
2016-06-16 15:56 ` Adhemerval Zanella
2016-06-17  1:52 ` Michael Ellerman
     [not found] <28c367c1-0f60-cd1d-b443-d3876798a627__12262.0927206755$1466112970$gmane$org@mellanox.com>
2016-06-16 21:42 ` Andreas Schwab
2016-06-17 20:46   ` Chris Metcalf

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).