Re: [PATCH v2] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 17 Sep 2020 at 07:34, Andreas Schwab <schwab@xxxxxxxxxxxxxx> wrote:
>
> On Sep 17 2020, Arnd Bergmann wrote:
>
> > The errno man page says they are supposed to be synonyms,
> > and glibc defines it that way, while musl uses the numbers
> > from the kernel.
>
> glibc also uses whatever the kernel defines.
>
That's right, and from my investigation this isn't a libc issue. The
various libc flavours simply try to follow POSIX and the PPC ABI and
aren't doing anything wrong.

See errno.h for example (https://man7.org/linux/man-pages/man3/errno.3.html):
  EDEADLK: Resource deadlock avoided (POSIX.1-2001).
  EDEADLOCK: On most architectures, a synonym for EDEADLK.  On some
architectures (e.g., Linux MIPS, PowerPC, SPARC), it is a separate
error code "File locking deadlock error".

The root cause is unique to the Linux PPC code in
arch/powerpc/include/uapi/asm/errno.h:
  >/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  >#ifndef _ASM_POWERPC_ERRNO_H
  >#define _ASM_POWERPC_ERRNO_H
  >
  >#include <asm-generic/errno.h>
  >
  >#undef  EDEADLOCK
  >#define EDEADLOCK       58      /* File locking deadlock error */
  >
  >#endif  /* _ASM_POWERPC_ERRNO_H */

It includes "<asm-generic/errno.h>" to pull in various definitions but
has the side-effect of redefining EDEADLOCK to a non-ABI value which
conflicts with the libc errno.h, as I outline in the patch
description. Other arches which also use different EDEADLOCK and
EDEADLK values (mips,sparc) do not do this. They define EDEADLOCK
*once*, with an ABI-consistent value, and don't have the same issue.

The problem goes back a ways (as Arnd points out), affecting current
stable and all LTS branches, so would be nice to get this sorted out.
I'm certainly interested if there's a better way than proposed in this
patch.

> Andreas.
>
> --
> Andreas Schwab, schwab@xxxxxxxxxxxxxx
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
> "And now for something completely different."



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux