From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id wd9bCRrrpGq7uQIAWB0awg (envelope-from ) for ; Sat, 12 Sep 2026 02:03:06 -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=zWgOYWE7; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 228CA1E091; Sat, 12 Sep 2026 02:03:06 -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 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 52DB91E091 for ; Sat, 12 Sep 2026 02:03:05 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 80EF5486349A for ; Sat, 12 Sep 2026 06:03:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 80EF5486349A 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=zWgOYWE7 Received: from mail-vs2-x10.google.com (mail-vs2-x10.google.com [IPv6:2a00:1450:4864:3a::10]) by sourceware.org (Postfix) with ESMTPS id EC5FD4900323 for ; Sat, 12 Sep 2026 06:02:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC5FD4900323 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 EC5FD4900323 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:3a::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789192961; cv=none; b=r2/SslVjjwNfFFJ18fuxgZZQjVqUPuxZK7Kcrn5BA6wVmuRCpE4bKSp15mJwvgiuuuvSL8WYItvqCd4NsWjaudoe7J4MO4tUypIS2Uc3Uo9UUCcDHpXHy0tz12h5IkMjcjtt+N+QO5OX54tfcrxiUFlypiIO3JrBoshGfoUjOPQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789192961; c=relaxed/simple; bh=hx96lY759sqbG4acH3+V4r4KniBkmP24FSxFaSXcknE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vrqTM8jS4H5O4fBh1rKvRIQt/K9scgte65LouqPgwuXMrC+RgkfDf9UnhXZXoke9dEaFPR2b+yqyuintICXKK1F59h41G/yiIYcDxKe/+plHzwZmDMsBI2oSAe5FM0De42xO2m4VY9hnfxC3ZSUvoW71IGdA0cMnZX6ESmJ3vkw= ARC-Authentication-Results: i=1; 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=zWgOYWE7 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC5FD4900323 Received: by mail-vs2-x10.google.com with SMTP id 71dfb90a1353d-5c67e512ee6so90194e0c.1 for ; Fri, 11 Sep 2026 23:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1789192960; x=1789797760; darn=sourceware.org; h=content-type:mime-version:message-id:date:user-agent:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=z8decSSXujfwdGi9sE601C97rU5+njjgobs8y/xK+LA=; b=zWgOYWE7486OF9fAF87Vyrtvsaj9wZcqNW0HPz2H9U4x3533/ltMvuoPTaO6wZTeeN M4LvxeNGQZfHZGcFTgIAwT236prB7RHbweAY8a58fEJVrisPDwVaqGhhcO2V0DZHKAJc dis0tqZNOdhHRomWROT9s06m1j9+ar0PXZ69TNOTEOqbKcRWW7moxxHTnYA2rz9mIeO4 WMr6qvBPijM1s9KlDUi6f3YuRf1VF1KyGdNEinS2h+NAaWJ5HgMAoX30nGP6O957fcn4 yrLjpdN/Ar7HGpnpi+QqJqmoWMQKxEVfI9vkZSUNavxm9O+QhFrL05eSmGYwYd0JNlVl 2X3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789192960; x=1789797760; h=content-type:mime-version:message-id:date:user-agent:references :in-reply-to:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=z8decSSXujfwdGi9sE601C97rU5+njjgobs8y/xK+LA=; b=F1vZVE+u5r2RVINITuSElNRIMdawWozWTlI7sNS0G3BF74Cfssp0lXJUlXO7VeknyW t3/nd3APUx2eWO3ISoAV8Ic3jQxGYvT3lrA1kXHxuproGcStQMRf/2Ml3txl8/a2hPcW mgnw7Kk+xLOnNGgQiOjfOz/bIji2L+gQCdV/XSgTBJvNy4XMpUqe1fQvzB7ck4Kgnkce GuxTAD4WOnNspyCVH3fZiECoGfNEGF4AAaYNiPmiDWIhhDlQ0KNVNWRnrnNiy0I9abih oSB6/FMR/q0vtCwfG+guF0AsBB1j9TSD723Lp7Qth5xp6DxV34+gMzxwjto+ZhgadQVK Y5fA== X-Gm-Message-State: AFuF++ndXZbHPr5BNbOPjT5AcZDL41HXxEHcsB+kVHrdAUojnqRNmb7d 1/towJOg+Yi0lBdhT5oULYHXR6WwvgU+c4y9MnjkLbVgD3yAkYaTdakNy7cT9mSXSh8= X-Gm-Gg: AYBFou0sxbeO5hsFAra040URM/i6IYRrrpSPXxHAZxB9lKg485yG+/j13dQb+QEtGzb cP/UX0jFe18ysaiQ/Uc+XTqRWkotvPP3bwiHlXwq2si92qHLYxjksoO8iZwa0X7wlceuesadh4f 8i7f6diLcPT/IMYBplzFjtcRWxm+/nobKSsfhtXeBfOgxsa+8CTZVRj2/BNvyKomhyb1g3epU8w Nv9DB+fJReFVrtoKDjFhmB38QdfpXHYjT86/Z+QVWu/FG1SF/qdAaWrPecHgJgxurfNLDUcxHMC gOttQtO4Q8eRR1hIF6rbtlujlRZ5/YFNFv5rM3WZXOUyMlJIu1472Bs26kc/nt9QQD7rXZBwd0Q 2pOmWq1M/qINJANL4vXg9Qwk2m5hW2hL9JP6ve/8TvoV6oq+NMDMdmDyWAaHc9fviA5g5eZSufl r5cAHqb9nRIEJRhrcRkG36JbycJ/FgPI6ySJwCwQ6c/S7Q2ERVCKwMU785+EFBVFV7S4+CLcfMj wzMgdgNjvgntATqO6+F X-Received: by 2002:a05:6122:4b1b:b0:5bd:af82:fd9e with SMTP id 71dfb90a1353d-5c965eea8f8mr978261e0c.8.1789192955522; Fri, 11 Sep 2026 23:02:35 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8083:f04c:42e3:5943:38f6]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5c847122e2dsm5796948e0c.14.2026.09.11.23.02.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2026 23:02:34 -0700 (PDT) From: Thiago Jung Bauermann To: Christina Schimpe Cc: gdb-patches@sourceware.org, tom@tromey.com Subject: Re: [PATCH v4 02/13] aarch64: Implement gdbarch function top_addr_empty_shadow_stack. In-Reply-To: <20260708143639.2214689-3-christina.schimpe@intel.com> (Christina Schimpe's message of "Wed, 8 Jul 2026 14:36:28 +0000") References: <20260708143639.2214689-1-christina.schimpe@intel.com> <20260708143639.2214689-3-christina.schimpe@intel.com> User-Agent: mu4e 1.14.3; emacs 30.2 Date: Sat, 12 Sep 2026 06:02:32 +0000 Message-ID: <87h5jvqa6f.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain 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 Christina Schimpe writes: > @@ -3243,7 +3196,7 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) > { > set_gdbarch_get_shadow_stack_pointer (gdbarch, > aarch64_linux_get_shadow_stack_pointer); As I just found out and I just mentioned in my email on patch 8, ideally this gdbarch hook should be set unconditionally, not only when tdep->has_gcs_linux (). But this would be a change unrelated to your patch. I can make it later when I submit patches enabling "bt -shadow" for AArch64. > - tdep->fn_prev_gcspr = aarch64_linux_dwarf2_prev_gcspr; > + tdep->fn_prev_gcspr = dwarf2_prev_ssp; > } > } > > diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c > index 848cee3043c..d789b8569d2 100644 > --- a/gdb/aarch64-tdep.c > +++ b/gdb/aarch64-tdep.c > @@ -1908,6 +1908,26 @@ aarch64_pop_gcs_entry (regcache *regs) > regcache_cooked_write_unsigned (regs, tdep->gcs_reg_base, gcs_addr + 8); > } > > +/* Implement the "top_addr_empty_shadow_stack" gdbarch method. */ > + > +static bool > +aarch64_top_addr_empty_shadow_stack > + (const CORE_ADDR addr, > + const std::pair range) > +{ > + gdb_assert (addr >= range.first); > + > + /* For AArch64, addr must be strictly less than the upper address in the > + range, but other architectures allow it to be equal to the upper > + address when the stack is empty so GDB core works with those addresses > + and can send them our way. */ > + gdb_assert (addr <= range.second); > + > + /* The GCS grows down, and the oldest entry isn't an address. > + Just the value '0'. */ > + return addr >= range.second - 8; > +} > + > /* Implement the "push_dummy_call" gdbarch method. */ > > static CORE_ADDR > @@ -4783,9 +4803,13 @@ 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); > > - /* AArch64's shadow stack pointer is the GCSPR. */ > if (tdep->has_gcs ()) > - set_gdbarch_ssp_regnum (gdbarch, tdep->gcs_reg_base); > + { > + /* AArch64's shadow stack pointer is the GCSPR. */ > + set_gdbarch_ssp_regnum (gdbarch, tdep->gcs_reg_base); > + set_gdbarch_top_addr_empty_shadow_stack > + (gdbarch, aarch64_top_addr_empty_shadow_stack); > + } On the other hand, since this is new code added by this patch, could you please change this to the following? if (tdep->has_gcs ()) /* AArch64's shadow stack pointer is the GCSPR. */ set_gdbarch_ssp_regnum (gdbarch, tdep->gcs_reg_base); set_gdbarch_top_addr_empty_shadow_stack (gdbarch, aarch64_top_addr_empty_shadow_stack); -- Thiago (he/him)