From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cjT4NongtGqL3zsAWB0awg (envelope-from ) for ; Thu, 24 Sep 2026 04:34:17 -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=mek/xclB; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id CD0AC1E06B; Thu, 24 Sep 2026 04:34:17 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.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 autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 3EBB31E033 for ; Thu, 24 Sep 2026 04:34:16 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BD80E4BB3BBE for ; Thu, 24 Sep 2026 08:34:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BD80E4BB3BBE 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=mek/xclB Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by sourceware.org (Postfix) with ESMTPS id 700114BB3BA6 for ; Thu, 24 Sep 2026 08:33:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 700114BB3BA6 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 700114BB3BA6 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790238827; cv=none; b=ZOoK97YtbfRsAF9E8qJkInHKI0/tl+MIFuQotSKn7sUvffESTc83Cqc7HQlGwhEi9gcycekxk/dDolqGfIzVelH0sRj/DUGVelZ1KHq1DQzvZAibIKjKA+FPmdX4ntxmrzeOZv27q7qyKnpKcZNtq4EIvovXzG/PBlxmyNXCBwQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790238827; c=relaxed/simple; bh=H+hj2nGGOQqfeGgjgKJV7nseDyDr6lrlzrpMLnaVoNM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ESoLpaXHtms/PZfA0LXcAmLfcD+6K/2qFVIInE8OlvXIHvWbHttI8c70Pw0oHczEShwThdFdk04c5UotyyWSkyw6V3uvdE1CpPO03rJuUdezt2PlRisQBWQGjoCQfuwmwysKVCVz0SujoRxczni6hTnBIy5D2N8bkIBPzaJnLdQ= 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=mek/xclB DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 700114BB3BA6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1790238827; x=1821774827; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=H+hj2nGGOQqfeGgjgKJV7nseDyDr6lrlzrpMLnaVoNM=; b=mek/xclB6nisog40C2hqXTP0RXDvYRXLYXdKnhikiogD4OHxAjl6NCqo KZIWVwYp8nESBcFD0g35iDeEC6Ugl4fvG0B/HylrMph2o3MBBzKiWNSHw bsZEPOAo02cG7FpKSPN8czlD1fZVARIKquatVh/hpFafMDmC6sDpz5ptF 3P0Z0DMT1LO0uLn3OdRRtOmozZ1wOHGDfHL36fmwxjOw+jVNIxrd/zQmZ uV/6wloBTBzAnzodmbYf1wLopewR2e+5oBE4ry3d4x75KKsHjrCwHcQkK ds1Wq4tRYVSd3FWIUbVTioyRZNw6LX6tnLNeZsAYRe3ifMi2lBmn61rkN Q==; X-CSE-ConnectionGUID: XTQzw8CzRi+/LvRctgAObQ== X-CSE-MsgGUID: w7G4s/kERlSndwY23D6piA== X-IronPort-AV: E=McAfee;i="6800,10657,11914"; a="116524328" X-IronPort-AV: E=Sophos;i="6.27,120,1787036400"; d="scan'208";a="116524328" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2026 01:33:44 -0700 X-CSE-ConnectionGUID: 2CguQXOHSnyn13fQoMPl3g== X-CSE-MsgGUID: l34PjkReQ3+6NYCxsHo0rg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,120,1787036400"; d="scan'208";a="272558902" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2026 01:33:43 -0700 From: Christina Joos To: gdb-patches@sourceware.org Cc: thiago.bauermann@linaro.org, tom@tromey.com, luis.machado.foss@gmail.com Subject: [PATCH v5 00/13] Add new command to print the shadow stack backtrace Date: Thu, 24 Sep 2026 10:32:57 +0200 Message-ID: <20260924083311.1961530-1-christina.joos@intel.com> X-Mailer: git-send-email 2.53.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 Hi all, this is v5 of the series "Add new command to print the shadow stack backtrace". This version addresses the feedback from Luis and Thiago. Some parts of this series are already approved, but for some patches I still need approval from the global maintainers before I can merge this. Changes since v4: - Change the configuration of the gdbarch function top_addr_empty_shadow_stack on aarch64 as requested by Thiago - Change the author of patch #2 to its actual author - Change my last name to my new last name (Schimpe->Joos) - Change assert to error message in patch "gdb: Implement the hook 'is_no_return_shadow_stack_address' for amd64 linux." - Fix some error messages, so they can be translated properly. - Improve some comments and nits This is an example of the output of 'bt -shadow' on amd64 linux: ~~~ (gdb) bt -shadow #0 0x000055555555514a in call1 at amd64-shadow-stack.c:27 #1 0x000055555555515f in main at amd64-shadow-stack.c:38 ~~~ The normal backtrace includes one additional frame, since the shadow stack backtrace relies on return addresses of the shadow stack only. But except the missing frame arguments and frame #0 of the normal backtrace, the traces are the same. ~~~ (gdb) bt #0 call2 () at amd64-shadow-stack.c:21 #1 0x000055555555514a in call1 () at amd64-shadow-stack.c:27 #2 0x000055555555515f in main () at amd64-shadow-stack.c:38 ~~~ In previous cover letters I kept a number of opens. The remaining ones I am now changing to potential improvements, since I believe this can be changed/added after this series is merged, too. Potential improvements: 1) Thiago suggested changing the frame numbering so that it always starts at #1, since for the shadow stack we don't have frame #0 printed by the normal backtrace. 2) Or, consider printing frame #0 similarly to what the normal backtrace does 3) Consider printing frame arguments 4) Show the selected frame. This is only relevant once the normal backtrace command supports this. Current patch in the mailing lists: https://sourceware.org/pipermail/gdb-patches/2026-July/228417.html. I am looking forward to your feedback! Christina v4: https://sourceware.org/pipermail/gdb-patches/2026-July/228504.html v3: https://sourceware.org/pipermail/gdb-patches/2026-July/228440.html v2: https://sourceware.org/pipermail/gdb-patches/2026-January/224388.html v1: https://sourceware.org/pipermail/gdb-patches/2025-September/221141.html Christina Joos (12): gdb: Generalize handling of the shadow stack pointer. gdb: Add get_main_func_start_pc to refactor frame.c:inside_main_func. gdb: Refactor 'stack.c:print_frame'. gdb: Introduce 'stack.c:print_pc' function without frame argument. gdb: Refactor 'find_symbol_funname' and 'info_frame_command_core' in stack.c. gdb: Refactor 'stack.c:print_frame_info'. gdb: Add command option 'bt -shadow' to print the shadow stack backtrace. gdb: Provide gdbarch hook to distinguish shadow stack backtrace elements. gdb: Implement the hook 'is_no_return_shadow_stack_address' for amd64 linux. gdb: Enable inferior calls in the shadow stack backtrace. gdb: Enable signal trampolines in the shadow stack backtrace. gdb, mi: Add -shadow-stack-list-frames command Thiago Jung Bauermann (1): aarch64: Implement gdbarch function top_addr_empty_shadow_stack. gdb/Makefile.in | 2 + gdb/NEWS | 11 + gdb/aarch64-linux-tdep.c | 51 +- gdb/aarch64-tdep.c | 71 +- gdb/amd64-linux-tdep.c | 213 ++--- gdb/amd64-tdep.c | 22 + gdb/doc/gdb.texinfo | 95 +++ gdb/frame.c | 37 +- gdb/frame.h | 6 + gdb/gdbarch-gen.c | 190 ++++- gdb/gdbarch-gen.h | 95 ++- gdb/gdbarch.h | 1 + gdb/gdbarch_components.py | 124 ++- gdb/infcall.c | 4 +- gdb/linux-tdep.c | 9 +- gdb/mi/mi-cmd-stack.c | 95 +++ gdb/mi/mi-cmds.c | 2 + gdb/mi/mi-cmds.h | 1 + gdb/shadow-stack.c | 775 ++++++++++++++++++ gdb/shadow-stack.h | 185 +++++ gdb/stack.c | 316 ++++--- gdb/stack.h | 43 + .../amd64-shadow-stack-backtrace-signal.exp | 49 ++ .../gdb.arch/amd64-shadow-stack-cmds.exp | 71 ++ .../gdb.arch/amd64-shadow-stack-signal.c | 31 + gdb/testsuite/gdb.base/options.exp | 2 +- .../gdb.mi/mi-shadow-stack-signal.exp | 69 ++ gdb/testsuite/gdb.mi/mi-shadow-stack.exp | 93 +++ 28 files changed, 2254 insertions(+), 409 deletions(-) create mode 100644 gdb/shadow-stack.c create mode 100644 gdb/shadow-stack.h create mode 100644 gdb/testsuite/gdb.arch/amd64-shadow-stack-backtrace-signal.exp create mode 100644 gdb/testsuite/gdb.arch/amd64-shadow-stack-signal.c create mode 100644 gdb/testsuite/gdb.mi/mi-shadow-stack-signal.exp create mode 100644 gdb/testsuite/gdb.mi/mi-shadow-stack.exp -- 2.53.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.