This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] dl-load: add memory barrier before updating the next
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: Maninder Singh <maninder1 dot s at samsung dot com>, <libc-alpha at sourceware dot org>, <triegel at redhat dot com>
- Cc: <nd at arm dot com>, <pankaj dot m at samsung dot com>, <ajeet dot y at samsung dot com>, <a dot sahrawat at samsung dot com>, <lalit dot mohan at samsung dot com>, <akhilesh dot k at samsung dot com>, <hakbong5 dot lee at samsung dot com>, Vaneet Narang <v dot narang at samsung dot com>
- Date: Thu, 30 Mar 2017 10:58:18 +0100
- Subject: Re: [PATCH v2] dl-load: add memory barrier before updating the next
- Authentication-results: sourceware.org; auth=none
- Authentication-results: samsung.com; dkim=none (message not signed) header.d=none;samsung.com; dmarc=none action=none header.from=arm.com;
- Nodisclaimer: True
- References: <CGME20170329070025epcas5p4644c528bf730c87d3c69e2ac3557d643@epcas5p4.samsung.com> <1490770778-11050-1-git-send-email-maninder1.s@samsung.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 29/03/17 07:59, Maninder Singh wrote:
> This patch adds C11 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.
>
> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
> Signed-off-by: Vaneet Narang <v.narang@samsung.com>
> ---
> v1 -> v2 use C11 atomics rather than direct memory barriers
>
> elf/dl-load.c | 2 +-
> elf/dl-misc.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
please report this bug in bugzilla and add the
bug number reference to the changelog according to
https://sourceware.org/glibc/wiki/Contribution%20checklist#Properly_Formatted_GNU_ChangeLog