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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 28 Oct 2020 00:34:10 +0100
From:   Arnd Bergmann <arnd@...nel.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
        "Ahmed S. Darwish" <a.darwish@...utronix.de>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Marco Elver <elver@...gle.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] seqlock: avoid -Wshadow warnings

On Mon, Oct 26, 2020 at 5:58 PM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Mon, Oct 26, 2020 at 05:50:38PM +0100, Arnd Bergmann wrote:
>
> > -     unsigned seq;                                                   \
> > +     unsigned __seq;                                                 \
>
> > -     unsigned seq = __read_seqcount_begin(s);                        \
> > +     unsigned _seq = __read_seqcount_begin(s);                       \
>
> > -     unsigned seq = __seqcount_sequence(s);                          \
> > +     unsigned __seq = __seqcount_sequence(s);                        \
>
> Can we have a consistent number of leading '_' ?

Not really ;-)

The warning comes from raw_read_seqcount_begin() calling
__read_seqcount_begin() and both using the same variable
name. I could rename one of them  and use double-underscores
for both, but I haven't come up with a good alternative name
that wouldn't make it less consistent in the process.

> Also, I suppose you're going to find the explicit shadow in
> ___wait_event(), that one's not going to be trivial to fix.

I have this patch in my tree at the moment but did not send that yet
because that caused a regression on powerpc:

diff --git a/include/linux/wait.h b/include/linux/wait.h
index 57ccf26d3b96..5d00a6fb7154 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -265,7 +265,11 @@ extern void init_wait_entry(struct
wait_queue_entry *wq_entry, int flags);
 ({
         \
        __label__ __out;
         \
        struct wait_queue_entry __wq_entry;
         \
-       long __ret = ret;       /* explicit shadow */
         \
+       __diag_push()
         \
+       __diag_ignore(GCC, 8, "-Wshadow", "explicit shadow")
         \
+       __diag_ignore(CLANG, 9, "-Wshadow", "explicit shadow")
         \
+       long __ret = ret;
         \
+       __diag_pop();
         \

         \
        init_wait_entry(&__wq_entry, exclusive ? WQ_FLAG_EXCLUSIVE :
0);        \
        for (;;) {
         \


Still looking at alternative approaches.

      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ