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]
Date:   Wed, 8 Sep 2021 14:47:52 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Arnd Bergmann' <arnd@...nel.org>,
        Geert Uytterhoeven <geert@...ux-m68k.org>
CC:     Guenter Roeck <linux@...ck-us.net>,
        Al Viro <viro@...iv.linux.org.uk>,
        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

From: Arnd Bergmann
> Sent: 08 September 2021 10:50
...
> > > I don't know the hardware, so I can not answer the ioremap() question.
> >
> > Yes it should.  But this driver dates back to 2.1.110, when only
> > half of the architectures already had ioremap().
> 
> How does  mvme16x even create the mapping? Is this a virtual address
> that is hardwired to the bus or do you have a static mapping somewhere?
> I see two other drivers accessing the nvram here
> 
> arch/m68k/mvme16x/config.c:static MK48T08ptr_t volatile rtc = (MK48T08ptr_t)MVME_RTC_BASE;
> arch/m68k/mvme16x/rtc.c:        volatile MK48T08ptr_t rtc = (MK48T08ptr_t)MVME_RTC_BASE;
> 
> The same trick should work here, just create a local variable with a
> volatile pointer and read from that.

Or define a C 'extern' for the actual data and get the linker script
to assign a fixed value to the symbol.
(Although that does pollute the global namespace.)

An alternative is to use an asm statement so the compiler
cannot track the actual value.
Something like:

#define launder(x) asm volatile( "" : "+r" (x))

	MK48T08ptr_t rtc = (void *)MVME_RTC_BASE;
	launder(rtc);

That also works a bit like READ_ONCE() except that is works
on a value that is (hopefully) already in a register rather
that during the read from memory.
Useful when the compiler's 'value tracking' pessimises 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