[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
Launchpad has imported 11 comments from the remote bug at http://sourceware.org/bugzilla/show_bug.cgi?id=12092. If you reply to an imported comment from within Launchpad, your comment will be sent to the remote bug automatically. Read more about Launchpad's inter-bugtracker facilities at https://help.launchpad.net/InterBugTracking. On 2010-10-05T05:56:48+00:00 Ppluzhnikov-google wrote: Created attachment 5035 what appears to be minimal test case Attached test case fails with glibc-2.11.1 and with current git trunk; passes with glibc-2.7. The failure I see on SSE2 and SSE3 machines is: BUG: 55 vs. 115 The bug does *not* show up on SSE4_2 machines (either 32 or 64-bit mode). Reply at: https://bugs.launchpad.net/eglibc/+bug/655463/comments/0 On 2010-10-05T17:08:33+00:00 Ppluzhnikov-google wrote: Additional analysis from i...@google.com: I'm not completely sure, but this is what I see so far. The bug can only occur when the second argument to strstr (the needle) is periodic, which is to say that it consists entirely of some repeated string. When that happens, the code can fail to match if the first argument to strstr (the haystack) contains two or more repetitions of the needle's periodic string, but not as many as the number of occurrences as are in the needle. In that case strstr can sometimes return a pointer to the smaller number of repetitions, when it should properly return NULL or a later pointer. Also, the needle has to be 32 bytes or more. Reply at: https://bugs.launchpad.net/eglibc/+bug/655463/comments/1 On 2010-10-05T17:36:31+00:00 Ppluzhnikov-google wrote: Created attachment 5037 slightly simplified test case Reply at: https://bugs.launchpad.net/eglibc/+bug/655463/comments/2 On 2010-10-05T18:17:44+00:00 Ian Lance Taylor wrote: I think the problem is the Boyer-Moore shift in two_way_long_needle in str-two-way.h. It does not correctly update MEMORY. I think we need something like if (memory shift period) { /* Since needle is periodic, but the last period has a byte out of place, there can be no match until after the mismatch. */ shift = needle_len - period; memory = 0; } else if (memory shift) memory = memory - shift; else memory = 0; Reply at: https://bugs.launchpad.net/eglibc/+bug/655463/comments/3 On 2010-10-05T18:31:36+00:00 Eric Blake wrote: Yep, resetting 'memory' after a large shift is required; I'm testing your idea now, but think you have the right patch in mind. Reply at: https://bugs.launchpad.net/eglibc/+bug/655463/comments/4 On 2010-10-05T22:10:16+00:00 Eric Blake wrote: Your test for (memory shift) will never be reached. Other than the assignment added by your proposed patch, memory is only ever assigned to be 0 or needle_len - period. And for a periodic needle, shift is either needle_len or period, by virtue of how the shift table is constructed. Therefore, if memory is non-zero but shift = period, then shift is necessarily memory at that point. Which means your code can be reduced to this simpler patch: diff --git i/string/str-two-way.h w/string/str-two-way.h index 502af47..76044b3 100644 --- i/string/str-two-way.h +++ w/string/str-two-way.h @@ -350,8 +350,8 @@ two_way_long_needle (const unsigned char *haystack, a byte out of place, there can be no match until after the mismatch. */ shift = needle_len - period; - memory = 0; } + memory = 0; j += shift; continue; } Reply at: https://bugs.launchpad.net/eglibc/+bug/655463/comments/5 On 2010-10-05T22:23:54+00:00 Eric Blake wrote: Created attachment 5039 fix strstr and memmem Reply at: https://bugs.launchpad.net/eglibc/+bug/655463/comments/6 On 2010-10-05T22:29:09+00:00 Jakub Jelinek wrote: Please add a testcase and post to libc-al...@sources.redhat.com. Reply at: https://bugs.launchpad.net/eglibc/+bug/655463/comments/7 On 2010-10-06T15:43:59+00:00 Eric Blake wrote: Interestingly enough: strstr() and strcasestr() are only broken pre-SSE4, but memmem() is broken even on SSE4 machines. On the other hand, on SSE4 machines, strstr() and strcasestr() are quadratic in behavior; in other
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
This bug was fixed in the package eglibc - 2.11.1-0ubuntu7.4 --- eglibc (2.11.1-0ubuntu7.4) lucid-proposed; urgency=low * Fix issue #12092, strstr broken for some inputs on pre-SSE4 machines. LP: #655463. -- Matthias Klose d...@ubuntu.com Thu, 07 Oct 2010 09:09:06 +0200 ** Changed in: eglibc (Ubuntu Lucid) Status: Fix Committed = Fix Released -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
This bug was fixed in the package eglibc - 2.12.1-0ubuntu7 --- eglibc (2.12.1-0ubuntu7) maverick-proposed; urgency=low * Fix issue #12092, strstr broken for some inputs on pre-SSE4 machines. LP: #655463. -- Matthias Klose d...@ubuntu.com Thu, 07 Oct 2010 09:01:06 +0200 ** Changed in: eglibc (Ubuntu Maverick) Status: Fix Committed = Fix Released -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
** Branch linked: lp:ubuntu/lucid-proposed/eglibc -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
SRU verification for Lucid: I have reproduced the problem with eglibc 2.11.1-0ubuntu7.2 in lucid-updates and have verified that the version of eglibc 2.11.1-0ubuntu7.4 in -proposed fixes the issue. It passes the QRT:scripts/{test-glibc-security.py,test-glibc.py} Tests done on an Intel P4. Marking as verification-done ** Tags added: verification-done ** Tags removed: verification-needed -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
Accepted eglibc into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance! ** Changed in: eglibc (Ubuntu Lucid) Status: In Progress = Fix Committed ** Tags removed: verification-done ** Tags added: verification-needed -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
This bug was fixed in the package eglibc - 2.12.1-0ubuntu7 --- eglibc (2.12.1-0ubuntu7) maverick-proposed; urgency=low * Fix issue #12092, strstr broken for some inputs on pre-SSE4 machines. LP: #655463. -- Matthias Klose d...@ubuntu.com Thu, 07 Oct 2010 09:01:06 +0200 ** Changed in: eglibc (Ubuntu Maverick) Status: Fix Committed = Fix Released -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
This was copied to Natty (not to maverick, LP getting confused) ** Changed in: eglibc (Ubuntu) Status: Fix Committed = Fix Released ** Changed in: eglibc (Ubuntu) Milestone: maverick-updates = None ** Changed in: eglibc (Ubuntu Maverick) Status: Fix Released = Fix Committed -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
SRU verification for Maverick: I have reproduced the problem with eglibc 2.12.1-0ubuntu6 in maverick and have verified that the version of eglibc 2.12.1-0ubuntu7 in -proposed fixes the issue. Test done on an Intel P4. Marking as verification-done ** Tags added: verification-done ** Tags removed: verification-needed -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
Accepted eglibc into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance! ** Changed in: eglibc (Ubuntu Maverick) Status: In Progress = Fix Committed ** Tags added: verification-needed -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
** Branch linked: lp:ubuntu/maverick-proposed/eglibc -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
** Changed in: ubuntu-release-notes Status: New = Won't Fix -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
** Also affects: ubuntu-release-notes Importance: Undecided Status: New ** Changed in: eglibc (Ubuntu Maverick) Status: New = Confirmed ** Changed in: eglibc (Ubuntu Lucid) Status: New = Confirmed ** Changed in: eglibc (Ubuntu Lucid) Importance: Undecided = High ** Changed in: eglibc (Ubuntu Lucid) Milestone: None = lucid-updates ** Changed in: eglibc (Ubuntu Maverick) Importance: Undecided = High ** Changed in: eglibc (Ubuntu Maverick) Milestone: None = maverick-updates -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
** Changed in: eglibc (Ubuntu Lucid) Status: Confirmed = In Progress ** Changed in: eglibc (Ubuntu Maverick) Status: Confirmed = In Progress -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
** Changed in: eglibc (Ubuntu Lucid) Assignee: (unassigned) = Matthias Klose (doko) ** Changed in: eglibc (Ubuntu Maverick) Assignee: (unassigned) = Matthias Klose (doko) -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
** Bug watch added: Sourceware.org Bugzilla #12092 http://sourceware.org/bugzilla/show_bug.cgi?id=12092 ** Also affects: eglibc via http://sourceware.org/bugzilla/show_bug.cgi?id=12092 Importance: Unknown Status: Unknown -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
** Also affects: eglibc (Ubuntu Lucid) Importance: Undecided Status: New ** Also affects: eglibc (Ubuntu Maverick) Importance: Undecided Status: New -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 655463] Re: strstr broken for some inputs on pre-SSE4 machines
** Attachment added: glibc-strstr-test.c https://bugs.launchpad.net/bugs/655463/+attachment/1674371/+files/glibc-strstr-test.c -- strstr broken for some inputs on pre-SSE4 machines https://bugs.launchpad.net/bugs/655463 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs