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: <09c5a168af144f0f917f5f2f453e309a@AcuMS.aculab.com>
Date:   Wed, 15 Jun 2022 15:52:11 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Alexander Lobakin' <alexandr.lobakin@...el.com>,
        Yury Norov <yury.norov@...il.com>
CC:     Arnd Bergmann <arnd@...db.de>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Mark Rutland <mark.rutland@....com>,
        Matt Turner <mattst88@...il.com>,
        Brian Cain <bcain@...cinc.com>,
        "Geert Uytterhoeven" <geert@...ux-m68k.org>,
        Yoshinori Sato <ysato@...rs.sourceforge.jp>,
        Rich Felker <dalias@...c.org>,
        "David S. Miller" <davem@...emloft.net>,
        Kees Cook <keescook@...omium.org>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Marco Elver <elver@...gle.com>, Borislav Petkov <bp@...e.de>,
        Tony Luck <tony.luck@...el.com>,
        "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
        "linux-alpha@...r.kernel.org" <linux-alpha@...r.kernel.org>,
        "linux-hexagon@...r.kernel.org" <linux-hexagon@...r.kernel.org>,
        "linux-ia64@...r.kernel.org" <linux-ia64@...r.kernel.org>,
        "linux-m68k@...ts.linux-m68k.org" <linux-m68k@...ts.linux-m68k.org>,
        "linux-sh@...r.kernel.org" <linux-sh@...r.kernel.org>,
        "sparclinux@...r.kernel.org" <sparclinux@...r.kernel.org>,
        "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 4/6] bitops: define const_*() versions of the
 non-atomics

From: Alexander Lobakin
> Sent: 15 June 2022 14:55
...
> > > +/**
> > > + * const_test_bit - Determine whether a bit is set
> > > + * @nr: bit number to test
> > > + * @addr: Address to start counting from
> > > + *
> > > + * A version of generic_test_bit() which discards the `volatile` qualifier to
> > > + * allow the compiler to optimize code harder. Non-atomic and to be used only
> > > + * for testing compile-time constants, e.g. from the corresponding macro, or
> > > + * when you really know what you are doing.
> >
> > Not sure I understand the last sentence... Can you please rephrase?
> 
> I basically want to tell that there potentinally might be cases for
> using those outside of the actual macros from 6/6. But it might be
> redundant at all to mention this.

I bet that is a function has:
	long bitmask;
	...
	if (test_bit(&bitmask, 12))
then the 'volatile' forces the compiler to actually write the
value out to memory (stack) instead of doing a register op.

OTOH such code should be using &.

	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