diff options
author | Arjun Shankar <arjun@redhat.com> | 2018-10-17 17:47:29 +0200 |
---|---|---|
committer | Arjun Shankar <arjun@redhat.com> | 2018-10-17 17:47:29 +0200 |
commit | c5288d378ad258d2e8e8cb174be3b9f233a312eb (patch) | |
tree | a987e28461c55a9d7011f046f382beaaa48cc93a /iconv/Makefile | |
parent | 729f34028a7f494b599a29889df825cf826b6de0 (diff) | |
download | glibc-c5288d378ad258d2e8e8cb174be3b9f233a312eb.tar.gz glibc-c5288d378ad258d2e8e8cb174be3b9f233a312eb.tar.xz glibc-c5288d378ad258d2e8e8cb174be3b9f233a312eb.zip |
Remove unnecessary locking when reading iconv configuration [BZ #22062]
In iconv/gconv_conf.c, __gconv_get_path unnecessarily obtains a lock when populating the array pointed to by __gconv_path_elem. The locking is not necessary because all calls to __gconv_read_conf (which in turn calls __gconv_get_path) are serialized using __libc_once. This patch: - removes all locking in __gconv_get_path; - replaces all explicitly serialized __gconv_read_conf calls with calls to __gconv_load_conf, a new wrapper that is serialized internally; - adds a new test, iconv/tst-iconv_mt.c, to exercise iconv initialization, usage, and cleanup in a multi-threaded program; - indents __gconv_get_path correctly, removing tab characters (which makes the patch look a little bigger than it really is). After removing the unnecessary locking, it was confirmed that the test case fails if the relevant __libc_once is removed. Additionally, four localedata and iconvdata tests also fail. This gives confidence that the testsuite sufficiently guards against some regressions relating to multi-threading with iconv. Tested on x86_64 and i686.
Diffstat (limited to 'iconv/Makefile')
-rw-r--r-- | iconv/Makefile | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/iconv/Makefile b/iconv/Makefile index d71319b39e..79d03c3bbe 100644 --- a/iconv/Makefile +++ b/iconv/Makefile @@ -43,7 +43,8 @@ CFLAGS-charmap.c += -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \ CFLAGS-linereader.c += -DNO_TRANSLITERATION CFLAGS-simple-hash.c += -I../locale -tests = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6 +tests = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6 \ + tst-iconv-mt others = iconv_prog iconvconfig install-others-programs = $(inst_bindir)/iconv @@ -67,6 +68,8 @@ endif $(objpfx)gconv-modules: test-gconv-modules cp $< $@ +$(objpfx)tst-iconv-mt: $(shared-thread-library) + ifeq (yes,$(build-shared)) tests += tst-gconv-init-failure modules-names += tst-gconv-init-failure-mod |