From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0V2AC6pT7GixDi0AWB0awg (envelope-from ) for ; Sun, 12 Oct 2025 21:19:38 -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=Sbd/ptpD; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 2B9951E0B6; Sun, 12 Oct 2025 21:19:38 -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 server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 A89931E04C for ; Sun, 12 Oct 2025 21:19:37 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 525513858C40 for ; Mon, 13 Oct 2025 01:19:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 525513858C40 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=Sbd/ptpD Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id 7AAD43858D1E for ; Mon, 13 Oct 2025 01:19:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7AAD43858D1E 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 7AAD43858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1760318342; cv=none; b=NUzgxO0yR7gMaG9GO676GFVMwmix5RVgodudg3v/k1GcFYrlnYJODF1Rd2KNNJhkP3RYQSN41ceiXSLmgpjhIzfqH4liwhpcNdoS46hGdjJZtKAl54bxEZU7CRHulePewobWSOKpMAPiS4nJAQs5h38vG8hzzmAbZjlvWlXIhr8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1760318342; c=relaxed/simple; bh=3sfIBOvVzHCvJQPQi9bxI0c1N6tinBG2C/HS3noaQhM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ao6Pm2fXYOTM5vvEZ8O8iGRquKDGPA1ntk81e7/RF+PF0aIeWN+sIMDRT0zXJit5CK0JgOeBe6aXfvGWLb7gUNwZ5NgZKESBfDfRxQMBYNQ0ThMWIKku4XTqC8nG2FsWyjoefSZNxQACsmT4w29D58KDsJCdFFa0XH670q5Cn10= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AAD43858D1E Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-273a0aeed57so56765015ad.1 for ; Sun, 12 Oct 2025 18:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1760318341; x=1760923141; 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=zWrJEI9DNh1LprI1kFdBJAyFp1VDyEQW3Lio1ItInqQ=; b=Sbd/ptpDM/yQSqLPpI3b7BEVrkKKPiuuiA6D/yrkrawib/m6fK0440U7d6zS7n4VIc b+qz3o4XazYd1fAijwfoSUwf+OMgaj4R7oehpwBbrjubeJVtphJpYb8mO1CkQYZES9oV MXTCCa6Zmge6/hhSoPo2OFbNLaMUpDeuKnWjrdkMEOzEyqxyviPQLQqTltnhYNPPLZ+Q Ag7e1ocHivuOlizfIoVMwQ3PFledNzCXilF3LTHffkRDqEFLMp8DosgNeQyVIMuqoFBd DZgBTfzNtKoF00tWQ9IFlj8TbLL5G3O7q5QIgYMGxqdOoPvQQRlH8YllET5wWIimaUde t8KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760318341; x=1760923141; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zWrJEI9DNh1LprI1kFdBJAyFp1VDyEQW3Lio1ItInqQ=; b=Qa7pawpOQE9vDPtnGkFCRWI+gyjLXAjT0fkW3uqDlMNRZhMbe58NJLWL22QY+fUU01 OoOTGLh2v1az/2CQhyqsoR5AVCefjc8zj6YRyFKJNDLJ10aLTYE/qitia+c1FsSOKsJi LjjnM2jaP/LXCNxShs85jksVLE9ly2KaFpvSYs2zkHrnhII99aMp0rfCYpY7HGSITVOt /Z/audTVoOZXH1S2bXCFNqjyd3DNu4fpXeQGiDkrSmThwhhLGV0aQLOHTYInIcwffpcE cHMZq/bK9Cf7a8WnFyg0k/m7ERwyd3ojBxYaXGn7f+sOB6jfH/Bvmr8g9oKJCa7cb9Dd HTYA== X-Gm-Message-State: AOJu0YxiJrxWTxwaEzhk6qkBAr8B7MIgLZjEtFhbtdvGhmRnQ/gVKvD3 PftBX7XE7vCfqg6oEmkcAatb1LmBbpX/4wOPNa71gnhVZpoYFY/1j9Hir44ihhseI8FkpStMH78 FEDkK X-Gm-Gg: ASbGnctMiefMx8Ky6PiGYoPgvR6LyZopOAQwuVriWGSPD21YbOZcuG31c2BOC633Hos q2Cd3Cs6b7QHFOLP8DSKRUMeB+AF5Sema51mLxxmjRh5ZN3kG8G96KHZOw4RDeKHwHeX3izMiRI mFJoViT6mioMcSpAZt3Ah/MmGW8mMrJEGIpdLMP/NqyVExXK928pAmgqrs8EjDwj3LCS/GvKKMm NKhbFxsoFqnUYIQVnRpNgmbQueU650uhBuT/J3AXE64aPMkwLiD5tpIwxnDmjEKmR7Qy2XWW89W /gs7okpl6uGxmvUfVnz9DgphFvIT9fCf7NXKQMaIMxWLTQ0ZXSBRdADPGJxiPwpOIOGOZqvThnZ jD+em+X+FpSSoyxIyGiJWzj14Ad+uTP21SnpaSjkIxv93i6Zk8qGtvnClFn9XI/UghQ== X-Google-Smtp-Source: AGHT+IFWe6KMQu6aANXIX/KIoliK0K8XsTZ8hAKCbJluW1WH8qzOyJIhiFUVUEzWze+fFgfs99kccA== X-Received: by 2002:a17:903:1a8e:b0:266:3f63:3500 with SMTP id d9443c01a7336-28ec9c289d7mr280451725ad.12.1760318341388; Sun, 12 Oct 2025 18:19:01 -0700 (PDT) Received: from localhost ([2804:14d:7e39:88d6:d9ee:d9e8:b4ea:6b6f]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-33b6192995asm10348794a91.0.2025.10.12.18.19.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Oct 2025 18:19:00 -0700 (PDT) From: Thiago Jung Bauermann To: "Schimpe, Christina" Cc: "gdb-patches@sourceware.org" Subject: Re: [PATCH 0/9] Add new command to print the shadow stack backtrace In-Reply-To: <871pne2min.fsf@linaro.org> (Thiago Jung Bauermann's message of "Tue, 07 Oct 2025 22:46:40 -0300") References: <20250923111842.4091694-1-christina.schimpe@intel.com> <871pne2min.fsf@linaro.org> User-Agent: mu4e 1.12.11; emacs 30.2 Date: Sun, 12 Oct 2025 22:18:58 -0300 Message-ID: <87wm4zoayl.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 Thiago Jung Bauermann writes: > I tested your patches and there's a bug unfortunately: > > FAIL: gdb.arch/aarch64-gcs-disp-step.exp: continue to breakpoint at blr > FAIL: gdb.arch/aarch64-gcs-disp-step.exp: continue until exit > FAIL: gdb.arch/aarch64-gcs.exp: call inferior function > FAIL: gdb.arch/aarch64-gcs-return.exp: test inferior call and continue: call (int) call2() > FAIL: gdb.arch/aarch64-gcs-return.exp: test inferior call and continue: continue until > exit > FAIL: gdb.arch/aarch64-gcs-return.exp: test frame level update: check gcspr of frame 1 > FAIL: gdb.arch/aarch64-gcs-return.exp: test frame level update: check gcspr of frame 2 > FAIL: gdb.arch/aarch64-gcs-return.exp: test return from current frame: continue until exit > > In each FAIL above a GCS error happens unexpectedly in the inferior. It > appears that GDB isn't updating the shadow stack correctly. I still have > to see what exactly is the problem. The problem turned out to be simple. I just had to set the regnum for the GCSPR in the gdbarch: diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 95af82c26327..9e866fc319d4 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -4780,6 +4780,10 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Register a hook for converting a memory tag to a string. */ set_gdbarch_memtag_to_string (gdbarch, aarch64_memtag_to_string); + if (tdep->has_gcs ()) + /* AArch64's shadow stack pointer is the GCSPR. */ + set_gdbarch_ssp_regnum (gdbarch, tdep->gcs_reg_base); + /* ABI */ set_gdbarch_short_bit (gdbarch, 16); set_gdbarch_int_bit (gdbarch, 32); -- Thiago