public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: pgowda cve <pgowda.cve@gmail.com>
Cc: Adhemerval Zanella via Libc-help <libc-help@sourceware.org>
Subject: Re: Race observed in if_nametoindex function (not MT-Safe)
Date: Sun, 19 Sep 2021 09:46:14 -0300	[thread overview]
Message-ID: <CAMXh4bULVtkCHM4M4efmb9diVijqJXa==uhKnK-SL63WBdCqDg@mail.gmail.com> (raw)
In-Reply-To: <CALY4984bu_GywXu_h1isRf1DxAX33x6kiFAHo1FNBxHYC9h=yw@mail.gmail.com>

On Mon, Sep 13, 2021 at 11:15 AM pgowda cve via Libc-help
<libc-help@sourceware.org> wrote:
>
> Hi,
>
> The race and assert-triggering was observed in if_nametoindex function.
> It calls __opensock, which contains two static variables (last_type,
> last_family)
> that can race, triggering an assert on line 63 of opensock.c.
> The variables are set in the reverse order to which they are checked.
> Since there is no synchronization between these variables, should the function
> not be made MT-Safe.
>
> The patch was originally posted at:-
> https://sourceware.org/pipermail/libc-alpha/2014-January/048052.html
> It mentions the function as MT-Safe but race was observed.
>
> We may need a memory barrier (atomic_[read|write]_barrier() ? ) to
> ensure that the
> compiler doesn't re-order assembly instructions and has last_family be
> set before last_type.
>
> Environment
> Observed during a system restart when the processes start up and
> software calls if_nametoindex from multiple threads.
> GLIBC was dynamically Linked.
>
> Regards,
> pgowda

I agree, I haved opened
https://sourceware.org/bugzilla/show_bug.cgi?id=28353 to track it.
Thanks for reporting it.

      reply	other threads:[~2021-09-19 12:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 14:13 pgowda cve
2021-09-19 12:46 ` Adhemerval Zanella [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='CAMXh4bULVtkCHM4M4efmb9diVijqJXa==uhKnK-SL63WBdCqDg@mail.gmail.com' \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-help@sourceware.org \
    --cc=pgowda.cve@gmail.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).