From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +uqaIAhHqml4ThgAWB0awg (envelope-from ) for ; Thu, 05 Mar 2026 22:16:24 -0500 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=bfUnkQpm; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 721451E0DD; Thu, 05 Mar 2026 22:16:24 -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.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 901081E08D for ; Thu, 05 Mar 2026 22:16:23 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 0F6AC4BA23D5 for ; Fri, 6 Mar 2026 03:16:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F6AC4BA23D5 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=bfUnkQpm Received: from mail-vs1-xe36.google.com (mail-vs1-xe36.google.com [IPv6:2607:f8b0:4864:20::e36]) by sourceware.org (Postfix) with ESMTPS id EED7A4BA2E08 for ; Fri, 6 Mar 2026 03:15:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EED7A4BA2E08 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 EED7A4BA2E08 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::e36 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772766956; cv=none; b=siJOE9yHhQ5gZ6HXe9o0tbfNXPfnlyYFwTZ3PBAjSWj12JdgVDakXE+C4CXQYKMBT1q6PuZGhx3uNTqeRn8sX3qMbcLM0Exk5AK1Lzm4YVLhAv+xqcJ3pxPdSy3XvKsXRxFjwEsyUPfucs4kfGrUrUfKdvrbGGq7htHicNEXl8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772766956; c=relaxed/simple; bh=MRYOXq3dnU32VNUfPHo0XBm/UmC7IEvkR8E2KZwdMRc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=px5ZrwTyLWs+9kFkTE2a8qsq5Apzj/QQL5fP2G83SiwmJvP4sxcmYGljIGQtcPDehTPOHib3oANOW5AqQiJAHf22ASg3GGFMxVYsTlFuszhiGXtqPgp3XqkxpulKCx8lMuXVS5JNG1zOkycmYFqqMO6u1gRt+idzrV7EaEdcc4k= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EED7A4BA2E08 Received: by mail-vs1-xe36.google.com with SMTP id ada2fe7eead31-5ffe688cb8dso109620137.0 for ; Thu, 05 Mar 2026 19:15:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772766955; x=1773371755; darn=sourceware.org; h=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=r8shxMmyDA5cuMvSfyP2zm1Jkofg35HBSvv+JW04BSY=; b=bfUnkQpm6/jLd9MKVxWGSx+jmJ331rc/lDALlNSPXqPzgfTR42VMxM47goGgM9ZLbm CqlUg7725bCGWZjiVP8ZdNVlfqDZopUnB6Cv9tLHcH1mQDo6HW84SNEjxqZk8l7Bxgoq k9P9l7750OtBQwcNwMKn+Az7yXPrbIHSzh+okstX9Jy21WK7IbmZVwTDbIhlH1ooE9JZ hQq49RoingCsHFsZmscxV9nriqrsK+DOo93Rd7prj7hNOXf490kmIxKgJPrFQG29z0WE xrpHSdHBOJxKFAx80FmcshumL+Si4jedj4JjoxH9y0tmoJz5gM+vPLE2CocxhphxwcY7 xBsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772766955; x=1773371755; h=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; bh=r8shxMmyDA5cuMvSfyP2zm1Jkofg35HBSvv+JW04BSY=; b=JyzFQDOOF3/eL9IkF0JRj8Evhd16APZ/KoKA+6EobDjyaYYmKYjNnnsuT4Lc2tOJHY aGW6QJSX1fLPGH82ffQSVI3lav5NcfZuZ4UZ4AObqdL9XnREC7dtumV59jVTMFUguNoH V+HXcLIH4Y0oMg6idH/yM2MN5utVesLDNvO9ISs+V9Es13K+4DDUBoiVhWTGQcLNA5sq MJH30EdgHlmCxuVqRv1ax1+Ikzmp5znvdjZPwKvmMBEcUDiTOp15RcH+oZ/p9ZKm6YaY B88P8Ib9RTAZVY7LhTlqBE5Z6Ao9UZuJwr44SvijDHUAxpgfDZFfQSpUhlFrhie2Hj8W u8gA== X-Gm-Message-State: AOJu0YwDWd46+zK5SGt+k1ykazsL9OilzRhW9y6NQNlBim2Ip11ruinS W5Dc0DB1PxA5swfNv9x16maLPRJCuXdiRWcEXge6n7f5YKhkqCbuEqlVpNhPVENiMZoFfKgRmbK yQdKW1pQ= X-Gm-Gg: ATEYQzwL4HnoPXH3E85mebFpOEgbjiLppFWj9dRP14u0yLP+g42b2/weG1T8LPiYJKR FsPohCWG+oIzn3MmMsm/liCInIgp+gaQyypQuGrxxI8RQsxlVxOmdX59ky4F1sI1wQxce5u/3gx +ERAMSxhllrv9QE4lpHH/nWr+DDaB9cJJ8Rc6GhkrshNQ7HLJmowjDNq8yRHUwvKJ8STWCJFME8 ebn99iuNlrxkT3VaPrgef+2pylNS/odzIsUMq7/Fj3RXv1YSIR0fKHOsrz5XG4h+yINvlkd89aS avdYRucqQkWbqNgjatB+7lAyICz9f4O+Kl46QE3j8+o+HFT3FxZmZC3ky/bDWkuEhfHBBoAEKfc Y6uDrkX61OcDhY0hjiOUPlWhYNIpD54dQIAmLZlxXHa/SFPp4kxei8dgq44H95WjEC7PORXQPAb ROu6C0Si/whAy4117/sfgePPVIYtoMirLHhw== X-Received: by 2002:a05:6102:c14:b0:5ff:c289:47d with SMTP id ada2fe7eead31-5ffe610d7a0mr263040137.22.1772766955254; Thu, 05 Mar 2026 19:15:55 -0800 (PST) Received: from localhost ([2804:14d:7e39:8083:f04c:42e3:5943:38f6]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-5ffe8bd6d6bsm224520137.10.2026.03.05.19.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 19:15:54 -0800 (PST) From: Thiago Jung Bauermann To: Christina Schimpe Cc: gdb-patches@sourceware.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> User-Agent: mu4e 1.12.15; emacs 30.2 Date: Fri, 06 Mar 2026 00:15:52 -0300 Message-ID: <871phxzlzr.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 addressing my review comments! Just a couple of comments: Christina Schimpe writes: > +static bool > +amd64_linux_top_addr_empty_shadow_stack > + (gdbarch *gdbarch, const CORE_ADDR addr, > + const std::pair range) > { > - 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 = amd64_linux_dwarf2_prev_ssp; > - } > + return addr == range.second; > } Next week I'll provide the AArch64 implementation of this hook, if you can squash it into your patch. > diff --git a/gdb/shadow-stack.c b/gdb/shadow-stack.c > new file mode 100644 > index 00000000000..77d7c07d970 > --- /dev/null > +++ b/gdb/shadow-stack.c > @@ -0,0 +1,166 @@ > +/* Manage a shadow stack pointer for GDB, the GNU debugger. > + > + Copyright (C) 2024-2026 Free Software Foundation, Inc. > + This file is part of GDB. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +#include "defs.h" > +#include "arch-utils.h" > +#include "gdbcore.h" > +#include "extract-store-integer.h" > +#include "frame.h" > +#include "frame-unwind.h" > +#include "shadow-stack.h" > + > +class regcache; This forward declaration should be in shadow-stack.h, since the shadow_stack_push prototype declared there uses it. -- Thiago