From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id e2FsOi+QtWoNoT4AWB0awg (envelope-from ) for ; Thu, 24 Sep 2026 17:03:43 -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=uhr2GQM+; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id DE4601E01F; Thu, 24 Sep 2026 17:03:43 -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 200251E01F for ; Thu, 24 Sep 2026 17:03:43 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 49E554BB58D6 for ; Thu, 24 Sep 2026 21:03:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49E554BB58D6 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=uhr2GQM+ Received: from mail-vs2-x0f.google.com (mail-vs2-x0f.google.com [IPv6:2a00:1450:4864:3a::f]) by sourceware.org (Postfix) with ESMTPS id F19804BA2E23 for ; Thu, 24 Sep 2026 21:03:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F19804BA2E23 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 F19804BA2E23 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:3a::f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790283799; cv=none; b=U5BP3GlzyADiq5q7dByE8rBtL74OEMskISN08e1QBGtGmKZZDVQv+BZ+z/CmaEWd58sPQjY0Yr1UgFwMFj1gIC8SJK2xU1D5xbc1GtWbd85lhr2FQIvag1ATWBo7pua92BNpnUWVX07Gdw4Njas5aD9KvYsxV/Nr+Ja5S7EC4/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790283799; c=relaxed/simple; bh=rMnfWofGc5jw3q0bnG1lLk20RwuWnQKU9fdFHOMNvXo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=EUh0VH4uTr/wyqn+N0ybOCL16gaTNcwTe2nvhvk6wLv2QdqnTkCdouV126Yb2EVb1UqEkFty4MWaqrIkQ4GOkOf4Vg/CsbSHmXqT8Dzp+jjzbqpLyaEbJYJTxYbPPvi35qPNtqH7lnwVgglsJMSHgxnLF0RxqGAnCm/G+F1AzMY= 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=uhr2GQM+ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F19804BA2E23 Received: by mail-vs2-x0f.google.com with SMTP id ada2fe7eead31-790ec94be85so92542137.3 for ; Thu, 24 Sep 2026 14:03:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1790283798; x=1790888598; 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=op8HuFSUXI6yBqMjGqiGg9cpcq9W5rgjKeZrY7tfkbM=; b=uhr2GQM+z+ldt22uqAogGLQMgNOOWuUBDz1N0wdTxTU6BMv/yds2hoan2dcB9eCB1h REpbV0+RFfc1PxhgsOxgUaEhSqvA54v+Zy7CkkPCDwlYTYLXXjEaz+T/uY4qvYLrD+8k NR8Mj3z6+2g1JWEj0yY4U8IyOcC804v+IQBfU12tzhP4ulxeREjhSa9BXS9z5fhC+zfi ZgYLivlsfv7NQYo49rmF96BGLq2ftORkUCWvD3VTrXLBC/UmSzY0eY9edBMDzwGaK3fQ FJAY90/7NXdP0PWh6zjCYlDFpiDsuUgis9JJg1aetsA4T/gPSSSNM7Pg5FUWqeH5xjD3 gqgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790283798; x=1790888598; 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=op8HuFSUXI6yBqMjGqiGg9cpcq9W5rgjKeZrY7tfkbM=; b=eGrlFynsnTrUjGTJ9oKaE//yI0rKM5ZHNsfLovPdXyLaDbKchf7WsXBd2vFu7V4fo7 wwwuwBZ6M9CMBaFk/XqcubendhzeZ24gKJSCW0zvr1nr47N7AyRH1oUQeRfN+Wd0FHi/ fNTiyJNE3tbS3Erbwir3YjjhoYhCkD9+4zKxA87OnIJq4jffQ8pjlp5qMbn00seOhAz1 j9uAmogIFpZ2rbURzOs/nYJuMp55fK32ROfKdo+Xy8829nkXjn4BZKV0+LpFxbHM5Va+ 97Wk2CXROlS05bq6AJdsGcMMYDjFHX8WT2traYWm8sZDDlw+oZjp820c/m1mCf+0NbYs yMRQ== X-Gm-Message-State: AFuF++n9ZJEYGqCRCzBDj495NlSfPEJ4ow0LqyKm/fAxmKBy5pOOMBFs Ml4KxOXSWzSx6OV3gv0ZX4s6CHAzuQKtFTtyapKx5gHZHOYmlU1wKND7NENiMnjRgCo= X-Gm-Gg: AYBFou3v+Hne8KUzm+wMzQxDxX8XhoqzGnNftS+zzm7tYHw0WddOPyFHiWguhzRhcDS 6q5kSAuINVEuNlM1WGBmQbCQPqxtiZLvvCr2j4hzDTUbob9xFyWPQjgvj2VR7h9bOom3m9JI39d WgJI1tCZMo7ukJSsWp7GKtQtblmOwLELuK7QsUKcFFoRA4UXiqPOysuia5l4LqVHovNWASA+NSh UkEnCYHObavZwOMxBEzFrNbtc1/aKRNZTcDyhKRnA5pa8dUab5XdUv33RtgDAG42vvERrgOE56E jNqNKyPINVr0DwQz+OmnRqyqlrXTAm/kwXlVzEhJK0MF1Q+bFLtNlJB6u81SwYVMBWFtEkqmoBV dWAeKScjcGFnQGZxPXQUIZ9e3uu/IdcJ9oTlMF2xRvvrXBLKd6LVuFWfxxsI7lfGJNbzxXLyn+O az2QM4TY9v5wHj7AzYRUq7KkgROalOR7eFOi/5TQYEamkkGxTZJ0CwNiknrqG/9v9utFHXabUp6 iOkwEQPud0DqViwVWIz5cvFG6ZAYw== X-Received: by 2002:a05:6102:b07:b0:79c:2e36:a2e8 with SMTP id ada2fe7eead31-7b1c4a2ea8cmr104444137.5.1790283797843; Thu, 24 Sep 2026 14:03:17 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8083:f04c:42e3:5943:38f6]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-7b181dc78a6sm355788137.11.2026.09.24.14.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2026 14:03:17 -0700 (PDT) From: Thiago Jung Bauermann To: Christina Joos Cc: gdb-patches@sourceware.org, tom@tromey.com, luis.machado.foss@gmail.com Subject: Re: [PATCH v5 01/13] gdb: Generalize handling of the shadow stack pointer. In-Reply-To: <20260924083311.1961530-2-christina.joos@intel.com> References: <20260924083311.1961530-1-christina.joos@intel.com> <20260924083311.1961530-2-christina.joos@intel.com> User-Agent: mu4e 1.14.3; emacs 31.1 Date: Thu, 24 Sep 2026 21:03:14 +0000 Message-ID: <87ld8ql5v1.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 Hello Christina, Thank you for this new version. Everything looks good to me. Christina Joos 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. Since the > conditions for an empty shadow stack differ betweens ARM's GCS and CET > shadow stack this further requires a new gdbarch hook > gdbarch_top_addr_empty_shadow_stack to unwind the previous shadow stack > pointer. The ARM specific implementation for > gdbarch_top_addr_empty_shadow_stack will added in the following commit: > "aarch64: Implement gdbarch function top_addr_empty_shadow_stack.". > > Reviewed-By: Tom Tromey > Reviewed-by: Thiago Jung Bauermann The Reviewed-by above is for the generic code. For the aarch64 part: Approved-by: Thiago Jung Bauermann (aarch64) > --- > gdb/Makefile.in | 2 + > gdb/aarch64-tdep.c | 54 +++---------- > gdb/amd64-linux-tdep.c | 134 +++---------------------------- > gdb/amd64-tdep.c | 22 +++++ > gdb/gdbarch-gen.c | 126 +++++++++++++++++++++++------ > gdb/gdbarch-gen.h | 63 +++++++++++---- > gdb/gdbarch_components.py | 84 +++++++++++++++---- > gdb/infcall.c | 4 +- > gdb/linux-tdep.c | 9 ++- > gdb/shadow-stack.c | 164 ++++++++++++++++++++++++++++++++++++++ > gdb/shadow-stack.h | 42 ++++++++++ > 11 files changed, 477 insertions(+), 227 deletions(-) > create mode 100644 gdb/shadow-stack.c > create mode 100644 gdb/shadow-stack.h -- Thiago (he/him)