From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id K2npMSXlWWi2WhsAWB0awg (envelope-from ) for ; Mon, 23 Jun 2025 19:37:09 -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=n45c+vRL; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id BAF861E11C; Mon, 23 Jun 2025 19:37:09 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.8 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_SBL_CSS,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE 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 E357C1E0C2 for ; Mon, 23 Jun 2025 19:37:08 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 660B6385141C for ; Mon, 23 Jun 2025 23:37:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 660B6385141C 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=n45c+vRL Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id A0F17385141C for ; Mon, 23 Jun 2025 23:36:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A0F17385141C 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 A0F17385141C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::435 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1750721796; cv=none; b=kRM08R/Y3g4ZzAKVKMqw42j2pCrAEcnbvNsHDQ3GOSVMcJqz95iE4uemO7PgxpeNavQ3SQici9T0refZjCgW/CtyQkzyQsGVutH0wHZOeWe/084ixXbicyE2UljxVLYAYcIzMsJ6suYfgPtkwvWQES4sr/xgYUwOCZwwpwgedZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1750721796; c=relaxed/simple; bh=dC7NBG8QPur442FB3Mny0B8aBUBLDF0Rhh/VXxSUUvM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=HzQoyZNkIBJuOcU02IBHNgDjS/cDzwlpRK3Fo4Gzzjp84nZJgkmYYLd4aeoXkR2gyh1bGY9G8Yd3gv+b6FPd7p+5+vL5k+len35ZlHKHASZ2yPxBPaaYW41nXUAs/PzkJ7dwPbgwfJ2zmO1xXs/8UlUfjfZN0Dl5R83umYDZ6C8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0F17385141C Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-7425bd5a83aso4181918b3a.0 for ; Mon, 23 Jun 2025 16:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1750721795; x=1751326595; 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=3xh2+iCaGgwMgP630z6JqqBOKpoNaRtP5MVjVlbjzx8=; b=n45c+vRLGgdk0h/iPJB5ig+1+boYouWKGBabBD8BrlaYuejJevqMORXythivY5NiqA vtWenlpeS+BTqcSroE3WSQi/PrO8mkCPj2dasvAtPXDeDMH1jH/5cka/gfbIEJnwNnfL xvLXRKLZKlNsZuIm7Ikyv2AD0oAfLCUrPEmCNcllcZ/DM04qkoL+hVMUQLKYPb7povgB /ftXgzExoHPWr3WYKSuZKxC1zQ+cl5YcpgZUrvc2YP60U0ziZcetqWyRG0gR8ZNMmgJ/ hzBDOTQzv9EyQVt95jYXzi0Lf4QOtbhgEvDFLGZgRdeIYl1DAhV1JCe8GiKrLwlOSqbM L63Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750721795; x=1751326595; 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=3xh2+iCaGgwMgP630z6JqqBOKpoNaRtP5MVjVlbjzx8=; b=Y1T4AdwrTm+9HwUSgEp7++4z/iikAxCSnYdHw++Pxy34Rri3Zy1BX6FAPQrXS3iQHZ uVYth5oXo+WBAdsrLuyzbluufQ0ur4aoyo6JDmh7yWd+Hp6TrkgG5DmLjV1xUfMU7D77 hOPFvmP0YoAStArMZnlAPAYHJGSbp6i20OHtEMTQuDZT4zwY8WLNIRhz9QFm4u9XFz/H jZBQys8ncbS4QXrsqfRbQcdUD3zk//zr7HQVSCAVaprBgIJlslkFnkolV3KWs5byPt06 wtBqanQalzyOMIjf/YUJ6q4RfUTnoJSQQOO+o4ResfUJTdE4VMnYXsShHKT9YOyqB/LA RI+w== X-Forwarded-Encrypted: i=1; AJvYcCU30pTGEYjfcq/9x55RIQCaNHeswE5IPnrQbRcEBQ3qTKJ3lTwyIRJ8+SSGBNRneEicSwlhMOZkkO35eA==@sourceware.org X-Gm-Message-State: AOJu0Yw0z2zTSDWHV6T1L0Sxbfw8iUtBLRfmKr3uaxbljJ87amM74thG h95jnXlknYa4B797KlWJ+/uxDlPAxrcA3SWyIx5EZnznI3HxSviWO9DPwfcQmI/7YN8= X-Gm-Gg: ASbGnctUjKKpkcU8hU7IxpQXTjoILIwWrSBskCuI2KoYYbYp3jLsrdS7KoUVwAqXfuv L31aJ5j8iPfvMvWHDyLUYmXTNuqnmet2IKiQQXp3lR1xm5ZjAW17U5/Ld1YkY+Ur5olKa4YzAC1 mToSZ6stXZgKtY250y0T3RhR0yLZWuGfsuRcjDSqOMFNGUuh6sV4LcWzF3aK2fdM4oPFQYmBnYO A7U3qwKbnjlzIjQVilxvUlqwrcCXK7R+EulmX/UqXOKwSEHZPq3jP86074FoODjrRVmpaNwgaIl 3IOV8odhBLRQ8aRvyxPK7NX4440fWsNpXKzdJ64yYMzLExwAGSWSBaQDiyEJn2xzgW/QrUy7Xpx UH/Sy6Q== X-Google-Smtp-Source: AGHT+IFN6GVOS2/PW7cR5C0h02w8xlDeLwoaRnm8W37jOhp/IsHmGYliiYIFLdLIKEf6PytwzJ8nGA== X-Received: by 2002:a05:6a00:1817:b0:742:a0cf:7753 with SMTP id d2e1a72fcca58-7490d5c187dmr26088082b3a.3.1750721795618; Mon, 23 Jun 2025 16:36:35 -0700 (PDT) Received: from localhost ([2804:14d:7e39:88d6:5227:c206:be23:3ef]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-749c882ccc4sm253141b3a.78.2025.06.23.16.36.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jun 2025 16:36:35 -0700 (PDT) From: Thiago Jung Bauermann To: Luis Machado Cc: "Schimpe, Christina" , "gdb-patches@sourceware.org" , "eliz@gnu.org" Subject: Re: [PATCH v4 07/11] gdb: Handle shadow stack pointer register unwinding for amd64 linux. In-Reply-To: <81a32c0a-d9a5-4a58-a6ac-eb8cdb498ada@arm.com> (Luis Machado's message of "Mon, 23 Jun 2025 16:06:27 +0100") References: <20250617121147.1956686-1-christina.schimpe@intel.com> <20250617121147.1956686-8-christina.schimpe@intel.com> <81a32c0a-d9a5-4a58-a6ac-eb8cdb498ada@arm.com> User-Agent: mu4e 1.12.11; emacs 30.1 Date: Mon, 23 Jun 2025 20:36:32 -0300 Message-ID: <87y0tiuj27.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 Luis, Luis Machado writes: > On 6/23/25 16:00, Schimpe, Christina wrote: >> Hi Luis, >> >> Thanks for the feedback. Please find my comments below. >> >>> -----Original Message----- >>> From: Luis Machado >>> Sent: Thursday, June 19, 2025 11:25 AM >>> To: Schimpe, Christina ; gdb- >>> patches@sourceware.org >>> Cc: thiago.bauermann@linaro.org; eliz@gnu.org >>> Subject: Re: [PATCH v4 07/11] gdb: Handle shadow stack pointer register >>> unwinding for amd64 linux. >>> >>> On 6/17/25 13:11, Christina Schimpe wrote: >>>> + Using /proc/PID/smaps we can only check if the current shadow >>>> + stack pointer SSP points to shadow stack memory. Only if this is >>>> + the case a valid previous shadow stack pointer can be >>>> + calculated. */ >>>> + std::pair range; >>>> + if (linux_address_in_shadow_stack_mem_range (ssp, &range)) >>>> + { >>>> + /* The shadow stack grows downwards. To compute the previous >>>> + shadow stack pointer, we need to increment SSP. */ >>>> + CORE_ADDR new_ssp >>>> + = ssp + amd64_linux_shadow_stack_element_size_aligned (gdbarch); >>>> + >>>> + /* If NEW_SSP points to the end of or before (<=) the current >>>> + shadow stack memory range we consider NEW_SSP as valid (but >>>> + empty). */ >>> >>> I couldn't quite understand the difference between the empty case and the >>> unavailable case. But maybe I just don't fully understand the feature. >>> >>> Would it be possible to make the comment a bit more clear? >> >> Is this a bit clearer? >> >> "There can be scenarios where we have a shadow stack pointer but the shadow stack >> is empty, as no call instruction has been executed yet. If NEW_SSP points to the end >> of or before (<=) the current shadow stack memory range we consider NEW_SSP as >> valid (but empty). " > > Yes, that clear it up. Thanks! > >> >> Please also see my answer to Thiago: >> https://sourceware.org/pipermail/gdb-patches/2025-June/218908.html > > Thanks. It would be nice if both series were consistent in this regard (<= or <). I just realised that AArch64 and Intel represent an empty stack differently, so it's correct to have <= on Intel and < on AArch64: https://inbox.sourceware.org/gdb-patches/877c12vy3h.fsf@linaro.org/ -- Thiago