Message ID | 20250120032041.280173-8-amerey@redhat.com |
---|---|
State | Superseded |
Headers |
Return-Path: <elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 299EF3858D39 for <patchwork@sourceware.org>; Mon, 20 Jan 2025 03:25:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 299EF3858D39 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Cwny/W2r X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 794CF385840B for <elfutils-devel@sourceware.org>; Mon, 20 Jan 2025 03:20:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 794CF385840B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 794CF385840B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737343254; cv=none; b=HC39hzPzzdR3PBEIXeDSewGtCkzc96ULbH/jhZRLOrEERQf3HVdS87jegwCCQa6A1hRPb8nE+SNQtR3CdJP1qnI220dYvj4OVeHQW1BU6HdqHQwQrThCVA4htxF1Sb3VkPWOrriZc4oPJXjE07es/HOgOfQuU03mBUQj1LSNFxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737343254; c=relaxed/simple; bh=9wOuVroPG/PZJNNG9RSEQVIOaUsvtTOoElguwNf6ksk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=wblMzJ6+L9N+5+tNXReZMjXECs3JcUN0SYyfgLdRJRg1A+kGSpvy59uJ+WNUSgsZYg/xS5K4+Ovndqw9ONhCaLwJJpfRVmaPcvkTtSKef3zy5lRUa2m7+y6VtFEio+X9bO+po9565KNX7usfl78PyjkSn2iJs788SwbCLIvbpiM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 794CF385840B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737343254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xuISjRs34czMUuIfgT9Yol1O9AOzpEXy6bmK4j6HxHc=; b=Cwny/W2rBWyllDUC8GzRUHd/bJcAfRcE/PYD2AWMJxA8PjyLQ7MqYz69Peqgl32UWC62G7 e0Kj9B44hEP4bolr0VNnKTpEa+5j8PaKUE27OyLTn12ZrMnruyo80w9qYbcG0+KaZw5G7B 61e9/f8XzoZ9n/9oClfXPt3kZAMmlto= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-657-VMd0g_UANlmZWtTN1RuKag-1; Sun, 19 Jan 2025 22:20:52 -0500 X-MC-Unique: VMd0g_UANlmZWtTN1RuKag-1 X-Mimecast-MFC-AGG-ID: VMd0g_UANlmZWtTN1RuKag Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 00DDA1955DCD for <elfutils-devel@sourceware.org>; Mon, 20 Jan 2025 03:20:52 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.80.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4589E195608A; Mon, 20 Jan 2025 03:20:51 +0000 (UTC) From: Aaron Merey <amerey@redhat.com> To: elfutils-devel@sourceware.org Cc: Aaron Merey <amerey@redhat.com> Subject: [PATCH 08/15] dwarf_offdie.c: Add locking Date: Sun, 19 Jan 2025 22:20:34 -0500 Message-ID: <20250120032041.280173-8-amerey@redhat.com> In-Reply-To: <20250120032041.280173-1-amerey@redhat.com> References: <20250120032041.280173-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: HOZxWWmQOktAtnlhFrnZ4pTMfzwvhLZcwZHFE845VBA_1737343252 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list <elfutils-devel.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/elfutils-devel/> List-Post: <mailto:elfutils-devel@sourceware.org> List-Help: <mailto:elfutils-devel-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=subscribe> Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org |
Series |
[01/15] Add eu_search_tree_init
|
|
Commit Message
Aaron Merey
Jan. 20, 2025, 3:20 a.m. UTC
* libdw/dwarf_offdie.c (__libdw_offdie): Use dwarf_lock.
Signed-off-by: Aaron Merey <amerey@redhat.com>
---
libdw/dwarf_offdie.c | 3 +++
1 file changed, 3 insertions(+)
Comments
Hi Aaron, On Sun, Jan 19, 2025 at 10:20:34PM -0500, Aaron Merey wrote: > * libdw/dwarf_offdie.c (__libdw_offdie): Use dwarf_lock. What exactly is "protected" here? If it is just the __libdw_findcu call, then it seems the lock is too wide/early. It could just be taken just before that call, the code before it doesn't seem to need to be under this lock. > Signed-off-by: Aaron Merey <amerey@redhat.com> > > --- > libdw/dwarf_offdie.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libdw/dwarf_offdie.c b/libdw/dwarf_offdie.c > index 883720de..74eac420 100644 > --- a/libdw/dwarf_offdie.c > +++ b/libdw/dwarf_offdie.c > @@ -43,11 +43,13 @@ __libdw_offdie (Dwarf *dbg, Dwarf_Off offset, Dwarf_Die *result, > if (dbg == NULL) > return NULL; > > + mutex_lock (dbg->dwarf_lock); > Elf_Data *const data = dbg->sectiondata[debug_types ? IDX_debug_types > : IDX_debug_info]; > if (data == NULL || offset >= data->d_size) > { > __libdw_seterrno (DWARF_E_INVALID_DWARF); > + mutex_unlock (dbg->dwarf_lock); > return NULL; > } > > @@ -66,6 +68,7 @@ __libdw_offdie (Dwarf *dbg, Dwarf_Off offset, Dwarf_Die *result, > result = NULL; > } > > + mutex_unlock (dbg->dwarf_lock); > return result; > } > > -- > 2.47.1 >
Hi Mark, On Wed, Jan 22, 2025 at 7:12 PM Mark Wielaard <mark@klomp.org> wrote: > > On Sun, Jan 19, 2025 at 10:20:34PM -0500, Aaron Merey wrote: > > * libdw/dwarf_offdie.c (__libdw_offdie): Use dwarf_lock. > > What exactly is "protected" here? If it is just the __libdw_findcu > call, then it seems the lock is too wide/early. It could just be taken > just before that call, the code before it doesn't seem to need to be > under this lock. The tests pass when taking the lock just before __libdw_findcu. Will update this patch. Aaron
diff --git a/libdw/dwarf_offdie.c b/libdw/dwarf_offdie.c index 883720de..74eac420 100644 --- a/libdw/dwarf_offdie.c +++ b/libdw/dwarf_offdie.c @@ -43,11 +43,13 @@ __libdw_offdie (Dwarf *dbg, Dwarf_Off offset, Dwarf_Die *result, if (dbg == NULL) return NULL; + mutex_lock (dbg->dwarf_lock); Elf_Data *const data = dbg->sectiondata[debug_types ? IDX_debug_types : IDX_debug_info]; if (data == NULL || offset >= data->d_size) { __libdw_seterrno (DWARF_E_INVALID_DWARF); + mutex_unlock (dbg->dwarf_lock); return NULL; } @@ -66,6 +68,7 @@ __libdw_offdie (Dwarf *dbg, Dwarf_Off offset, Dwarf_Die *result, result = NULL; } + mutex_unlock (dbg->dwarf_lock); return result; }