This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix v9/64-bit strcmp when string ends in multiple zero bytes.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Richard Earnshaw <rearnsha at arm dot com>
- Cc: David Miller <davem at davemloft dot net>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Thu, 01 May 2014 15:42:49 -0400
- Subject: Re: [PATCH] Fix v9/64-bit strcmp when string ends in multiple zero bytes.
- Authentication-results: sourceware.org; auth=none
- References: <20140430 dot 160000 dot 1171411871854680001 dot davem at davemloft dot net> <5361DCC9 dot 1000408 at redhat dot com> <20140501 dot 120509 dot 285884919948146628 dot davem at davemloft dot net> <536275DE dot 7060404 at redhat dot com> <53627C5D dot 9020803 at arm dot com>
On 05/01/2014 12:54 PM, Richard Earnshaw wrote:
> On 01/05/14 17:27, Carlos O'Donell wrote:
>> On 05/01/2014 12:05 PM, David Miller wrote:
>>> From: "Carlos O'Donell" <carlos@redhat.com>
>>> Date: Thu, 01 May 2014 01:34:01 -0400
>>>
>>>> On 04/30/2014 04:00 PM, David Miller wrote:
>>>>> + {
>>>>> + int exp_result;
>>>>> +
>>>>> + for (CHAR val = 0x01; val < 0x10; val++)
>>>>
>>>> Permute over all char values e.g. [0x1,0xff] or val < 0x100;
>>>
>>> I tried that already, just making this change alone causes the test to
>>> take minutes rather then just a few seconds.
>>>
>>> I'll see if I can mitigate the cost and still add the extra coverage.
>>
>> Perhaps not all values, but just values with interesting patterns then?
>>
>> for (CHAR val = 0x01; val < 0x100; val << 1) ?
>>
>> Cheers,
>> Carlos.
>>
>>
>
> I would expect the values that are likely to cause problems will lie
> somewhere in the set {0x00, 0x01, 0x7e, 0x7f, 0x80, 0x81, 0xfe, 0xff},
> given the way zero detection tends to work, plus the fact that standard
> arithmetic is often done with potential for overflow from one byte to
> another.
David's final patch goes through all values from [0x01,0xff], so it
covers all of these cases. Thanks for the review!
Cheers,
Carlos.