From: Tony Ambardar <tony.ambardar@gmail.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: linux-arch <linux-arch@vger.kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Rosen Penev <rosenp@gmail.com>, Paul Mackerras <paulus@samba.org>,
bpf <bpf@vger.kernel.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH v2] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h
Date: Fri, 18 Sep 2020 21:15:50 -0700 [thread overview]
Message-ID: <CAPGftE__Mh2Fp_v=Vhm3cQ1PHNFETMsXET6raTpLav-BbVQvbw@mail.gmail.com> (raw)
In-Reply-To: <87h7rw321o.fsf@igel.home>
On Thu, 17 Sep 2020 at 07:34, Andreas Schwab <schwab@linux-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@linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
next prev parent reply other threads:[~2020-09-19 4:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 7:42 [PATCH v1] powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h Tony Ambardar
2020-09-17 0:07 ` [PATCH v2] " Tony Ambardar
2020-09-17 11:55 ` Michael Ellerman
2020-09-17 13:42 ` Tony Ambardar
2020-09-17 14:01 ` Arnd Bergmann
[not found] ` <CAK8P3a3FVoDzNb1TOA6cRQDdEc+st7KkBL70t0FeStEziQG4+A__37056.5000850306$1600351707$gmane$org@mail.gmail.com>
2020-09-17 14:34 ` Andreas Schwab
2020-09-19 4:15 ` Tony Ambardar [this message]
2020-09-17 13:54 ` [PATCH v3] " Tony Ambardar
[not found] ` <20200921125452.32E0E21D7A@mail.kernel.org>
2020-09-22 8:38 ` Tony Ambardar
2021-04-16 4:34 ` Tony Ambardar
2021-04-16 10:41 ` Michael Ellerman
2021-04-17 1:00 ` Tony Ambardar
2021-04-19 4:00 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPGftE__Mh2Fp_v=Vhm3cQ1PHNFETMsXET6raTpLav-BbVQvbw@mail.gmail.com' \
--to=tony.ambardar@gmail.com \
--cc=arnd@arndb.de \
--cc=bpf@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
--cc=rosenp@gmail.com \
--cc=schwab@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).