This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: asprintf() issue
- From: Joseph Myers <joseph at codesourcery dot com>
- To: "Dmitry V. Levin" <ldv at altlinux dot org>
- Cc: <libc-alpha at sourceware dot org>, Florian Weimer <fweimer at redhat dot com>, Carlos O'Donell <carlos at redhat dot com>, Archie Cobbs <archie dot cobbs at gmail dot com>, Michael Kerrisk-manpages <mtk dot manpages at gmail dot com>
- Date: Wed, 20 May 2015 15:42:21 +0000
- Subject: Re: asprintf() issue
- Authentication-results: sourceware.org; auth=none
- References: <CANSoFxvac6_uBgwzWm5q6U+GcWzzKtDtDP0BVvE4eL08zXHs5Q at mail dot gmail dot com> <5552183C dot 2070809 at redhat dot com> <CANSoFxv7uO2Niq+wVKsC9xoDYuNgqHFxJnLrkgNqfKpFwzde=Q at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1505131601320 dot 30846 at digraph dot polyomino dot org dot uk> <555385F4 dot 5000409 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1505131722190 dot 30846 at digraph dot polyomino dot org dot uk> <555432DE dot 1020608 at redhat dot com> <5559C31D dot 5070400 at redhat dot com> <555C0DDF dot 1090408 at redhat dot com> <555C29E7 dot 8090403 at redhat dot com> <20150520074409 dot GA28812 at altlinux dot org>
On Wed, 20 May 2015, Dmitry V. Levin wrote:
> Some distributions, Owl and ALT Linux included, are patching glibc since
> 2001 to make asprintf set *ptr to NULL on error. It's quite a period of
> time to stumble upon a piece of code that relies upon current mainline
> glibc behaviour of not changing *ptr on error, and we haven't heard of
> such issues. It is extremely unlikely that such code ever existed.
> That is, I don't see any risk of breaking user code by correcting asprintf
> behaviour without introduction of a compat symbol.
The point of my option (b) (compat symbol points to same function as new
version) was that if we don't think the change would break any user code,
a new symbol version might still be desirable to ensure that newly linked
code, written (or configure-tested) for the new guarantee of setting *ptr
to NULL, does not run with older glibc binaries. Though there are
probably many more cases when we haven't added new symbol versions in such
circumstances (new glibc extends an interface to add more features than
old glibc, so the new symbol can work with old binaries but some new
binaries won't work with old glibc) than where we have added new versions.
(I think such a hypothetical new version would apply to five symbols -
__asprintf __asprintf_chk __vasprintf_chk asprintf vasprintf. At least,
those are the asprintf symbols currently exported from shared libc.)
--
Joseph S. Myers
joseph@codesourcery.com