From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id B1EJH0UHBGmSWBMAWB0awg (envelope-from ) for ; Thu, 30 Oct 2025 20:48:05 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ftuW7UuK; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6D3AC1E0BC; Thu, 30 Oct 2025 20:48:05 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 CD6641E057 for ; Thu, 30 Oct 2025 20:48:03 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2BA063858C41 for ; Fri, 31 Oct 2025 00:48:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BA063858C41 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ftuW7UuK Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id 1BF683858D2A for ; Fri, 31 Oct 2025 00:47:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1BF683858D2A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1BF683858D2A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761871634; cv=none; b=hhwJ/qzPZ9YVooxBfFZpGQ8MDtwhCXlRpy4okO4RlDkjDFAkzQhQsgb7dOeziX6VTGMAXYEoHqRx/t5xdVAEl4X1QH3g2YCRyu3hYAIZ+ytI0mDl3roARUoHt9G+llnjvxyl9WiHbRhc0PQZU8QzuQ4Fsz9Om3wsllMGe0P0vis= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761871634; c=relaxed/simple; bh=AoYlNIO7PHCJN8PAzajMM2HfUtlo8CSVNJvvQxbZ734=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qyLK/qc9znnbcapaj8vuf2+tTaHDNbA2IYFSWTsKikc4LKIjnYJjtl51Sn3qGlMI6CJPpsY99f42L0Sb5KmGO+bRwWB7jpyCU/EZVNcFQolLxzsTuCLSq+Ifc5E1XaA1h/EA+YRHO02EPNU7j2CiMeYoNDbYw5uihyXSn9bOzPg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1BF683858D2A Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-b553412a19bso1131725a12.1 for ; Thu, 30 Oct 2025 17:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761871633; x=1762476433; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0ewDJpj7CqWdOax/k9U2cL/OF4Luuvkjs3YKyuZOX28=; b=ftuW7UuKd9l51HIXC6a3+CORQSAviZNBYtGQM+i7lwAe0wA8W8BgUBc6DMaYY/OWOu rB5D1AV2u68HS8GMBO0U2vQkrF/tb2UnRc0ChXNUroiGtzVmi//xgXIzDGHOC3cD7ejB 7Y/BK+o/zqIsk688RhzexMkCBn+c0EYunNfbqQCby0dwAN2NNAMzmsHFz/ODi0HYNt3a DdZ3D1d9SPAVpxNwJB7e2tTL8ao/i9ZdHWewQZJHB4SUvD37yu8Zr5EVz20oisVvY9VI /Po51r/ThOCML6QScw5rHPShMkaCA3TXJUveFvpQE6V30oTWX2rckeW9A4+TXGNkX77J h3SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761871633; x=1762476433; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0ewDJpj7CqWdOax/k9U2cL/OF4Luuvkjs3YKyuZOX28=; b=ireQ7pU18ymAGtmTHRmeHkeqFNncOf2pUMofltoEQbSehT8dkayxRIc2EGmJeRftL/ ZCE5bRyZCR2vmnHZIQxCyinNYjhEFJuagCR19x/1eklgJeB88S6S7J2A1Kl2ozMxIAdM zNiSUOAs3qZ7OaO4i12+l7Cg1Cq0z/sN+wZpdGWqHiQuYIqOJqvdhkeMOBM7gjZkQLKH aiHVY4p7QlM3DlqtJZ1tRnXV4QqRh/RynWHAEK+u1TL2jjzB/9254kCO1yUVCmYTwtiR 8O25/TJBB5jhOQb8N9piSoWUCX9Nfm0pIprI+Af5TvMxBNmRb0addXENllMwB4LyJ6vi uM5g== X-Gm-Message-State: AOJu0Ywu4xBPD9/Pe39Gyl0TelfGuYOcpYVR4LPMGTyXU4jQtg9eeZbL sI9awREtuuG86gV4ilXp9zSoKlj2Eb4dHPQzYpfYzP12mWWSzMdTUP0L2oOwA3VMVcg= X-Gm-Gg: ASbGncugZFsNav7FONuGlJFb3XXjT6dbIiZ1z3sB47WCQam+coAkJH6OCYLH5czyBf2 /7o3xzaB2tB5jHusJJhFvkpDLqq+vVMaojB7sXhIIiqifty3/UTLYJpoD/Og7kYPyOqiz3WDfFU rAjoXMxjo2asEFVUOH1HKH3QfmtWtJG/F2pGacuOH15V8RGgxcvgQYvSt2Op1orZRBmwuy8WK66 70xZnyS3sNBhrqEHoqd2M/naG9/DUGqSQ7FJxqPDMF7p9A/elahTvJ/UdV6yi0/YWHXdTrARiVq RCZ8/tFzYRTwMr0rgsFazffw01R1VuGoETOQ2PCzOfGJsiRfWr1MVAWgrjBDd0cBzFEq75aC6mo 13tcEKzgbrM7Gn+PeBF0AOJAwtK4OeZLMTEarueGVfFr/mrd7uWOSl8SVITtIbvpE9oRmEjvt2q EvcxtEMBUN6g== X-Google-Smtp-Source: AGHT+IHRKHv7PjDCftRpvTxZhJ7sPhgAakvqONxLJxNerGJoTPRjn5F9tWvdcx5MbJDeAEMo8P2rSw== X-Received: by 2002:a17:903:1ca:b0:276:305b:14a7 with SMTP id d9443c01a7336-2951a4d8340mr23373245ad.33.1761871632979; Thu, 30 Oct 2025 17:47:12 -0700 (PDT) Received: from localhost ([2804:14d:7e39:88d6:dd80:7850:7b40:c343]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-34092d48252sm217383a91.15.2025.10.30.17.47.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Oct 2025 17:47:12 -0700 (PDT) From: Thiago Jung Bauermann To: "Schimpe, Christina" Cc: "'gdb-patches@sourceware.org'" Subject: Re: [PATCH 0/9] Add new command to print the shadow stack backtrace In-Reply-To: (Christina Schimpe's message of "Wed, 29 Oct 2025 14:52:00 +0000") References: <20250923111842.4091694-1-christina.schimpe@intel.com> <871pne2min.fsf@linaro.org> <87wm4zoayl.fsf@linaro.org> User-Agent: mu4e 1.12.11; emacs 30.2 Date: Thu, 30 Oct 2025 21:47:09 -0300 Message-ID: <87ikfvyk1e.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 Hello Christina, "Schimpe, Christina" writes: >> -----Original Message----- >> From: Schimpe, Christina >> Sent: Monday, October 13, 2025 8:35 AM >> To: Thiago Jung Bauermann >> Cc: gdb-patches@sourceware.org >> Subject: RE: [PATCH 0/9] Add new command to print the shadow stack >> backtrace >>=20 >> > -----Original Message----- >> > From: Thiago Jung Bauermann >> > Sent: Monday, October 13, 2025 3:19 AM >> > To: Schimpe, Christina >> > Cc: gdb-patches@sourceware.org >> > Subject: Re: [PATCH 0/9] Add new command to print the shadow stack >> > backtrace >> > >> > Thiago Jung Bauermann writes: >> > >> > > I tested your patches and there's a bug unfortunately: =E2=8B=AE >> > The problem turned out to be simple. I just had to set the regnum for >> > the GCSPR in the gdbarch: >> > >> > diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index >> > 95af82c26327..9e866fc319d4 100644 >> > --- a/gdb/aarch64-tdep.c >> > +++ b/gdb/aarch64-tdep.c >> > @@ -4780,6 +4780,10 @@ aarch64_gdbarch_init (struct gdbarch_info >> info, >> > struct gdbarch_list *arches) >> > /* Register a hook for converting a memory tag to a string. */ >> > set_gdbarch_memtag_to_string (gdbarch, aarch64_memtag_to_string); >> > >> > + if (tdep->has_gcs ()) >> > + /* AArch64's shadow stack pointer is the GCSPR. */ >> > + set_gdbarch_ssp_regnum (gdbarch, tdep->gcs_reg_base); >> > + >> > /* ABI */ >> > set_gdbarch_short_bit (gdbarch, 16); >> > set_gdbarch_int_bit (gdbarch, 32); >>=20 >> Ah, I forgot about that. Cool that it works now. =F0=9F=98=8A > > I thought about this again. In addition to setting the regnum for the sha= dow stack pointer, > I would have expected that you also have to implement the gdbarch hook > top_addr_empty_shadow_stack to make GCS work for shadow stack pointer unw= inding > and the shadow stack backtrace, or am I missing something? Ah, I have a comment about this on my review of patch 1 that is sitting in my drafts folder. I was waiting to send them all together, but it's been taking me longer than I expected. I will just send what I have so far. But essentially, if there's no gdbarch_top_addr_empty_shadow_stack hook this patch series changes the check of whether ssp is empty from a <=3D comparison with the end of the range to a < comparison. Because of this, AArch64 doesn't need to implement the hook to make the existing aarch64-gcs*.exp tests work. It still needs it to make the "bt shadow" command work though. > Both, the aarch64 implememtation for top_addr_empty_shadow_stack and ssp = regnum > configuration, should then be part the first patch "Generalize handling .= ..". > Does that make sense to you? Yes, patch 1 should include the changes needed to make the existing aarch64-gcs*.exp tests passing. As of v1, that's just the ssp regnum configuration. Depending on what you decide to do for v2, that could include the top_addr_empty_shadow_stack hook as well. > Also I should probably add proper error messages when the configuration o= f ssp_regnum is missing, Is that possible? How would GDB distinguish between missing ssp regnum configuration versus the target not supporting shadow stacks? > and improve the documentation for required gdbarch hooks to properly impl= ement "bt shadow" in > gdbarch_components.py. --=20 Thiago