<feed xmlns='http://www.w3.org/2005/Atom'>
<title>glibc.git/string, branch release/2.37/master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/glibc.git/'/>
<entry>
<title>x86: Fix bug in strchrnul-evex512 [BZ #32078]</title>
<updated>2024-08-15T22:42:39+00:00</updated>
<author>
<name>Noah Goldstein</name>
<email>goldstein.w.n@gmail.com</email>
</author>
<published>2024-08-13T15:29:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/glibc.git/commit/?id=f82e0922de82ccee60c15d5ffd9e7165ced00a83'/>
<id>f82e0922de82ccee60c15d5ffd9e7165ced00a83</id>
<content type='text'>
Issue was we were expecting not matches with CHAR before the start of
the string in the page cross case.

The check code in the page cross case:
```
    and    $0xffffffffffffffc0,%rax
    vmovdqa64 (%rax),%zmm17
    vpcmpneqb %zmm17,%zmm16,%k1
    vptestmb %zmm17,%zmm17,%k0{%k1}
    kmovq  %k0,%rax
    inc    %rax
    shr    %cl,%rax
    je     L(continue)
```

expects that all characters that neither match null nor CHAR will be
1s in `rax` prior to the `inc`. Then the `inc` will overflow all of
the 1s where no relevant match was found.

This is incorrect in the page-cross case, as the
`vmovdqa64 (%rax),%zmm17` loads from before the start of the input
string.

If there are matches with CHAR before the start of the string, `rax`
won't properly overflow.

The fix is quite simple. Just replace:

```
    inc    %rax
    shr    %cl,%rax
```
With:
```
    sar    %cl,%rax
    inc    %rax
```

The arithmetic shift will clear any matches prior to the start of the
string while maintaining the signbit so the 1s can properly overflow
to zero in the case of no matches.
Reviewed-by: H.J. Lu &lt;hjl.tools@gmail.com&gt;

(cherry picked from commit 7da08862471dfec6fdae731c2a5f351ad485c71f)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Issue was we were expecting not matches with CHAR before the start of
the string in the page cross case.

The check code in the page cross case:
```
    and    $0xffffffffffffffc0,%rax
    vmovdqa64 (%rax),%zmm17
    vpcmpneqb %zmm17,%zmm16,%k1
    vptestmb %zmm17,%zmm17,%k0{%k1}
    kmovq  %k0,%rax
    inc    %rax
    shr    %cl,%rax
    je     L(continue)
```

expects that all characters that neither match null nor CHAR will be
1s in `rax` prior to the `inc`. Then the `inc` will overflow all of
the 1s where no relevant match was found.

This is incorrect in the page-cross case, as the
`vmovdqa64 (%rax),%zmm17` loads from before the start of the input
string.

If there are matches with CHAR before the start of the string, `rax`
won't properly overflow.

The fix is quite simple. Just replace:

```
    inc    %rax
    shr    %cl,%rax
```
With:
```
    sar    %cl,%rax
    inc    %rax
```

The arithmetic shift will clear any matches prior to the start of the
string while maintaining the signbit so the 1s can properly overflow
to zero in the case of no matches.
Reviewed-by: H.J. Lu &lt;hjl.tools@gmail.com&gt;

(cherry picked from commit 7da08862471dfec6fdae731c2a5f351ad485c71f)
</pre>
</div>
</content>
</entry>
<entry>
<title>x86: Fix strncat-avx2.S reading past length [BZ #30065]</title>
<updated>2023-02-01T01:13:46+00:00</updated>
<author>
<name>Noah Goldstein</name>
<email>goldstein.w.n@gmail.com</email>
</author>
<published>2023-01-31T23:46:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/glibc.git/commit/?id=b2c474f8de4c92bfe7435853a96805ec32d68dfa'/>
<id>b2c474f8de4c92bfe7435853a96805ec32d68dfa</id>
<content type='text'>
Occurs when `src` has no null-term.

Two cases:

1) Zero-length check is doing:
```
    test    %rdx, %rdx
    jl      L(zero_len)
```
which doesn't actually check zero (was at some point `decq` and the
flag never got updated).

The fix is just make the flag `jle` i.e:
```
    test    %rdx, %rdx
    jle     L(zero_len)
```

2) Length check in page-cross case checking if we should continue is
doing:
```
    cmpq    %r8, %rdx
    jb      L(page_cross_small)
```
which means we will continue searching for null-term if length ends at
the end of a page and there was no null-term in `src`.

The fix is to make the flag:
```
    cmpq    %r8, %rdx
    jbe     L(page_cross_small)
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Occurs when `src` has no null-term.

Two cases:

1) Zero-length check is doing:
```
    test    %rdx, %rdx
    jl      L(zero_len)
```
which doesn't actually check zero (was at some point `decq` and the
flag never got updated).

The fix is just make the flag `jle` i.e:
```
    test    %rdx, %rdx
    jle     L(zero_len)
```

2) Length check in page-cross case checking if we should continue is
doing:
```
    cmpq    %r8, %rdx
    jb      L(page_cross_small)
```
which means we will continue searching for null-term if length ends at
the end of a page and there was no null-term in `src`.

The fix is to make the flag:
```
    cmpq    %r8, %rdx
    jbe     L(page_cross_small)
```
</pre>
</div>
</content>
</entry>
<entry>
<title>string: Suppress -Wmaybe-unitialized for wordcopy [BZ #19444]</title>
<updated>2023-01-12T12:06:00+00:00</updated>
<author>
<name>Adhemerval Zanella</name>
<email>adhemerval.zanella@linaro.org</email>
</author>
<published>2023-01-11T21:27:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/glibc.git/commit/?id=402853be1db5a233ec688f8c5343b73191629fbd'/>
<id>402853be1db5a233ec688f8c5343b73191629fbd</id>
<content type='text'>
When compiling with GCC 6+ the sparc build warns that some variables
might be used uninitialized.  However it does not seem the fact, since
the variables are really initialized (and also other targets that use the
same code, like powerpc, do not warn about it).

So suppress the warning for now.

Changes from v1:
* Update patch description and the explanation for the suppresion.
Reviewed-by: Carlos O'Donell &lt;carlos@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When compiling with GCC 6+ the sparc build warns that some variables
might be used uninitialized.  However it does not seem the fact, since
the variables are really initialized (and also other targets that use the
same code, like powerpc, do not warn about it).

So suppress the warning for now.

Changes from v1:
* Update patch description and the explanation for the suppresion.
Reviewed-by: Carlos O'Donell &lt;carlos@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Update copyright dates with scripts/update-copyrights</title>
<updated>2023-01-06T21:14:39+00:00</updated>
<author>
<name>Joseph Myers</name>
<email>joseph@codesourcery.com</email>
</author>
<published>2023-01-06T21:08:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/glibc.git/commit/?id=6d7e8eda9b85b08f207a6dc6f187e94e4817270f'/>
<id>6d7e8eda9b85b08f207a6dc6f187e94e4817270f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>string: Add len=0 to {w}memcmp{eq} tests and benchtests</title>
<updated>2022-11-09T03:19:35+00:00</updated>
<author>
<name>Noah Goldstein</name>
<email>goldstein.w.n@gmail.com</email>
</author>
<published>2022-10-29T20:19:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/glibc.git/commit/?id=ca7d181b62f703ae56b7be1e27428184560f68b4'/>
<id>ca7d181b62f703ae56b7be1e27428184560f68b4</id>
<content type='text'>
len=0 is valid and fairly common so should be tested.
Reviewed-by: Siddhesh Poyarekar &lt;siddhesh@sourceware.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
len=0 is valid and fairly common so should be tested.
Reviewed-by: Siddhesh Poyarekar &lt;siddhesh@sourceware.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>configure: Use -Wno-ignored-attributes if compiler warns about multiple aliases</title>
<updated>2022-11-01T12:51:06+00:00</updated>
<author>
<name>Adhemerval Zanella</name>
<email>adhemerval.zanella@linaro.org</email>
</author>
<published>2022-03-11T13:40:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/glibc.git/commit/?id=8d98c7c00f3f06545de9e5ce5cf778d2ab2450a4'/>
<id>8d98c7c00f3f06545de9e5ce5cf778d2ab2450a4</id>
<content type='text'>
clang emits an warning when a double alias redirection is used, to warn
the the original symbol will be used even when weak definition is
overridden.  However, this is a common pattern for weak_alias, where
multiple alias are set to same symbol.

Reviewed-by: Fangrui Song &lt;maskray@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
clang emits an warning when a double alias redirection is used, to warn
the the original symbol will be used even when weak definition is
overridden.  However, this is a common pattern for weak_alias, where
multiple alias are set to same symbol.

Reviewed-by: Fangrui Song &lt;maskray@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Use uintptr_t in string/tester for pointer alignment</title>
<updated>2022-10-28T16:31:57+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>szabolcs.nagy@arm.com</email>
</author>
<published>2022-03-21T12:36:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/glibc.git/commit/?id=f9deea6f81cd5266ffb3d27e2584d609fef9b8d2'/>
<id>f9deea6f81cd5266ffb3d27e2584d609fef9b8d2</id>
<content type='text'>
The code assumed unsigned long can represent pointers.

Reviewed-by: Adhemerval Zanella  &lt;adhemerval.zanella@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The code assumed unsigned long can represent pointers.

Reviewed-by: Adhemerval Zanella  &lt;adhemerval.zanella@linaro.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>String: Improve test coverage for memchr</title>
<updated>2022-10-18T16:10:33+00:00</updated>
<author>
<name>Sunil K Pandey</name>
<email>skpgkp2@gmail.com</email>
</author>
<published>2022-10-18T07:36:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/glibc.git/commit/?id=932dd83efdce7dbe7c008a27c4eff424a109b3a0'/>
<id>932dd83efdce7dbe7c008a27c4eff424a109b3a0</id>
<content type='text'>
This test improves memchr coverage near page boundary.

Reviewed-by: H.J. Lu &lt;hjl.tools@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This test improves memchr coverage near page boundary.

Reviewed-by: H.J. Lu &lt;hjl.tools@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>String: Improve test coverage for memchr</title>
<updated>2022-10-10T17:07:10+00:00</updated>
<author>
<name>Sunil K Pandey</name>
<email>skpgkp2@gmail.com</email>
</author>
<published>2022-10-10T16:28:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/glibc.git/commit/?id=264db94040c463d9bc356101595d89335586875e'/>
<id>264db94040c463d9bc356101595d89335586875e</id>
<content type='text'>
This test improves memchr coverage near page boundary.

Reviewed-by: H.J. Lu &lt;hjl.tools@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This test improves memchr coverage near page boundary.

Reviewed-by: H.J. Lu &lt;hjl.tools@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>x86: Fix wcsnlen-avx2 page cross length comparison [BZ #29591]</title>
<updated>2022-09-29T03:15:16+00:00</updated>
<author>
<name>Noah Goldstein</name>
<email>goldstein.w.n@gmail.com</email>
</author>
<published>2022-09-21T00:58:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/glibc.git/commit/?id=b0969fa53a28b4ab2159806bf6c99a98999502ee'/>
<id>b0969fa53a28b4ab2159806bf6c99a98999502ee</id>
<content type='text'>
Previous implementation was adjusting length (rsi) to match
bytes (eax), but since there is no bound to length this can cause
overflow.

Fix is to just convert the byte-count (eax) to length by dividing by
sizeof (wchar_t) before the comparison.

Full check passes on x86-64 and build succeeds w/ and w/o multiarch.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previous implementation was adjusting length (rsi) to match
bytes (eax), but since there is no bound to length this can cause
overflow.

Fix is to just convert the byte-count (eax) to length by dividing by
sizeof (wchar_t) before the comparison.

Full check passes on x86-64 and build succeeds w/ and w/o multiarch.
</pre>
</div>
</content>
</entry>
</feed>
