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:	Tue, 30 Nov 2010 11:51:06 +1300
From:	Ryan Mallon <ryan@...ewatersys.com>
To:	Steven Rostedt <rostedt@...dmis.org>
CC:	pavel@...linux.ru, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Repalce strncmp by memcmp

On 11/30/2010 11:26 AM, Steven Rostedt wrote:
> On Mon, 2010-11-29 at 17:18 -0500, Steven Rostedt wrote:
> 
>> Um, do you realize that the kernel does not always use the same memcmp
>> as gcc.
>>
> 
> Note, I'm not against the change, because in 99% of the cases, memcmp()
> can and will be faster, and we don't need to worry about these strange
> cases.

It can still break things in subtle ways. Lots of the replacements are
of the form:

  if (strncmp(string, "foo", 3) == 0)

Which can only be replaced with memcmp if the minimum length of string
is _always_ 3. This may be true for some callsites (with careful audit),
but in general I doubt it is and it will lead to subtle bugs.

I hardly think it is worth auditing a bunch of strncmp calls to ensure
that the minimum length of the checked string is always n in order to
remove a single instruction. Making such a change will also introduce
subtle bugs if the rules for the string ever change, eg. a change is
made to allow string = "".

~Ryan

-- 
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan@...ewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ