glibc/iconv
Arjun Shankar c5288d378a 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.
2018-10-17 17:47:29 +02:00
..
dummy-repertoire.c
gconv_builtin.c
gconv_builtin.h
gconv_cache.c
gconv_charset.h
gconv_close.c
gconv_conf.c Remove unnecessary locking when reading iconv configuration [BZ #22062] 2018-10-17 17:47:29 +02:00
gconv_db.c Remove unnecessary locking when reading iconv configuration [BZ #22062] 2018-10-17 17:47:29 +02:00
gconv_dl.c
gconv_int.h Remove unnecessary locking when reading iconv configuration [BZ #22062] 2018-10-17 17:47:29 +02:00
gconv_open.c Clean up iconv/gconv_int.h for unnecessary declarations 2018-09-25 15:13:15 +02:00
gconv_simple.c
gconv_trans.c
gconv.c
gconv.h
iconv_charmap.c
iconv_close.c
iconv_open.c
iconv_prog.c
iconv_prog.h
iconv.c
iconv.h
iconvconfig.c
iconvconfig.h
loop.c Fix s390 -Os iconv build. 2018-03-05 21:46:55 +00:00
Makefile Remove unnecessary locking when reading iconv configuration [BZ #22062] 2018-10-17 17:47:29 +02:00
skeleton.c
strtab.c
test-gconv-modules
tst-gconv-init-failure-mod.c
tst-gconv-init-failure.c
tst-iconv1.c
tst-iconv2.c
tst-iconv3.c
tst-iconv4.c
tst-iconv5.c
tst-iconv6.c
tst-iconv-mt.c Remove unnecessary locking when reading iconv configuration [BZ #22062] 2018-10-17 17:47:29 +02:00
Versions