public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: Maninder Singh <maninder1.s@samsung.com>,
	<libc-alpha@sourceware.org>, <triegel@redhat.com>
Cc: <nd@arm.com>, <pankaj.m@samsung.com>, <ajeet.y@samsung.com>,
	<a.sahrawat@samsung.com>, <lalit.mohan@samsung.com>,
	<akhilesh.k@samsung.com>, <hakbong5.lee@samsung.com>,
	Vaneet Narang <v.narang@samsung.com>
Subject: Re: [PATCH v2] dl-load: add memory barrier before updating the next
Date: Thu, 30 Mar 2017 09:58:00 -0000	[thread overview]
Message-ID: <58DCD6BA.1020705@arm.com> (raw)
In-Reply-To: <1490770778-11050-1-git-send-email-maninder1.s@samsung.com>

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

      parent reply	other threads:[~2017-03-30  9:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170329070025epcas5p4644c528bf730c87d3c69e2ac3557d643@epcas5p4.samsung.com>
2017-03-29  7:00 ` Maninder Singh
2017-03-29  8:58   ` Torvald Riegel
2017-03-30  9:58   ` Szabolcs Nagy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58DCD6BA.1020705@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=a.sahrawat@samsung.com \
    --cc=ajeet.y@samsung.com \
    --cc=akhilesh.k@samsung.com \
    --cc=hakbong5.lee@samsung.com \
    --cc=lalit.mohan@samsung.com \
    --cc=libc-alpha@sourceware.org \
    --cc=maninder1.s@samsung.com \
    --cc=nd@arm.com \
    --cc=pankaj.m@samsung.com \
    --cc=triegel@redhat.com \
    --cc=v.narang@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).