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

Florian Weimer fweimer@redhat.com
Thu Oct 5 15:18:00 GMT 2017


On 10/02/2017 04:31 PM, Arjun Shankar wrote:
> These two functions running in different threads could encounter a data race
> if the CPU or compiler reordered the store of __gconv_path_elem so as to be
> earlier than writes to the content that it points to. This has now been
> corrected by using atomics every time the variable is accessed.
> 
> ChangeLog:
> 
> 2017-10-02  Arjun Shankar  <arjun@redhat.com>
> 
> 	[BZ #22062]
> 	* iconv/gconv_conf.c: Include <atomic.h>.
> 	(__gconv_get_path): Access __gconv_path_elem using atomics.
> 	(__gconv_read_conf): Likewise.
> 	(libc_freeres_fn): Likewise.

Looks good.

Thanks,
Florian



More information about the Libc-alpha mailing list