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]
Date: Sun, 5 May 2024 13:38:48 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Kees Cook' <keescook@...omium.org>, Andy Shevchenko
	<andy.shevchenko@...il.com>
CC: Hsin-Yu.Chen <harry021633@...il.com>, "andy@...nel.org" <andy@...nel.org>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 2/2] string: improve strlen performance

From: Kees Cook
> Sent: 02 May 2024 16:11
> 
> On Thu, May 02, 2024 at 06:03:04PM +0300, Andy Shevchenko wrote:
> > On Thu, May 2, 2024 at 5:59 PM Andy Shevchenko
> > <andy.shevchenko@...il.com> wrote:
> > > On Thu, May 2, 2024 at 5:14 PM Hsin-Yu.Chen <harry021633@...il.com> wrote:
> >
> > And on top of that, check what this code will do on the architectures
> > that do not support unaligned access. If everything is fine, mention
> > this in the commit message. Btw, your commit message needs
> > elaboration, e.g., pointing to the test case (which is absent in this
> > patch, I assume it's already in the kernel?) and step-by-step
> > instructions on how you got the mentioned results with details of the
> > hardware you used for that.
> 
> I might be worth looking at the implementation of strscpy(), which is
> doing similar multi-byte steps and handles unaligned access.

And x86 really doesn't care about unaligned accesses (for normal registers).
But it is important to not accidentally run off the end of a page.

There is also the whole question of the typical string length.
For short strings you've already lost by the time you've aligned
the address.

On 32bit the whole bit-twiddling may not be worth it at all.

	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