From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4FiODa5Ol2l0rgEAWB0awg (envelope-from ) for ; Thu, 19 Feb 2026 12:55:58 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=sHoocc0U; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 1AAD51E089; Thu, 19 Feb 2026 12:55:58 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,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 0E7991E089 for ; Thu, 19 Feb 2026 12:55:57 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 3BD8F4B9DB61 for ; Thu, 19 Feb 2026 17:55:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BD8F4B9DB61 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=sHoocc0U Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id A18CC4B9DB57 for ; Thu, 19 Feb 2026 17:55:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A18CC4B9DB57 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A18CC4B9DB57 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771523728; cv=none; b=DnkWl5NxNyYjtAEJc2b0S4udyBuUTGJwvGPzobJNhT5Uod06tDZ3x/tIsUiAfnLV0slbM51NZrdw6uUz7WjonccP1Foa0VVMqV3IsLgrOxcZcqjpTiIwRSvOT5JJOUcoyBoyjdHbNz7tcEYqDHTEK53WRy7/S27uva3ftbN+Brs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771523728; c=relaxed/simple; bh=g78jZH40ghnBQUvGDdC09tfjPuah1u+/PD9VdBVuQCI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=H/a7okPuQ8YqQbyPzBAdm8TFrtiPFhHNMUaoSES13JlFZWU/eA9VC2YhTwjROGfFts4EIeACNzJvStD8JWJWZhLp1sgxWY9j8953GJ5EQzl2bIkvGsbRWWxO56BxoNEXBcu4Aygu1YV8nRLgsQ8yRkzDscSxFqglsLLIHE+SXx8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A18CC4B9DB57 Received: from eig-obgw-5007b.ext.cloudfilter.net ([10.0.29.167]) by cmsmtp with ESMTPS id syx8v6IFUaPqLt8FLv9f81; Thu, 19 Feb 2026 17:55:27 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id t8FKvKHufV6WMt8FLvwRjx; Thu, 19 Feb 2026 17:55:27 +0000 X-Authority-Analysis: v=2.4 cv=E//Npbdl c=1 sm=1 tr=0 ts=69974e8f a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=HzLeVaNsDn8A:10 a=ItBw4LHWJt0A:10 a=QyXUC8HyAAAA:8 a=zstS-IiYAAAA:8 a=g-jHjdUJOxYlhT0eonEA:9 a=4G6NA9xxw8l3yy4pmD5M:22 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=NpBNJFep6vaQb5exBNdphHSQT7pt4J4g1ANcIOk05TE=; b=sHoocc0U6kiB4pTnl2WVYhNBQq igweKwxrRqbNOVnPyUbTKPqWTsIYtXNf9Q7N6DmXzW5Xw9iiX/cvalExvoOldQg+YC6UVbIo44Iii OSaHG0gAQUp3UjWY8AuVZ7qze; Received: from 97-122-122-234.hlrn.qwest.net ([97.122.122.234]:37746 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vt8FK-00000001xeR-1jN9; Thu, 19 Feb 2026 10:55:26 -0700 From: Tom Tromey To: Christina Schimpe Cc: gdb-patches@sourceware.org, thiago.bauermann@linaro.org Subject: Re: [PATCH v2 1/9] gdb: Generalize handling of the shadow stack pointer. In-Reply-To: <20260123080532.878738-2-christina.schimpe@intel.com> (Christina Schimpe's message of "Fri, 23 Jan 2026 08:05:23 +0000") References: <20260123080532.878738-1-christina.schimpe@intel.com> <20260123080532.878738-2-christina.schimpe@intel.com> X-Attribution: Tom Date: Thu, 19 Feb 2026 10:55:25 -0700 Message-ID: <87ecmg62k2.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.122.234 X-Source-L: No X-Exim-ID: 1vt8FK-00000001xeR-1jN9 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-122-234.hlrn.qwest.net (bapiya) [97.122.122.234]:37746 X-Source-Auth: tom+tromey.com X-Email-Count: 13 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfMaYpQhVuyNp/bcPWG6JT8owW9QSGfYGOybaTPY/4z5SGwUlQvloElzVmwFOMjL70t2414X+4Qed2uIQS3l6Z8xSjWchdUKaGkbyH+iEvRidkIbkkHSl JQt41zzHmV4zTF3QIcIORDhhjT4kmdknyMiQXnXmu6BRIBFuj+2zz8sa4rgOGVPIS23Z4ngg8adc9LYWSlHSwwsgRqIIj6KnO9o= 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: > Until now, handling of the shadow stack pointer has been done in the > target dependent implementations of the gdbarch hook > 'gdbarch_shadow_stack_push'. Also amd64 and aarch64 linux specific > unwinders for the shadow stack pointer are implemented. > In a following patch a command line option "-shadow" will be added to > the backtrace command to print the shadow stack backtrace. This requires > more target-independent logic to handle the shadow stack pointer. To > avoid that we duplicate the logic, add new source and header files > "shadow-stack" for the implementation of shadow_stack_push and shadow > stack pointer unwinding in a target-independent way. This looks reasonable to me, but I think someone else ought to examine the arch-specific bits. Like I mentioned in another note, be sure to run check-gdbarch.py. I had a nit or two, plus a question, but nothing really serious. > +static void > +amd64_init_reg (gdbarch *gdbarch, int regnum, dwarf2_frame_state_reg *reg, > + const frame_info_ptr &this_frame) > +{ > + if (regnum == gdbarch_pc_regnum (gdbarch)) > + reg->how = DWARF2_FRAME_REG_RA; > + else if (regnum == gdbarch_sp_regnum (gdbarch)) > + reg->how = DWARF2_FRAME_REG_CFA; > + else if (regnum == AMD64_PL3_SSP_REGNUM) > + { > + reg->how = DWARF2_FRAME_REG_FN; > + reg->loc.fn = dwarf2_prev_ssp; > + } > +} > + > void > amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch, > const target_desc *default_tdesc) > @@ -3650,6 +3667,9 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch, > set_gdbarch_in_indirect_branch_thunk (gdbarch, > amd64_in_indirect_branch_thunk); > + set_gdbarch_ssp_regnum (gdbarch, tdep->ssp_regnum); > + dwarf2_frame_set_init_reg (gdbarch, amd64_init_reg); > + I was curious why this code refers to tdep->ssp_regnum but then the regnum seems to be hard-coded in amd64_init_reg. > +enum class ssp_update_direction > +{ > + /* Update ssp towards the oldest (outermost) element of the shadow > + stack. */ > + outer = 0, > + > + /* Update ssp towards the most recent (innermost) element of the > + shadow stack. */ > + inner Mildly prefer a trailing "," on enums. That way if a new value is needed the patch doesn't have to touch this line. > +/* See shadow-stack.h. */ > + > +void shadow_stack_push (regcache *regcache, const CORE_ADDR new_addr) Newline after 'void' Reviewed-By: Tom Tromey Tom