[PATCH] Set behavior of sprintf-like functions with overlapping source and destination

Florian Weimer fweimer@redhat.com
Fri Dec 21 17:36:00 GMT 2018


* Joseph Myers:

> On Thu, 20 Dec 2018, Gabriel F. T. Gomes wrote:
>
>> >Traditionally we didn't worry about breaking code like PughUtils.c's 
>> >'sprintf(mess,"%s %d",mess,...)' under the principle that such code was 
>> >already broken. Why depart from that tradition here?
>> 
>> I don't know how to answer that...  I'm sort of a rookie, and I wasn't
>> here to witness past, similar changes and what was the fallout.  Maybe
>> other people have better, backed opinions about it...
>
> We have the example of x86_64 memcpy (where a GLIBC_2.14 version was added 
> to avoid breaking old *binaries* expecting it to have memmove semantics, 
> but in that case breaking *sources* expecting overlapping copies to work 
> was considered fine).

The fallout from that was largely negative, though, because
memcpy@GLIBC_2.14 was the only symbol that required the GLIBC_2.14
symbol version for quite some time.

These days, I'd expect us to provide an LD_PRELOAD library instead of a
symbol version (like libBrokenLocale), or wait until something else that
requires a new symbol version for many binaries comes around.

Thanks,
Florian



More information about the Libc-alpha mailing list