| Message ID | 20260504071636.1571615-3-markus.t.metzger@intel.com |
|---|---|
| State | New |
| Headers |
Return-Path: <gdb-patches-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 17DCA4BB3BA2 for <patchwork@sourceware.org>; Mon, 4 May 2026 07:17:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17DCA4BB3BA2 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=WRJYvvt2 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by sourceware.org (Postfix) with ESMTPS id 232B14B99F6E for <gdb-patches@sourceware.org>; Mon, 4 May 2026 07:16:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 232B14B99F6E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 232B14B99F6E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777879018; cv=none; b=T5Qtpa9SUc8ugWs+K4IDXUFDOLO3mnT6grneiASiAbP3LkrLpzl5HZuq7DBDqhV4OHeyM+UaQEA8/2ua7gSQibsKlJ7l1y7Io2203MrDXxTJUANAUHBd6G6dcRl8o9bIv++h73C58T2Kmdo7/IY/mUMrxsONVczTMs6OIEWru4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777879018; c=relaxed/simple; bh=51pTcoJaHj8w3NPbAN3DQSgH1pAm1KZqYWfOM58IGHk=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=jkv64ZOvIKpB6VaUHCuDZsNtLZJtwPY5kM4R1r4/b3kuiIayDHg4F7ofaRCc3vJSrUHkZ/bu2mffdaRJZIoqrfmREOOEXXrNf/1Wv8B2b71Yv1Gy3jCypa3el4T6PnQk0LVrXYvmQXCgOcQxmcmfOwFbrQlsylDV5vN4YcWuscM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 232B14B99F6E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777879018; x=1809415018; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=51pTcoJaHj8w3NPbAN3DQSgH1pAm1KZqYWfOM58IGHk=; b=WRJYvvt2ZVH63BVXZLeBnvYWjdBmnMmZ6kfLIF04xZGU1oFJsw7XHveC g9sELqhAggg3K9sd7cjbt3Y0IMWRAr4/bU/n8wiQOP16kxGTL/t/7FrXu PCoY/Mp+O9En2gcSQqbY94RLlCmzpzp/SeXHPRY2o+N6MIjem9HkSc1vh 3Pt2PrtiElcpl2d4XvlmUFR1SKjYSIAg1xq/HtKAw+KZNdOkgOIkvRILG QMwf3CBCEZEsuQ8BiU/rS8Vo+LRlWBIdQTneKcrIrP5xjafsVVbTwJt6r 3AtjY8cB2zzjmnB9JE1WLPywU3jwfLHo1Lop3HlD83wKyPgWWR8V4tFZ5 g==; X-CSE-ConnectionGUID: YaZ+G3Y+SpOuXiR1V3qEaQ== X-CSE-MsgGUID: c15ntuSrQ6KetKM5RB1gxw== X-IronPort-AV: E=McAfee;i="6800,10657,11775"; a="78926000" X-IronPort-AV: E=Sophos;i="6.23,215,1770624000"; d="scan'208";a="78926000" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2026 00:16:56 -0700 X-CSE-ConnectionGUID: Me5yfWvRROucb5omiNYPsQ== X-CSE-MsgGUID: nGpiQofnQJG2sj2CnTuI+Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,215,1770624000"; d="scan'208";a="237221257" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2026 00:16:46 -0700 From: Markus Metzger <markus.t.metzger@intel.com> To: gdb-patches@sourceware.org Subject: [PATCH] gdb, remote: fix notify debug nullptr dereference Date: Mon, 4 May 2026 07:16:32 +0000 Message-Id: <20260504071636.1571615-3-markus.t.metzger@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260504071636.1571615-1-markus.t.metzger@intel.com> References: <20260504071636.1571615-1-markus.t.metzger@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
gdb, remote: fix notify debug nullptr dereference
|
|
Commit Message
Metzger, Markus T
May 4, 2026, 7:16 a.m. UTC
In remote_target:push_stop_reply, notif debug prints an element that has been moved. Print the element at the destination, instead. --- gdb/remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 5/4/26 3:16 AM, Markus Metzger wrote: > In remote_target:push_stop_reply, notif debug prints an element that has > been moved. Print the element at the destination, instead. So, there is a clang-tidy check for that, and indeed it finds it (and more, but I'm just pasting the relevant one): $ clang-tidy '-checks=bugprone-use-after-move' remote.c ... /home/smarchi/src/binutils-gdb/gdb/remote.c:8409:3: warning: 'new_event' used after it was moved [bugprone-use-after-move] 8409 | new_event->ptid.to_string ().c_str (), | ^ /home/smarchi/src/binutils-gdb/gdb/remote.c:8404:24: note: move occurred here 8404 | rs->stop_reply_queue.push_back (std::move (new_event)); I think we should set up a .clang-tidy file with the checks we care about an run it in the CI, I'll look into that. Approved-By: Simon Marchi <simon.marchi@efficios.com> Simon
diff --git a/gdb/remote.c b/gdb/remote.c index 1455838c2cf..735774903f3 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8406,7 +8406,7 @@ remote_target::push_stop_reply (stop_reply_up new_event) if (notif_debug) gdb_printf (gdb_stdlog, "notif: push 'Stop' %s to queue %d\n", - new_event->ptid.to_string ().c_str (), + rs->stop_reply_queue.back ()->ptid.to_string ().c_str (), int (rs->stop_reply_queue.size ())); /* Mark the pending event queue only if async mode is currently enabled.