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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 30 Aug 2019 15:39:31 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Josh Poimboeuf' <jpoimboe@...hat.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>
CC:     Arnd Bergmann <arnd@...db.de>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Ilie Halip <ilie.halip@...il.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        clang-built-linux <clang-built-linux@...glegroups.com>,
        Peter Zijlstra <peterz@...radead.org>,
        "Paul E. McKenney" <paulmck@...ux.ibm.com>
Subject: RE: objtool warning "uses BP as a scratch register" with clang-9

From: Josh Poimboeuf
> Sent: 30 August 2019 16:02
> On Thu, Aug 29, 2019 at 03:26:30PM -0700, Linus Torvalds wrote:
> > On Thu, Aug 29, 2019 at 1:22 PM Arnd Bergmann <arnd@...db.de> wrote:
> > >
> > > Maybe we can just pass -fno-builtin-memcpy -fno-builtin-memset
> > > for clang when CONFIG_KASAN is set and hope for the best?
> >
> > I really hate how that disables conversions both ways, which is kind
> > of pointless and wrong.  It's really just "we don't want surprising
> > memcpy calls for single writes".
> >
> > Disabling all the *good* "optimize memset/memcpy" cases is really sad.
> >
> > We actually have a lot of small structures in the kernel on purpose
> > (often for type safety), and I bet we use memcpy on them on purpose at
> > times. I'd hate to see that become a function call rather than "copy
> > two words by hand".
> >
> > Even for KASAN.
> >
> > And I guess that when the compiler sees 20+ "set to zero" it's quite
> > reasonable to say "just turn it into a memset".
> 
> For KASAN, the Clang threshold for inserting memset() is *2* consecutive
> writes instead of 17.  Isn't that likely to cause tearing-related
> surprises?

Hmmm... I don't think I'd ever want a compiler to convert a sequence
of zero writes into a memset.

It is as bad as a certain compiler converting:
	for (i = 0; i < n; i++)
		tgt[i] = src[i];
into a 'rep movs' instruction.
Inlining memcpy() as 'rep movs' is one thing, the opposite is wrong.

	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