From patchwork Sun Jun 22 01:18:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 899058 Delivered-To: patch@linaro.org Received: by 2002:adf:e506:0:b0:3a6:d909:26ce with SMTP id j6csp363674wrm; Sat, 21 Jun 2025 20:32:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUJZufAR69+kE/L1su+lZV0UFWMer4owjEjmneTuEsTM7Yl+VVLYDDah0Hne9x28xlfeIYE4w==@linaro.org X-Google-Smtp-Source: AGHT+IGnFAOJXkc/lzYlEPBZXzOh8swxAW3xSU3B9bEGreoKLZv6dW7YBu3GohF019TsWUFrhgh3 X-Received: by 2002:a05:620a:410f:b0:7d3:c67f:7532 with SMTP id af79cd13be357-7d3f99327ccmr1136617185a.40.1750563157896; Sat, 21 Jun 2025 20:32:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1750563157; cv=pass; d=google.com; s=arc-20240605; b=JwcTesROMNVxb51h1P4aA9fw4ZLmZLqvterEMNG7DF4l8GdZ1Jcm5WcCsY+A5IdHkP MYpB2x6e8Ux+tTAR9/5mWS7QOkjDO73ilcSdajGQSZbs4Zki2dYPsPBQZvrd++BrfWwp OlMPuQW8rKpxAjl5xBUn5H1P7BjbSLDU1kwaVoA+GzNSVNWi9ssGx+walp4n9hXYxmqW cwBCg7O42BjipSeNA44DOnKGGWRxK4orqNWH9fuUNkVK+RDgJbCrkmvHUqnD4GFAbUFS 3nWChdxIq6yWmY2JVhxLp44OEtcWx9unXNWHGQHz89+tWJ7aizHk4XcHbGo0JoC3FUlx ndEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter:arc-filter:dmarc-filter:delivered-to:dkim-filter; bh=SryejAwxQSIF7fwP9/NwZ9Gc37kXENMqoWNtnWJBEs8=; fh=v0Swrqm/HGzmFfs2Lyn4KGEK39u4NVWMm4qGXeDZh/s=; b=llsSoipl8VWFm59eDtT4+lCGP6XFcJqUIsYKm50DIUHmSiD27P3iZPiBB2RfPO2ybJ vUFtoCFZHeueuERGmTOKxGaIWzpNRBrHu7cjNUwfreB5zR2GVdPWEYfL7XLFhItNXMUZ PoaOD3WmFXXKHsloM3zmNrHlvHODLxqrNWIseWVWmuQJEO/Gb4ZVtPNObewwY+cofXqa fqjbQ8nKUeTTdDpz8s5eRhi5HKZEsSjaxrBfXGd84Q7B9gGmo8w2GiS2RDNbu8ZG9hQh skNUZ7at3J1L68TMgcvhjbktxBCMDZWd3dfX+k37NGS7emwRq4lwVa7CafzLYfcNDo3j Kz3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RL9mKeZ2; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gdb-patches-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id af79cd13be357-7d3f999fdefsi512703485a.2.2025.06.21.20.32.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jun 2025 20:32:37 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RL9mKeZ2; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gdb-patches-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2A57339F3513 for ; Sun, 22 Jun 2025 02:52:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A57339F3513 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=RL9mKeZ2 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 99A873829098 for ; Sun, 22 Jun 2025 01:18:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99A873829098 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 99A873829098 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1750555095; cv=none; b=rrP5Oq8ohjfVSp4daNeGyRQ+OtEOVzHPa0AZv7QY+DWy2bx29L+GcFR8j7bDIAqdeMIChrh4bSiel5FRBNO6BcAgZpqklCVpCiJuoRUEIYZCwxNc5qq5y4QuyPmvet6gnLeqtidEKFUL5132eJziYkan3acNoojUlAiNsqYQ8GU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1750555095; c=relaxed/simple; bh=JtAjItbsjTyyDcpG9dlr37C5KTLRD3S5dEqH9A7qETU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=oD4fQ1Z+myshurq3srd5RIpE6qqdZweYRF9eXY3EoqwPsWbp6xPXUs+tArN99fSsLxfrGnaM6QRzsRFQj8r8U8ktMKTSKprkGaHLIrQt18fB7HKH8VRuFyhPP6FvekextJn9PFlMYZCIHPcfDpabpfdn5S5mUiwzzYGPg0yUbh4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 99A873829098 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-234fcadde3eso41690915ad.0 for ; Sat, 21 Jun 2025 18:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1750555094; x=1751159894; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=SryejAwxQSIF7fwP9/NwZ9Gc37kXENMqoWNtnWJBEs8=; b=RL9mKeZ2pbvQvhMxAIb50Itlto+NJQUqSm8DfS40DOGXYvbs8ZIMZwtwVrrZGgo2Qj +hT8IUdxIrcKFyuvJ3lOHKn3rbP4SqAICgpAYME/lKIbhrW+0tLVpEGyQoEH3OcehRaq sW5GSTK3hNYUA+8ANrL0oFJE/0fWl+NhsRNx0ivQUsNLhO4LO+yZ8FTVcl2/taUCsM3s JjyqkN0Csx5ySSSogn9huXZ9wO8zhAYts+KpX7JJAfKaTds4wWS35YwNhwlKtLd8yrg1 LaWOny00lxevXlNRjqAO6jJFjQCENi62KDpG65I8Sp5zfXoZz9CtDfDDQ/ZwLKYk08nb xMaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750555094; x=1751159894; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SryejAwxQSIF7fwP9/NwZ9Gc37kXENMqoWNtnWJBEs8=; b=JOn08b1AeCYr4pCqrvVrpqy4MBKcuagBP5QpIShAyX87HLpts87skLdM+4k1+O6Dml xKbtTcLZl5nKHWrkUdoCqu8MBXw2IKmYKklMwf2OTHD98oSs35j4UDktIavSZi2EPCEz vZMJvvBZP8cv7sBSRD/9zWz4Zkbh+mKlqCBCC8w1Lwp0IbmU8Fmv+b4m8oQQ5mkOatMK fdHKnWVQwW+1yTuQCQQ+pQ76nVus1oXxXMa77YGVf+fwkYeB+XlRrk2gV5pJAzE5uc7x jl2CI25jpNn6Vc92i0LjK3UieWoKWOXX+FoXoZY8tC7WUPBcSWSLflfarIXrFk/4a0OL yqXw== X-Gm-Message-State: AOJu0YwTWG5CBzvy6kufBJsug0TUe+YscJ7KMEMTq9Eii/LWvxbwAEYH tlXSzenlVHEl71A/NrZbZyaGq5F2iEwoN1IPqj5VszRnL1UaA55+W3dSkozOmPxYvw05j5VbWVB hPmme X-Gm-Gg: ASbGncscf4nSgNdglGBpl/9BO/WiE63aR2Gs4/v0L+bguefVhpggrtjl+8ez6xXkhHy 0eqkdUgQL00sFxPBnTOnvaOPL8VNNvzQH5c2YHEPIDOcsi5LJqFLGkgmcOD0aUjiZderY4RMm2F Kpqy00mk7LnFejaNVeLgwH+LFAcW4v7X3GXHahnY/eIh6nRPKG9H+OILKvolLm1saIJzT1oIiDs LEJsJDgA4hZ+bDsM8XOGNy4LXgHeJtg57t9zfxyE1oKEJi1yYFUd8hSpET256bofAIqasn9CUR/ B1ZqkCqh5QYO6JeNVPfzEsVIv4KCA+9ZQr8c11YhWPJT0NGD9Q9HUz007bL/qCV7QYuM8GVx X-Received: by 2002:a17:902:ea02:b0:235:eefe:68ec with SMTP id d9443c01a7336-237d981d6a3mr124585475ad.19.1750555094345; Sat, 21 Jun 2025 18:18:14 -0700 (PDT) Received: from localhost ([2804:14d:7e39:88d6:79ae:7a30:10f3:dfed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-237d860aa41sm50333885ad.106.2025.06.21.18.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jun 2025 18:18:13 -0700 (PDT) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Cc: Eli Zaretskii , "Schimpe, Christina" , Luis Machado Subject: [PATCH v3 0/9] AArch64 Guarded Control Stack support Date: Sat, 21 Jun 2025 22:18:02 -0300 Message-ID: <20250622011811.371949-1-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 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~patch=linaro.org@sourceware.org Hello, This version addresses review comments from Eli and Luis. There are only small changes in patches 5, 8 and 9. The individual patches have changelogs pointing out the differences. As with v2, the first 3 patches are from Christina's CET shadow stack v4 series and are included in this series so that the CI can apply and test it. For convenience, I pushed the branch users/bauermann/gcs-v3 to the GDB repo containing the whole stack. v2 can be found here: https://inbox.sourceware.org/gdb-patches/20250618055445.709416-1-thiago.bauermann@linaro.org/ v1 can be found here: https://inbox.sourceware.org/gdb-patches/20250608010338.2234530-1-thiago.bauermann@linaro.org/ Christina Schimpe (3): GDB: Linux: Add function linux_address_in_shadow_stack_mem_range gdb, gdbarch: Enable inferior calls for shadow stack support. gdb, gdbarch: Introduce gdbarch method to get the shadow stack pointer. Thiago Jung Bauermann (6): bfd/aarch64-linux: Support reading and writing the GCS core file note GDB, gdbserver: aarch64-linux: Initial Guarded Control Stack support GDB: aarch64-linux: GCS support in Linux signals GDB: aarch64-linux: Implement GCS support in displaced stepping GDB: aarch64-linux: Support unwinding the GCSPR GDB: doc: Document Linux AArch64 support for Guarded Control Stacks bfd/elf.c | 31 +++ gdb/NEWS | 3 + gdb/aarch64-linux-nat.c | 79 +++++++ gdb/aarch64-linux-tdep.c | 195 +++++++++++++++++- gdb/aarch64-tdep.c | 156 +++++++++++++- gdb/aarch64-tdep.h | 25 +++ gdb/arch-utils.c | 10 + gdb/arch-utils.h | 5 + gdb/arch/aarch64-gcs-linux.h | 44 ++++ gdb/arch/aarch64.c | 8 + gdb/arch/aarch64.h | 10 +- gdb/doc/gdb.texinfo | 83 ++++++++ gdb/features/Makefile | 2 + gdb/features/aarch64-gcs-linux.c | 21 ++ gdb/features/aarch64-gcs-linux.xml | 18 ++ gdb/features/aarch64-gcs.c | 14 ++ gdb/features/aarch64-gcs.xml | 11 + gdb/gdbarch-gen.c | 54 +++++ gdb/gdbarch-gen.h | 24 +++ gdb/gdbarch_components.py | 31 +++ gdb/infcall.c | 14 +- gdb/linux-tdep.c | 47 +++++ gdb/linux-tdep.h | 18 ++ gdb/testsuite/gdb.arch/aarch64-gcs-core.c | 124 +++++++++++ gdb/testsuite/gdb.arch/aarch64-gcs-core.exp | 107 ++++++++++ .../gdb.arch/aarch64-gcs-disp-step.c | 140 +++++++++++++ .../gdb.arch/aarch64-gcs-disp-step.exp | 90 ++++++++ gdb/testsuite/gdb.arch/aarch64-gcs-return.c | 105 ++++++++++ gdb/testsuite/gdb.arch/aarch64-gcs-return.exp | 132 ++++++++++++ .../aarch64-gcs-tdesc-without-linux.xml | 65 ++++++ .../gdb.arch/aarch64-gcs-wrong-tdesc.c | 26 +++ .../gdb.arch/aarch64-gcs-wrong-tdesc.exp | 48 +++++ gdb/testsuite/gdb.arch/aarch64-gcs.c | 168 +++++++++++++++ gdb/testsuite/gdb.arch/aarch64-gcs.exp | 78 +++++++ gdb/testsuite/lib/gdb.exp | 68 +++++- gdbserver/linux-aarch64-low.cc | 46 +++++ include/elf/common.h | 3 + 37 files changed, 2082 insertions(+), 21 deletions(-) create mode 100644 gdb/arch/aarch64-gcs-linux.h create mode 100644 gdb/features/aarch64-gcs-linux.c create mode 100644 gdb/features/aarch64-gcs-linux.xml create mode 100644 gdb/features/aarch64-gcs.c create mode 100644 gdb/features/aarch64-gcs.xml create mode 100644 gdb/testsuite/gdb.arch/aarch64-gcs-core.c create mode 100644 gdb/testsuite/gdb.arch/aarch64-gcs-core.exp create mode 100644 gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.c create mode 100644 gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.exp create mode 100644 gdb/testsuite/gdb.arch/aarch64-gcs-return.c create mode 100644 gdb/testsuite/gdb.arch/aarch64-gcs-return.exp create mode 100644 gdb/testsuite/gdb.arch/aarch64-gcs-tdesc-without-linux.xml create mode 100644 gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.c create mode 100644 gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.exp create mode 100644 gdb/testsuite/gdb.arch/aarch64-gcs.c create mode 100644 gdb/testsuite/gdb.arch/aarch64-gcs.exp