This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Fix double-checked locking in __gconv_get_path and __gconv_read_conf [BZ #22062]


On 10/06/2017 01:05 AM, Carlos O'Donell wrote:
Is there any reason we need this atomic load?

+      gconv_path_elem_local = atomic_load_relaxed (&__gconv_path_elem);
                                  ^^^^^^^^^^^^^^^^^^^

Oh, this follows just the general rule that if atomics are used, all accesses should employ atomics. This follows from the general principle of C11 compatibility, where an atomic type would default to seq-cst access (which we don't want here). I see this was not mentioned in the Concurrency wiki page. I've fixed that.

I did not notice that there was a __libc_once guard. So it would be better to remove the locking from __gconv_get_path and document that (including that this serializes initialization of the gconv cache via __gconv_load_cache).

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]