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: <CANn89i+5CSw_uWAq8tKAxs7XcrxCGUKD=Yhp+=tdyJO72Yo-uw@mail.gmail.com>
Date: Sun, 11 Jan 2026 11:08:34 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: kernel test robot <lkp@...el.com>, oe-kbuild-all@...ts.linux.dev, 
	linux-kernel@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>, 
	Maciej Żenczykowski <maze@...gle.com>, 
	Will Deacon <will@...nel.org>, "Paul E. McKenney" <paulmck@...nel.org>, 
	Peter Zijlstra <peterz@...radead.org>
Subject: Re: include/net/sock.h:2100:16: sparse: sparse: cast to non-scalar

On Sat, Jan 10, 2026 at 11:34 PM Al Viro <viro@...iv.linux.org.uk> wrote:
>
> On Sat, Jan 10, 2026 at 10:15:09PM +0000, Al Viro wrote:
> > On Sun, Jan 11, 2026 at 05:06:31AM +0800, kernel test robot wrote:
> >
> > Folks, could your bot be taught to recognize that kind of situation?
> > It's very clear what's going on - an inline function that gets the
> > same warning with this config every time it is called.  Commit in
> > question has added several calls of that thing; the origin of warning
> > has nothing whatsoever to do with it, and that can be guessed without
> > even looking at the source - the quoted diff between the logs is quite
> > enough for that.
> >
> > Looking at the function in question,
>
> [accidentally sent halfway through editing, sorry]
>
> e84a4927a404f (Eric Dumazet               2025-06-20 13:30:00 +0000 2097) static inline kuid_t sk_uid(const struct sock *sk)
> e84a4927a404f (Eric Dumazet               2025-06-20 13:30:00 +0000 2098) {
> e84a4927a404f (Eric Dumazet               2025-06-20 13:30:00 +0000 2099)       /* Paired with WRITE_ONCE() in sockfs_setattr() */
> e84a4927a404f (Eric Dumazet               2025-06-20 13:30:00 +0000 2100)       return READ_ONCE(sk->sk_uid);
> e84a4927a404f (Eric Dumazet               2025-06-20 13:30:00 +0000 2101) }
>
> we see that warning in question almost certainly comes from
>         READ_ONCE(some_kuid_t_object)
> and looking at alpha we see this:
> #define __READ_ONCE(x)                                                  \
> ({                                                                      \
>         __unqual_scalar_typeof(x) __x =                                 \
>                 (*(volatile typeof(__x) *)(&(x)));                      \
>         mb();                                                           \
>         (typeof(x))__x;                                                 \
> })
> combined with
> typedef struct {
>         uid_t val;
> } kuid_t;
>
> IOW, it complains about a cast from structure to itself, which is fair
> enough - C is pretty clear about not allowing any typecasts to or from
> non-scalar types, tautological or not.
>
> Why do we even need that cast?  Seeing that generic __READ_ONCE() is
> #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
> the cast added on alpha seems to be pointless.
>
> Folks involved in putting that cast in arch/alpha/include/asm/rwonce.h Cc'd...

I have sent a fix, but got no reply from any alpha users.

https://lists.openwall.net/linux-kernel/2025/11/03/350

My understanding is that this arch is no longer used.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ