[PATCH v1] x86: memcmp-avx2-movbe.S and memcmp-evex-movbe.S fix overflow bug.
Siddhesh Poyarekar
siddhesh@gotplt.org
Mon Jun 7 14:21:30 GMT 2021
On 6/7/21 2:00 PM, Noah Goldstein via Libc-alpha wrote:
> Fix bugs introducted in commits:
>
> author Noah Goldstein <goldstein.w.n@gmail.com>
> Mon, 17 May 2021 17:57:24 +0000 (13:57 -0400)
> commit 4ad473e97acdc5f6d811755b67c09f2128a644ce
>
> And
>
> author Noah Goldstein <goldstein.w.n@gmail.com>
> Mon, 17 May 2021 17:56:52 +0000 (13:56 -0400)
> commit 16d12015c57701b08d7bbed6ec536641bcafb428
>
> Which added a bug which would cause pointer + length overflow to lead
> to an early return as opposed to a Segmentation Fault.
If we end up making this change, IMO it should come with an explicit
note that this behaviour is not guaranteed for invalid inputs in other
implementations of memcmp or for that matter, in future versions of this
memcmp.
An input that causes pointer + length overflow is undefined behaviour
and IMO we shouldn't try to define it for glibc. This change may not
have a noticeable performance impact but future requests to guarantee
this behaviour may not necessarily be this straightforward and IMO we
should not bind ourselves to it.
Siddhesh
More information about the Libc-alpha
mailing list