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: <1c1c54c4-efd9-e3da-022f-3396471d72d2@roeck-us.net>
Date:   Wed, 8 Sep 2021 06:54:10 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Al Viro <viro@...iv.linux.org.uk>
Cc:     Arnd Bergmann <arnd@...nel.org>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        "David S. Miller" <davem@...emloft.net>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Christian Koenig <christian.koenig@....com>,
        Huang Rui <ray.huang@....com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-sparc <sparclinux@...r.kernel.org>,
        Martin Sebor <msebor@....gnu.org>
Subject: Re: [PATCH] Enable '-Werror' by default for all kernel builds

On 9/8/21 6:19 AM, Al Viro wrote:
> On Wed, Sep 08, 2021 at 05:42:30AM -0700, Guenter Roeck wrote:
> 
>> Oddly enough, a memcpy on the 'rtc' variable doesn't fail,
>> neither with nor without volatile. Something else is going on.
> 
> While we are at it, would memcpy_fromio() complain?  Seeing that
> this is what's really intended there...
> 

It doesn't make a difference on m68k.

#define memcpy_fromio memcpy_fromio
static inline void memcpy_fromio(void *dst, const volatile void __iomem *src,
                                  int count)
{
         __builtin_memcpy(dst, (void __force *) src, count);
}

It boils down to the use of __builtin_memcpy(). m68k implements its own version
of memcpy(). If that is used, everything works fine. However, if a file includes
<linux/string.h>, memcpy is replaced with __builtin_memcpy:

#define __HAVE_ARCH_MEMCPY
extern void *memcpy(void *, const void *, __kernel_size_t);
#define memcpy(d, s, n) __builtin_memcpy(d, s, n)

and the compilation fails.

That also explains why only some architectures/files are affected.
Presumably those are the architectures which use __builtin_memcpy().

Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ