This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/1] dl-load: add memory barrier before updating the next.
- From: Florian Weimer <fweimer at redhat dot com>
- To: Maninder Singh <maninder1 dot s at samsung dot com>, libc-alpha at sourceware dot org
- Cc: pankaj dot m at samsung dot com, hakbong5 dot lee at samsung dot com, a dot sahrawat at samsung dot com, ajeet dot y at samsung dot com, Vaneet Narang <v dot narang at samsung dot com>
- Date: Thu, 16 Mar 2017 09:20:58 +0100
- Subject: Re: [PATCH 1/1] dl-load: add memory barrier before updating the next.
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=fweimer at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 281EEC05680F
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 281EEC05680F
- References: <CGME20170316051208epcas5p2d15680536ba99a6f05ecd6906750cd98@epcas5p2.samsung.com> <1489641122-35462-1-git-send-email-maninder1.s@samsung.com>
On 03/16/2017 06:12 AM, Maninder Singh wrote:
This patch adds memory barrier before updating the liblist next.
Issue Fix: race condition between add_name_to_object & _dl_name_match_p.
One threads calling dlopen which further calls add_name_to_object &
other thread trying to resolve RTLD_LAZY symbols through _dl_runtime_resolve
which further calls.
_dl_name_match_p checks if libname->next is valid, then it assumes
libname->next->name to be valid. Also add_name_to_object initialized name
first and then sets valid next pointer.
This patch avoids any reorder of instruction when next is set before name
to avoid any race.
Would you please file a bug for this? We'd also want to write a test
case for this.
Unfortunately, I cannot comment on the substance of the patch.
Thanks,
Florian