All of lore.kernel.org
 help / color / mirror / Atom feed
* ioctl structs differ from x86_64?
@ 2017-03-14 10:37 Harshal Patil
  2017-03-15 15:15 ` Arnd Bergmann
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Harshal Patil @ 2017-03-14 10:37 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Sudipto Ghosh

[-- Attachment #1: Type: text/html, Size: 2659 bytes --]

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

* Re: ioctl structs differ from x86_64?
  2017-03-14 10:37 ioctl structs differ from x86_64? Harshal Patil
@ 2017-03-15 15:15 ` Arnd Bergmann
  2017-03-15 18:11 ` Reza Arbab
  2017-03-16 10:49 ` Michael Ellerman
  2 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2017-03-15 15:15 UTC (permalink / raw)
  To: Harshal Patil; +Cc: linuxppc-dev, Sudipto Ghosh

On Tue, Mar 14, 2017 at 11:37 AM, Harshal Patil
<harshal.patil@in.ibm.com> wrote:
> Hello,
>
> I am looking into a bug,
> https://bugzilla.linux.ibm.com/show_bug.cgi?id=152493 ( external mirror is
> at, https://github.com/opencontainers/runc/issues/1364)
>
> Recently in runc code, they added this code
> https://github.com/opencontainers/runc/commit/eea28f480db435dbef4a275de9776b9934818b8c#diff-5f5c07d0cab3ce2086437d3d43c0d25fR155.
> As you can see they set -onlcr to get rid of \r (line no. 164). Golang, in
> which runc is written, doesn't have any bindings for ioctls.  This means you
> have to invoke C code directly (that's what they are doing there).
>
> Our guess is the ioctls in ppc64le differ than x86_64, and thats why the
> code which is clearing onclr bit
> (https://github.com/opencontainers/runc/commit/eea28f480db435dbef4a275de9776b9934818b8c#diff-5f5c07d0cab3ce2086437d3d43c0d25fR164)
> is failing on ppc64le but works fine on x86_64.
>
> Any pointers on the possible solution would be really helpful.

There are a couple of reasons for ioctl numbers to differ:

- like this one, the command number may be defined in asm/ioctls.h.
Most architectures
  in the kernel are the same, some (arm, blackfin, frv, m68k, and
s390) only differ
  in FIOQSIZE, others (alpha, mips, parisc, powerpc, sh, sparc, and
xtensa) redefine
  all the traditional file (FIO*) and tty (TC*, TIO*) commands

- command numbers that are defined in terms of structure sizes depend on the
  architectures type definitions (e.g. long, off_t, uid_t, ...) that
can differ in both
  size and alignment

- alpha, mips, powerpc and sparc use _IOC_SIZEBITS==13, everything else uses
  _IOC_SIZEBITS==14, and that in turn means that the majority of ioctl commands
  are different between those four and the rest.

      Arnd

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

* Re: ioctl structs differ from x86_64?
  2017-03-14 10:37 ioctl structs differ from x86_64? Harshal Patil
  2017-03-15 15:15 ` Arnd Bergmann
@ 2017-03-15 18:11 ` Reza Arbab
  2017-03-15 18:27   ` Reza Arbab
  2017-03-16 10:49 ` Michael Ellerman
  2 siblings, 1 reply; 7+ messages in thread
From: Reza Arbab @ 2017-03-15 18:11 UTC (permalink / raw)
  To: Harshal Patil
  Cc: linuxppc-dev, Sudipto Ghosh, Christy L Norman Perez, Pradipta Kumar

On Tue, Mar 14, 2017 at 10:37:44AM +0000, Harshal Patil wrote:
>Our guess is the ioctls in ppc64le differ than x86_64, and thats why 
>the code which is clearing onclr bit 
>([4]https://github.com/opencontainers/runc/commit/eea28f480db435dbef4a275de9776b9934818b8c#diff-5f5c07d0cab3ce2086437d3d43c0d25fR164)
>is failing on ppc64le but works fine on x86_64. 
> 
>Any pointers on the possible solution would be really helpful. 

This looks like a bug in Go.

The syscall.TCGETS and syscall.TCSETS constants have the wrong values. 
They were generated using the glibc termios struct instead of the kernel 
termios struct. It's the issue described here:

https://groups.google.com/forum/#!topic/golang-nuts/K5NoG8slez0

Things work if you replace syscall.TCGETS with 0x402c7413 and 
syscall.TCSETS with 0x802c7414, the correct values on ppc64le.

-- 
Reza Arbab

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

* Re: ioctl structs differ from x86_64?
  2017-03-15 18:11 ` Reza Arbab
@ 2017-03-15 18:27   ` Reza Arbab
  0 siblings, 0 replies; 7+ messages in thread
From: Reza Arbab @ 2017-03-15 18:27 UTC (permalink / raw)
  To: Harshal Patil
  Cc: linuxppc-dev, Sudipto Ghosh, Christy L Norman Perez, Pradipta Kumar

On Wed, Mar 15, 2017 at 01:11:19PM -0500, Reza Arbab wrote:
>https://groups.google.com/forum/#!topic/golang-nuts/K5NoG8slez0

Oops.

https://groups.google.com/d/msg/golang-nuts/K5NoG8slez0/mixUse17iaMJ

-- 
Reza Arbab

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

* Re: ioctl structs differ from x86_64?
  2017-03-14 10:37 ioctl structs differ from x86_64? Harshal Patil
  2017-03-15 15:15 ` Arnd Bergmann
  2017-03-15 18:11 ` Reza Arbab
@ 2017-03-16 10:49 ` Michael Ellerman
  2 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2017-03-16 10:49 UTC (permalink / raw)
  To: Harshal Patil, linuxppc-dev; +Cc: Sudipto Ghosh

Harshal Patil <harshal.patil@in.ibm.com> writes:

> Hello,
> I am looking into a bug, https://bugzilla.linux.ibm.com/show_bug.cgi?id=152493
> ( external mirror is at, https://github.com/opencontainers/runc/issues/1364) 
> Recently in runc code, they added this code
> https://github.com/opencontainers/runc/commit/eea28f480db435dbef4a275de9776b9934818b8c#diff-5f5c07d0cab3ce2086437d3d43c0d25fR155.
> As you can see they set -onlcr to get rid of \r (line no. 164). Golang, in which
> runc is written, doesn't have any bindings for ioctls. This means you have to
> invoke C code directly (that's what they are doing there).
> Our guess is the ioctls in ppc64le differ than x86_64, and thats why the code
> which is clearing onclr bit
> (https://github.com/opencontainers/runc/commit/eea28f480db435dbef4a275de9776b9934818b8c#diff-5f5c07d0cab3ce2086437d3d43c0d25fR164)
> is failing on ppc64le but works fine on x86_64. 

I think you've probably got enough replies, but the short answer is
"yes", IOCTL numbers do differ across architectures - including
potentially between 32-bit and 64-bit.

cheers

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

* Re: ioctl structs differ from x86_64?
       [not found] <OF8A8205F0.34AB5FF3-ON002580E3.00393B30-002580E3.003A62F5@LocalDomain>
  2017-03-14 10:57 ` Harshal Patil
@ 2017-03-14 10:59 ` Harshal Patil
  1 sibling, 0 replies; 7+ messages in thread
From: Harshal Patil @ 2017-03-14 10:59 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Sudipto Ghosh, Pradipta Kumar, Christy L Norman Perez

[-- Attachment #1: Type: text/html, Size: 4026 bytes --]

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

* Re: ioctl structs differ from x86_64?
       [not found] <OF8A8205F0.34AB5FF3-ON002580E3.00393B30-002580E3.003A62F5@LocalDomain>
@ 2017-03-14 10:57 ` Harshal Patil
  2017-03-14 10:59 ` Harshal Patil
  1 sibling, 0 replies; 7+ messages in thread
From: Harshal Patil @ 2017-03-14 10:57 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Christy L Norman Perez, Sudipto Ghosh, Pradipta Kumar

[-- Attachment #1: Type: text/html, Size: 160 bytes --]

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

end of thread, other threads:[~2017-03-16 10:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-14 10:37 ioctl structs differ from x86_64? Harshal Patil
2017-03-15 15:15 ` Arnd Bergmann
2017-03-15 18:11 ` Reza Arbab
2017-03-15 18:27   ` Reza Arbab
2017-03-16 10:49 ` Michael Ellerman
     [not found] <OF8A8205F0.34AB5FF3-ON002580E3.00393B30-002580E3.003A62F5@LocalDomain>
2017-03-14 10:57 ` Harshal Patil
2017-03-14 10:59 ` Harshal Patil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.