From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id dSAoMLq4zGpQ6jkAWB0awg (envelope-from ) for ; Mon, 12 Oct 2026 06:38:50 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Db82CbYV; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A380B1E051; Mon, 12 Oct 2026 06:38:50 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 1FE161E047 for ; Mon, 12 Oct 2026 06:38:49 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B23C04BA2E3B for ; Mon, 12 Oct 2026 10:38:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B23C04BA2E3B 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=Db82CbYV Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by sourceware.org (Postfix) with ESMTPS id 6A45D4BA2E09 for ; Mon, 12 Oct 2026 10:38:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6A45D4BA2E09 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 6A45D4BA2E09 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791801501; cv=none; b=IkFFvZa050pr+Q1DNK/0zQVsNdr0h/wnJbgvGd2SoNzI0sg/6GgwQo1HMcz8imw4mhG2si2+fv9Yzgc1y4ZmpD6E+HHO63eIX/SwLk67aCrfrkewSlFAJ4WynSPpDmYuIE3CnEWaMKmNzM/+nh+bEO1CQgQYMbvz5uR1Cjmufyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791801501; c=relaxed/simple; bh=IiaL103MgWMb5ZK15pTJLpVzcy9wtSq5YOpHO2Iw/xg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RF7zl+BP/ZV8dMH1e1ul86MCWdSDyW1E5e1I/cU49A0NMTRPu02CyTkb0ARfaWZQW4FhI29pJFdPQ+5YbZtD7xtnO7P0LMcYQfpUVasyaoWrvwQcPSc6yT7dpQLnzP54EmxI9Xt3Enzxx/YoWvgcj86VU+pVp18mugoLeNsXkvg= ARC-Authentication-Results: i=1; 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=Db82CbYV DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A45D4BA2E09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1791801501; x=1823337501; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=IiaL103MgWMb5ZK15pTJLpVzcy9wtSq5YOpHO2Iw/xg=; b=Db82CbYVxQ6kS2DqoXtRaPq7Ub0B5Md4ZpfODIaWrwsvoxD4s/JEAl3K lhit3UudfZTYuwnI/4AUJaPNZ+aEpJ55D7gB1CMxV2yrS67cD1p3ujW7E yhbzRyLbh+ecOL1dRqanAXE+UswQQqJDFyTffx8ktm1rvJt6fukRU8be7 aydT+yDa+VmmO24hgOPiu44Y2NBg32c88FTC/qauc+imGUaSlbOnQ/RbQ hJ2WAa9KM5g0+gcfHo057lYSk5M0bxq6d0Fx2WZAK4nQ+v/oGRL6pcgOG ZUE23FWj7Wb6FjcsDW2x8FVGs4c7S1oGtaLncnm05okWRBsIUWSDrgCki w==; X-CSE-ConnectionGUID: IU+9GmdiQOqaU2js8968SA== X-CSE-MsgGUID: GXEBR/ijTg+KnMW+8BqNjA== X-IronPort-AV: E=McAfee;i="6800,10657,11932"; a="382617" X-IronPort-AV: E=Sophos;i="6.27,153,1787036400"; d="scan'208";a="382617" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2026 03:38:20 -0700 X-CSE-ConnectionGUID: CWUMgfDPR2y6m0AWPNq63w== X-CSE-MsgGUID: CPIxIeIrT3qm1S94ooJDNQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,153,1787036400"; d="scan'208";a="1170827" Received: from dut1048pvc.igk.intel.com (HELO localhost) ([10.211.177.228]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2026 03:38:19 -0700 From: Stephan Rohr To: gdb-patches@sourceware.org Subject: [PATCH] gdb: fix assert after register write failure Date: Mon, 12 Oct 2026 10:38:13 +0000 Message-ID: <20261012103813.112609-1-stephan.rohr@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org From: Eduard Sargsyan GDB tries to invalidate register cache if write to register fails. In case when write was requested to be done for a remote inferior and connection with remote is dead (so write request will fail) GDB cleans register caches and as result setting register status fails with segmentation fault, because internal pointers are not valid anymore and the unique_ptr with register status is null. This change adds check if register status cache is still valid before trying to modify (set status to UNKNOWN). --- gdb/regcache.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gdb/regcache.c b/gdb/regcache.c index 773e8ac37d0..01c60ea8047 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -883,8 +883,11 @@ regcache::raw_write (int regnum, gdb::array_view src) /* Invalidate the register after it is written, in case of a failure. */ - auto invalidator - = make_scope_exit ([&] { this->invalidate (regnum); }); + auto invalidator = make_scope_exit ([&] + { + if (this->m_register_status != nullptr) + this->invalidate (regnum); + }); target_store_registers (this, regnum); -- 2.43.0 ________________________________________ Intel Deutschland GmbH Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany Tel: +49 (89) 99143-0 www.intel.de Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman Chairperson of the Supervisory Board: Sonja Pierer Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.