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] [day] [month] [year] [list]
Message-ID: <bb831fbad4f74e11b868d936f7616d1a@AcuMS.aculab.com>
Date:   Tue, 27 Jul 2021 08:44:21 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Sven Eckelmann' <sven@...fation.org>,
        Arnd Bergmann <arnd@...db.de>
CC:     "b.a.t.m.a.n@...ts.open-mesh.org" <b.a.t.m.a.n@...ts.open-mesh.org>,
        "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] asm-generic: avoid sparse {get,put}_unaligned warning

From: Sven Eckelmann
> Sent: 24 July 2021 17:24
> 
> Sparse will try to check casting of simple integer types which are marked
> as __bitwise. This for example "disallows" simple casting of __be{16,32,64}
> or __le{16,32,64} to other types. This is also true for pointers to
> variables with this type.
> 
> But the new generic {get,put}_unaligned is doing that by (reinterpret)
> casting the original pointer to a new (anonymous) struct pointer. This will
> then create warnings like:
> 
>   net/batman-adv/distributed-arp-table.c:1461:19: warning: cast from restricted __be32 *
>   net/batman-adv/distributed-arp-table.c:1510:23: warning: cast from restricted __be32 [usertype]
> *[assigned] magic
>   net/batman-adv/distributed-arp-table.c:1588:24: warning: cast from restricted __be32 [usertype]
> *[assigned] yiaddr
> 
> The special attribute force must be used in such statements when the cast
> is known to be safe to avoid these warnings.

At least the __force is being added to an existing cast.

The real problems are when a (__force __le32)value cast is used
to silence sparse.
These should really be something like:
	__tell_sparce(__le32, value)
so that the whole thing can be removed by the preprocessor when
compiling the code.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ