This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Fix double-checked locking in __gconv_get_path and __gconv_read_conf [BZ #22062]
- From: Florian Weimer <fweimer at redhat dot com>
- To: Arjun Shankar <arjun dot is at lostca dot se>, libc-alpha at sourceware dot org
- Date: Thu, 5 Oct 2017 17:18:20 +0200
- Subject: Re: [PATCH v2] Fix double-checked locking in __gconv_get_path and __gconv_read_conf [BZ #22062]
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=fweimer at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 719B7CD260
- References: <20171002143148.GA41930@aloka.lostca.se>
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