public inbox for dwarves@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Alan Maguire <alan.maguire@oracle.com>, acme@kernel.org
Cc: yonghong.song@linux.dev, dwarves@vger.kernel.org, ast@kernel.org,
	 andrii@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net,
	kernel-team@fb.com,  song@kernel.org, olsajiri@gmail.com
Subject: Re: [PATCH v2 dwarves 2/2] dwarf_loader: use libdw__lock for
Date: Thu, 14 Nov 2024 10:01:39 -0800	[thread overview]
Message-ID: <c7c68138b8920e7acfdbffd986cc858008d2eb38.camel@gmail.com> (raw)
In-Reply-To: <20241114155822.898466-3-alan.maguire@oracle.com>

On Thu, 2024-11-14 at 15:58 +0000, Alan Maguire wrote:
> Eduard noticed [1] intermittent segmentation faults triggered by caching
> done internally in dwarf_getlocation(s).  A binary tree of location
> information is cached in the CU, and if multiple threads access it
> concurrently we can get segmentation faults.  It is possible to
> compile elfutils with experimental thread-safe support, but safer for
> now to add locking to pahole.
> 
> No additional overhead in pahole encoding was observed
> as a result of these changes.
> 
> Reported-by: Eduard Zingerman <eddyz87@gmail.com>
> Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
> Suggested-by: Jiri Olsa <olsajiri@gmail.com>
> Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
> 
> [1] https://lore.kernel.org/dwarves/080794545d8eb3df3d6eba90ac621111ab7171f5.camel@gmail.com/
> ---

Looking at the libdw code, both dwarf_getlocations() and
dwarf_getlocation() might end up calling __libdw_intern_expression(),
where race condition occurs. So I think that this lock positioning
should be safe. In theory, the locking could be pushed down,
to only occur around __dwarf_getlocations / dwarf_getlocation,
but that would complicate the code a bit.

Acked-by: Eduard Zingerman <eddyz87@gmail.com>

[...]


  reply	other threads:[~2024-11-14 18:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-14 15:58 [PATCH v2 dwarves 0/2] Check DW_OP_[GNU_]entry_value for possible parameter matching Alan Maguire
2024-11-14 15:58 ` [PATCH v2 dwarves 1/2] dwarf_loader: " Alan Maguire
2024-11-14 16:51   ` Yonghong Song
2024-11-14 16:59     ` Alan Maguire
2024-11-14 18:21     ` Eduard Zingerman
2024-11-14 20:04       ` Yonghong Song
2024-11-14 21:38         ` Eduard Zingerman
2024-11-15  8:47         ` Jiri Olsa
2024-11-14 15:58 ` [PATCH v2 dwarves 2/2] dwarf_loader: use libdw__lock for Alan Maguire
2024-11-14 18:01   ` Eduard Zingerman [this message]
2024-11-15  9:34 ` [PATCH v2 dwarves 0/2] Check DW_OP_[GNU_]entry_value for possible parameter matching Jiri Olsa
2024-11-15 14:52   ` Arnaldo Carvalho de Melo
2024-11-15 15:00     ` Jiri Olsa

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=c7c68138b8920e7acfdbffd986cc858008d2eb38.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dwarves@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=olsajiri@gmail.com \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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