ioctl structs differ from x86_64?

Arnd Bergmann arnd at arndb.de
Thu Mar 16 02:15:46 AEDT 2017


On Tue, Mar 14, 2017 at 11:37 AM, Harshal Patil
<harshal.patil at 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


More information about the Linuxppc-dev mailing list