[Bug 2001975] Re: overflow bug in wcsncmp_avx2

Bug Watch Updater 2001975 at bugs.launchpad.net
Thu Jun 8 22:12:39 UTC 2023


Launchpad has imported 20 comments from the remote bug at
https://sourceware.org/bugzilla/show_bug.cgi?id=28755.

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 2022-01-09T10:30:11+00:00 Goldstein-w-n wrote:

Similiar to [BZ
27974](https://sourceware.org/bugzilla/show_bug.cgi?id=27974). The
multiply of length by sizeof (wchar_t) can overflow if length is >= 2^62
which can lead to incorrect results.

For example:

#include <wchar.h>
int
main(int argc, char ** argv) {
    assert(__wcsncmp_evex(L"abc", L"abd", (1UL << 62)) != 0);
    assert(__wcsncmp_avx2(L"abc", L"abd", (1UL << 62)) != 0);
}

Will fail on either assert.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/0

------------------------------------------------------------------------
On 2022-01-10T00:29:51+00:00 Goldstein-w-n wrote:

Fix proposed in the following patches:

avx2: https://patchwork.sourceware.org/project/glibc/patch/20220110002746.3653516-1-goldstein.w.n@gmail.com/
evex: https://patchwork.sourceware.org/project/glibc/patch/20220110002746.3653516-2-goldstein.w.n@gmail.com/

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/1

------------------------------------------------------------------------
On 2022-01-11T03:07:10+00:00 Goldstein-w-n wrote:

Fixed in

commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date:   Sun Jan 9 16:02:21 2022 -0600

    x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]


and 


commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date:   Sun Jan 9 16:02:28 2022 -0600

    x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/2

------------------------------------------------------------------------
On 2022-01-27T04:24:21+00:00 Cvs-commit wrote:

The release/2.34/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=72123e1b56f53f9205bb105f8a62d0869b837b22

commit 72123e1b56f53f9205bb105f8a62d0869b837b22
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Wed Jan 26 20:20:43 2022 -0800

    NEWS: Add a bug entry for BZ #28755

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/3

------------------------------------------------------------------------
On 2022-01-27T04:58:21+00:00 Cvs-commit wrote:

The release/2.33/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=86c153d0922a6da3263f0ade42573bd405d8edee

commit 86c153d0922a6da3263f0ade42573bd405d8edee
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Wed Jan 26 20:28:51 2022 -0800

    NEWS: Add a bug fix entry for BZ #28755

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/4

------------------------------------------------------------------------
On 2022-01-27T13:14:16+00:00 Cvs-commit wrote:

The release/2.32/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=40eebb02ccbc2d621e796795d5994fe7483b679f

commit 40eebb02ccbc2d621e796795d5994fe7483b679f
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Wed Jan 26 21:00:25 2022 -0800

    NEWS: Add a bug fix entry for BZ #28755

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/5

------------------------------------------------------------------------
On 2022-01-27T13:29:52+00:00 Cvs-commit wrote:

The release/2.31/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5b136510856f3742b58eb5e2de0cada7e9e95630

commit 5b136510856f3742b58eb5e2de0cada7e9e95630
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Jan 27 05:16:30 2022 -0800

    NEWS: Add a bug fix entry for BZ #28755

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/6

------------------------------------------------------------------------
On 2022-01-27T13:33:11+00:00 Cvs-commit wrote:

The release/2.30/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9d868841f870c22c05e5ce11900afc9abd8fda02

commit 9d868841f870c22c05e5ce11900afc9abd8fda02
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Jan 27 05:31:02 2022 -0800

    NEWS: Add a bug fix entry for BZ #28755

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/7

------------------------------------------------------------------------
On 2022-01-27T15:28:52+00:00 Cvs-commit wrote:

The release/2.29/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2f3fb944b311b67e609ed79478cc1737f6066af9

commit 2f3fb944b311b67e609ed79478cc1737f6066af9
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Jan 27 05:34:02 2022 -0800

    NEWS: Add a bug fix entry for BZ #28755

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/8

------------------------------------------------------------------------
On 2022-01-27T16:12:47+00:00 Cvs-commit wrote:

The release/2.28/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=43c27a754bd417726032006d0a564d946994554e

commit 43c27a754bd417726032006d0a564d946994554e
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Jan 27 07:30:10 2022 -0800

    NEWS: Add a bug fix entry for BZ #28755

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/9

------------------------------------------------------------------------
On 2022-01-27T16:14:25+00:00 Hjl-tools wrote:

Fixed for 2.35 and all release branches.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/10

------------------------------------------------------------------------
On 2022-02-17T19:04:57+00:00 Cvs-commit wrote:

The master branch has been updated by H.J. Lu <hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=aa5a720056d37cf24924c138a3dbe6dace98e97c

commit aa5a720056d37cf24924c138a3dbe6dace98e97c
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Feb 17 08:10:35 2022 -0800

    string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755]
    
    Verify that wcsncmp (L("abc"), L("abd"), SIZE_MAX) == 0.  The new test
    fails without
    
    commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:21 2022 -0600
    
        x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
    
    and
    
    commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:28 2022 -0600
    
        x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
    
    This is for BZ #28755.
    
    Reviewed-by: Sunil K Pandey <skpgkp2 at gmail.com>

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/11

------------------------------------------------------------------------
On 2022-02-17T19:14:13+00:00 Cvs-commit wrote:

The release/2.35/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a30807b7db924d31681e9c6e98e78f2f46a2640c

commit a30807b7db924d31681e9c6e98e78f2f46a2640c
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Feb 17 08:10:35 2022 -0800

    string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755]
    
    Verify that wcsncmp (L("abc"), L("abd"), SIZE_MAX) == 0.  The new test
    fails without
    
    commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:21 2022 -0600
    
        x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
    
    and
    
    commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:28 2022 -0600
    
        x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
    
    This is for BZ #28755.
    
    Reviewed-by: Sunil K Pandey <skpgkp2 at gmail.com>
    
    (cherry picked from commit aa5a720056d37cf24924c138a3dbe6dace98e97c)

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/12

------------------------------------------------------------------------
On 2022-02-17T19:22:33+00:00 Cvs-commit wrote:

The release/2.34/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=04d60ce0f21ffe2a4add148cb37a1942dbad64e2

commit 04d60ce0f21ffe2a4add148cb37a1942dbad64e2
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Feb 17 08:10:35 2022 -0800

    string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755]
    
    Verify that wcsncmp (L("abc"), L("abd"), SIZE_MAX) == 0.  The new test
    fails without
    
    commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:21 2022 -0600
    
        x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
    
    and
    
    commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:28 2022 -0600
    
        x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
    
    This is for BZ #28755.
    
    Reviewed-by: Sunil K Pandey <skpgkp2 at gmail.com>
    
    (cherry picked from commit aa5a720056d37cf24924c138a3dbe6dace98e97c)

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/13

------------------------------------------------------------------------
On 2022-02-17T19:27:21+00:00 Cvs-commit wrote:

The release/2.33/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cb922428dc7c5260ea84de482ffe05d2ea766199

commit cb922428dc7c5260ea84de482ffe05d2ea766199
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Feb 17 08:10:35 2022 -0800

    string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755]
    
    Verify that wcsncmp (L("abc"), L("abd"), SIZE_MAX) == 0.  The new test
    fails without
    
    commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:21 2022 -0600
    
        x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
    
    and
    
    commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:28 2022 -0600
    
        x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
    
    This is for BZ #28755.
    
    Reviewed-by: Sunil K Pandey <skpgkp2 at gmail.com>
    
    (cherry picked from commit aa5a720056d37cf24924c138a3dbe6dace98e97c)

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/14

------------------------------------------------------------------------
On 2022-02-17T19:32:31+00:00 Cvs-commit wrote:

The release/2.32/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0f8a2390000c4e9a152b5f6cf8220f2560c01e74

commit 0f8a2390000c4e9a152b5f6cf8220f2560c01e74
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Feb 17 08:10:35 2022 -0800

    string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755]
    
    Verify that wcsncmp (L("abc"), L("abd"), SIZE_MAX) == 0.  The new test
    fails without
    
    commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:21 2022 -0600
    
        x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
    
    and
    
    commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:28 2022 -0600
    
        x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
    
    This is for BZ #28755.
    
    Reviewed-by: Sunil K Pandey <skpgkp2 at gmail.com>
    
    (cherry picked from commit aa5a720056d37cf24924c138a3dbe6dace98e97c)

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/15

------------------------------------------------------------------------
On 2022-02-17T19:40:20+00:00 Cvs-commit wrote:

The release/2.31/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=775c05b28c1883c5860f582cca68abf9036d9ace

commit 775c05b28c1883c5860f582cca68abf9036d9ace
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Feb 17 08:10:35 2022 -0800

    string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755]
    
    Verify that wcsncmp (L("abc"), L("abd"), SIZE_MAX) == 0.  The new test
    fails without
    
    commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:21 2022 -0600
    
        x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
    
    and
    
    commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:28 2022 -0600
    
        x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
    
    This is for BZ #28755.
    
    Reviewed-by: Sunil K Pandey <skpgkp2 at gmail.com>
    
    (cherry picked from commit aa5a720056d37cf24924c138a3dbe6dace98e97c)

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/16

------------------------------------------------------------------------
On 2022-02-17T19:43:06+00:00 Cvs-commit wrote:

The release/2.30/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=70522b1c1d1ffa5e3bd55aa3c064ea93a330bde9

commit 70522b1c1d1ffa5e3bd55aa3c064ea93a330bde9
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Feb 17 08:10:35 2022 -0800

    string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755]
    
    Verify that wcsncmp (L("abc"), L("abd"), SIZE_MAX) == 0.  The new test
    fails without
    
    commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:21 2022 -0600
    
        x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
    
    and
    
    commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:28 2022 -0600
    
        x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
    
    This is for BZ #28755.
    
    Reviewed-by: Sunil K Pandey <skpgkp2 at gmail.com>
    
    (cherry picked from commit aa5a720056d37cf24924c138a3dbe6dace98e97c)

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/17

------------------------------------------------------------------------
On 2022-02-17T19:48:02+00:00 Cvs-commit wrote:

The release/2.29/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a486152569be7ccdd748f669631285e1a16f2e73

commit a486152569be7ccdd748f669631285e1a16f2e73
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Feb 17 08:10:35 2022 -0800

    string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755]
    
    Verify that wcsncmp (L("abc"), L("abd"), SIZE_MAX) == 0.  The new test
    fails without
    
    commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:21 2022 -0600
    
        x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
    
    and
    
    commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:28 2022 -0600
    
        x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
    
    This is for BZ #28755.
    
    Reviewed-by: Sunil K Pandey <skpgkp2 at gmail.com>
    
    (cherry picked from commit aa5a720056d37cf24924c138a3dbe6dace98e97c)

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/18

------------------------------------------------------------------------
On 2022-02-17T19:52:27+00:00 Cvs-commit wrote:

The release/2.28/master branch has been updated by H.J. Lu
<hjl at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9e050d1370587e808bc7bc3d151c5beb417120cb

commit 9e050d1370587e808bc7bc3d151c5beb417120cb
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Feb 17 08:10:35 2022 -0800

    string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755]
    
    Verify that wcsncmp (L("abc"), L("abd"), SIZE_MAX) == 0.  The new test
    fails without
    
    commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:21 2022 -0600
    
        x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
    
    and
    
    commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
    Author: Noah Goldstein <goldstein.w.n at gmail.com>
    Date:   Sun Jan 9 16:02:28 2022 -0600
    
        x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
    
    This is for BZ #28755.
    
    Reviewed-by: Sunil K Pandey <skpgkp2 at gmail.com>
    
    (cherry picked from commit aa5a720056d37cf24924c138a3dbe6dace98e97c)

Reply at:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2001975/comments/19


** Changed in: glibc
       Status: Unknown => Fix Released

** Changed in: glibc
   Importance: Unknown => Medium

** Bug watch added: Sourceware.org Bugzilla #27974
   https://sourceware.org/bugzilla/show_bug.cgi?id=27974

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to glibc in Ubuntu.
https://bugs.launchpad.net/bugs/2001975

Title:
  overflow bug in wcsncmp_avx2

Status in GLibC:
  Fix Released
Status in glibc package in Ubuntu:
  Fix Released
Status in glibc source package in Focal:
  In Progress

Bug description:
  [Impact]

  See https://sourceware.org/bugzilla/show_bug.cgi?id=28755

  Note that we're only impacted by the avx2 issue, the evex-optimized
  version isn't present in the 2.31 branch.

  [Test case]

  > test_wcsncmp.c cat <<EOF
  #include <wchar.h>
  #include <assert.h>

  int
  main(int argc, char ** argv) {
      assert(__wcsncmp_avx2(L"abc", L"abd", (1UL << 62)) != 0);
  }
  EOF
  gcc -static -o test_wcsncmp test_wcsncmp.c
  ./test_scsncmp

  [Regression potential]

  The patch is contained within the AVX-2 optimized routine, but it
  could still cause introduce a new bug there. In addition, we could see
  performance regressions.

To manage notifications about this bug go to:
https://bugs.launchpad.net/glibc/+bug/2001975/+subscriptions




More information about the foundations-bugs mailing list