Do not use wildcard symbol names for public versions in Versions files

Submitted by Joseph S. Myers on April 20, 2017, 7:58 p.m.

Details

Message ID alpine.DEB.2.20.1704201958140.30917@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph S. Myers April 20, 2017, 7:58 p.m.
As noted in
<https://sourceware.org/ml/libc-alpha/2012-12/msg00240.html>,
stdlib/Versions and wcsmbs/Versions list some functions as
__strto*_internal and __wcsto*_internal rather than explicitly listing
the symbols to be exported (so any new internal function matching one
of those patterns would be wrongly added to version GLIBC_2.0), which
seems like a bad idea.  This patch changes those files to list the
exported symbols explicitly.  There are still entries in
sysdeps/nacl/Versions for __nacl_irt_*, but as GLIBC_PRIVATE symbols
that seems less significant.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by the patch.

2017-04-20  Joseph Myers  <joseph@codesourcery.com>

	* stdlib/Versions (__strtod_internal): List explicitly, not as
	wildcard.
	(__strtof_internal): Likewise.
	(__strtold_internal): Likewise.
	(__strtol_internal): Likewise.
	(__strtoll_internal): Likewise.
	(__strtoul_internal): Likewise.
	(__strtoull_internal): Likewise.
	(__strtoq_internal): Likewise.
	(__strtouq_internal): Likewise.
	* wcsmbs/Versions (__wcstod_internal): Likewise.
	(__wcstof_internal): Likewise.
	(__wcstold_internal): Likewise.
	(__wcstol_internal): Likewise.
	(__wcstoll_internal): Likewise.
	(__wcstoul_internal): Likewise.
	(__wcstoull_internal): Likewise.

Comments

Florian Weimer April 20, 2017, 8:20 p.m.
On 04/20/2017 09:58 PM, Joseph Myers wrote:
> As noted in
> <https://sourceware.org/ml/libc-alpha/2012-12/msg00240.html>,
> stdlib/Versions and wcsmbs/Versions list some functions as
> __strto*_internal and __wcsto*_internal rather than explicitly listing
> the symbols to be exported (so any new internal function matching one
> of those patterns would be wrongly added to version GLIBC_2.0), which
> seems like a bad idea.  This patch changes those files to list the
> exported symbols explicitly.  There are still entries in
> sysdeps/nacl/Versions for __nacl_irt_*, but as GLIBC_PRIVATE symbols
> that seems less significant.

Thanks for doing this.  Looks good.

> Tested with build-many-glibcs.py that installed stripped shared
> libraries are unchanged by the patch.

Do you have a script for that?

Florian
Joseph S. Myers April 20, 2017, 8:33 p.m.
On Thu, 20 Apr 2017, Florian Weimer wrote:

> > Tested with build-many-glibcs.py that installed stripped shared
> > libraries are unchanged by the patch.
> 
> Do you have a script for that?

No.  Run build-many-glibcs.py with --strip, copy the install/glibcs 
directory, run again with --strip and the patch applied, compare the 
old and new install/glibcs directories and grep out irrelevant differences 
such as .a files and nscd.

(I wonder if glibc should build deterministic archives by default to avoid 
the timestamp differences in .a files and so facilitate cleaner 
comparisons of whole install trees.)

Patch hide | download patch | download mbox

diff --git a/stdlib/Versions b/stdlib/Versions
index 415b994..9cade20 100644
--- a/stdlib/Versions
+++ b/stdlib/Versions
@@ -4,7 +4,11 @@  libc {
     __xpg_basename;
 
     # functions used in inline functions or macros
-    __strto*_internal;
+    __strtod_internal; __strtof_internal; __strtold_internal;
+    __strtol_internal; __strtoll_internal;
+    __strtoul_internal; __strtoull_internal;
+    # functions formerly so used (compatibility symbols)
+    __strtoq_internal; __strtouq_internal;
 
     # compatibility symbol
     __secure_getenv;
diff --git a/wcsmbs/Versions b/wcsmbs/Versions
index 1ff5ff3..b8f7bd7 100644
--- a/wcsmbs/Versions
+++ b/wcsmbs/Versions
@@ -1,7 +1,10 @@ 
 libc {
   GLIBC_2.0 {
     # functions used in inline functions or macros
-     __mbrlen; __mbrtowc; __wcsto*_internal;
+     __mbrlen; __mbrtowc;
+    __wcstod_internal; __wcstof_internal; __wcstold_internal;
+    __wcstol_internal; __wcstoll_internal;
+    __wcstoul_internal; __wcstoull_internal;
 
     # b*
     btowc;