lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a2WhAP7Cj+cgYyFEVVQL-1oSOdS1mcN7=o75u24s09-Uw@mail.gmail.com>
Date:   Tue, 27 Oct 2020 09:46:28 +0100
From:   Arnd Bergmann <arnd@...nel.org>
To:     Rasmus Villemoes <linux@...musvillemoes.dk>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Petr Mladek <pmladek@...e.com>,
        Uwe Kleine-König <uwe@...ine-koenig.org>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] printf: fix Woverride-init warning for EDEADLK errno

On Tue, Oct 27, 2020 at 8:23 AM Rasmus Villemoes
<linux@...musvillemoes.dk> wrote:
> On 26/10/2020 22.49, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@...db.de>
>
> NAK. That would end up using the "EDEADLOCK" string for the value 35 on
> those architectures where they are the same, despite EDEADLK being the
> by far the most used symbol. See the comments and original commit log,
> the placement of these is deliberate.

Ok, I see.

> How about we do this instead?
>
> From: Rasmus Villemoes <linux@...musvillemoes.dk>
>
> The table of errno value->name contains a few duplicate entries since
> e.g. EDEADLK == EDEADLOCK on most architectures. For the known cases,
> the most used symbolic constant is listed last so that takes
> precedence - the idea being that if someone sees "can't do that:
> -EDEADLK" in dmesg, grepping for EDEADLK is more likely to find the
> place where that error was generated (grepping for "can't do that"
> will find the printk() that emitted it, but the source would often be
> a few calls down).
>
> However, that means one gets
>
>   warning: initialized field overwritten [-Woverride-init]
>
> when building with W=1. As the use of multiple initializers for the
> same entry here is quite deliberate, explicitly disable that warning
> for errname.o.
>
> Reported-by: Arnd Bergmann <arnd@...nel.org>
> Fixes: 57f5677e535b ("printf: add support for printing symbolic error
> names")
> Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
> ---
>  lib/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/Makefile b/lib/Makefile
> index ce45af50983a2a5e3582..a98119519e100103818d 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -224,6 +224,7 @@ obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o
>
>  obj-$(CONFIG_DYNAMIC_DEBUG_CORE) += dynamic_debug.o
>  obj-$(CONFIG_SYMBOLIC_ERRNAME) += errname.o
> +CFLAGS_errname.o += $(call cc-disable-warning, override-init)
>

This works, but it conflicts with a different patch series I have, and
it disables a potentially useful warning in case we get another conflict
in this file, so I'd prefer to find a way to avoid the warning rather
than force-disabling it.

How about adding the #ifdef around the EDEADLOCK line
instead of the EDEADLK one? Something like

diff --git a/lib/errname.c b/lib/errname.c
index 0c4d3e66170e..93043fb960cc 100644
--- a/lib/errname.c
+++ b/lib/errname.c
@@ -38,7 +38,10 @@ static const char *names_0[] = {
        E(ECOMM),
        E(ECONNABORTED),
        E(ECONNRESET),
+       E(EDEADLK), /* EDEADLOCK */
+#if EDEADLK != EDEADLOCK /* mips, sparc, powerpc */
        E(EDEADLOCK),
+#endif
        E(EDESTADDRREQ),
        E(EDOM),
        E(EDOTDOT),
@@ -169,7 +172,6 @@ static const char *names_0[] = {
        E(ECANCELED), /* ECANCELLED */
        E(EAGAIN), /* EWOULDBLOCK */
        E(ECONNREFUSED), /* EREFUSED */
-       E(EDEADLK), /* EDEADLOCK */
 };
 #undef E

      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ