Bug 29863 - Segmentation fault in memcmp-sse2.S if memory contents can concurrently change

Zack Weinberg zack@owlfolio.org
Wed Dec 14 14:16:16 GMT 2022


I'll respond to this at more length later, but I want to point out that this statement ...

On Tue, Dec 13, 2022, at 11:16 PM, Carlos O'Donell wrote:
> The standards are in no way prescriptive in saying that memcmp shall not read or
> write to memory outside of the input domain.

... is (as I read it) contradicted by 7.1.4p5 (N1570) "A library function shall not directly or indirectly access objects accessible by threads other than the current thread unless the objects are accessed directly or indirectly via the function's arguments."  There is more wiggle room in this wording than I'd ideally like, but since memcmp has no way of knowing whether any particular piece of data outside the ranges supplied as arguments is "accessible by threads other than the current thread", it needs to be conservative and not touch any of it.

zw


More information about the Libc-alpha mailing list