[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPGftE__Mh2Fp_v=Vhm3cQ1PHNFETMsXET6raTpLav-BbVQvbw@mail.gmail.com>
Date: Fri, 18 Sep 2020 21:15:50 -0700
From: Tony Ambardar <tony.ambardar@...il.com>
To: Andreas Schwab <schwab@...ux-m68k.org>
Cc: Arnd Bergmann <arnd@...db.de>,
Michael Ellerman <mpe@...erman.id.au>,
linux-arch <linux-arch@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Paul Mackerras <paulus@...ba.org>,
Rosen Penev <rosenp@...il.com>, bpf <bpf@...r.kernel.org>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH v2] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h
On Thu, 17 Sep 2020 at 07:34, Andreas Schwab <schwab@...ux-m68k.org> 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@...ux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
Powered by blists - more mailing lists