From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ZAd9K8c5MmqyfwsAWB0awg (envelope-from ) for ; Wed, 17 Jun 2026 02:08:07 -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=i9Eg/V1+; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A10BC1E024; Wed, 17 Jun 2026 02:08:07 -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.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 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 967731E024 for ; Wed, 17 Jun 2026 02:08:06 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 30D8D47BAD62 for ; Wed, 17 Jun 2026 06:08:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30D8D47BAD62 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=i9Eg/V1+ Received: from mail-ua1-x92b.google.com (mail-ua1-x92b.google.com [IPv6:2607:f8b0:4864:20::92b]) by sourceware.org (Postfix) with ESMTPS id 831794898CB5 for ; Wed, 17 Jun 2026 06:07:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 831794898CB5 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 831794898CB5 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::92b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781676460; cv=none; b=Tv8bXBu8WH41nnXhfIwsvGDREwuGrkJRtSSUyUxFmr7VoIi0AO6Bl5x08BEaHBKM7OgHuj134VoSdKtxZPtPKYt4a0oBJa3HDc060ReRpLv8+rcEqpkKBX+cNHBRa9ZPW2pjW6cZ+CEj91vyMHngT2zZec3OqLyfGmB2ku9BOtw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781676460; c=relaxed/simple; bh=fnXE8EHM6ZS2hL81GCMQZ1rz0eaV+xAMKxdN4jaMP2Q=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ndre6YqVb1yLN3rOFdhrBJPSbIaRpo/KHKEhagcUVNoFeql2qT2SMwRVKP0WH8tH4XZ0gcsrghRZaW1G95c4HizTgH+7DaIrZBDpJomxjkPhoFqXcDZ3fxnejGa4EBNJt60OcVWQEJzO5CCToIdjOF6mpRfI5o3p3L+2EgzpH6Y= ARC-Authentication-Results: i=1; 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=i9Eg/V1+ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 831794898CB5 Received: by mail-ua1-x92b.google.com with SMTP id a1e0cc1a2514c-9667ea2fc22so1155868241.2 for ; Tue, 16 Jun 2026 23:07:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1781676460; x=1782281260; darn=sourceware.org; h=content-transfer-encoding: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=CU8ImXeQ4YNEATR7mfOYpv5ADEduJKdewMXkEkFoAYU=; b=i9Eg/V1+F6WX56iHiiIcjegzSoFMQ641nNFofFzL72CgtwFH9dFM3a1n5qkTdfMU5t +HpApuUWAAy9HHoK2kaSKCxqSbyKRFTMAJSb1C5jALrVjOpk92b1xG02I2iKeEF9awmF BF2RUiIIh63wd53nK5wv3rr/hpExx8t2s7CZSDfZfXxkT8bzVSev55+SasVqFPUZX8hc 2pdm/zu6cvG62HrtV/Ha3KxGObP0KoY0kuOf+q0mPrzcmW/yAK3qZwXBBOAINR0gwZYI cZw7woWExPuvPa0uu1xuoRDKWXa0BEqOJAhmjW2LsnhjYKEVJ1tNUFQLwODXyuzPG7MU AL8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781676460; x=1782281260; h=content-transfer-encoding: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=CU8ImXeQ4YNEATR7mfOYpv5ADEduJKdewMXkEkFoAYU=; b=NlfaVcpD5Ef7adFL7Uux98wEXe/a+DjM8gbN4q1MVG70x8TB0V0hhxi3gdpNRPXwTu m3ftQw+2oOg8+3aR9ysy1b2KaLFL4OTnV13RLOwg1chsgUYnAY0KGIul2ZoNwYyEGcsp jq7J1SjlkYc3DEzBWD7FpnwOx4yhKxTvsDqqnvTRbMiEW+98/4GZb4eLDcs/hIhDaILS Keaep99olij3dEcSdUVqd3QO/AgEN2jxsBAkv/PnZbD+o9EFIH7GeO/52DrwacRiuv5q v3+qa+eaLUfQzCBkX9ijDfm3y/SSGLKeAxMcqy6ULITf+VqZyby4nT3A/h9ZTkpUct9H Fetg== X-Gm-Message-State: AOJu0YyThh7jFVxykzm0jX77MIu7zGnjd88PvpcUhMdWFicGzhOEXPCL w8WNn5IOHv6ngnPPod16KJBpyhXyK9fOXU1NaT25B5E8wXTEnJtyI7NiCKd5S1HzShQ= X-Gm-Gg: Acq92OHxPgzYuWdWA1+q0npEd4ygJ6qFNI88+S/fZ2+L7zQ+blfiHS6yG/Mxoi0sWYO 7LnVeHlP4GNq3lHN0qMXD8ndZXlJYi8Cqo1zBusX+ywJy2vFJKzb7o6oCOuBwNpJSfQfQ8ixNmC Y8DHyz5wFOVKBuyi+dt4KNNEIYhsGeobf8CBaOnGNnncov/N2AAoGdNScnybkbdR2iFRuyULvVR /SXkSyyojS5mSBmzqz6PrjETicBUC+djIl8wKMbPdutLjefiNSiWnw0vlfMFF1g6dgUDFjQ6/CS zhE/o2PjzX3YIkfYIRU8xfgDBU4fv1KmLR5IosjsgdW4S/JxURqkgdzjdhkG2uj63t0kIeNvNYD IXQEuJc5QGF8cQ5TZOZcODxKBBm+TiX/4XlPYnmNo7a5tFozWSjk0zEAyh9rM1gL2crI7Ycti+S lTpzPysviH64mRTvn4NoshprY= X-Received: by 2002:a05:6102:3e8e:b0:6a2:cfe7:20b3 with SMTP id ada2fe7eead31-7245cec5b48mr1307833137.2.1781676459791; Tue, 16 Jun 2026 23:07:39 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8083:f04c:42e3:5943:38f6]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-72084dd24cbsm6552034137.5.2026.06.16.23.07.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 23:07:38 -0700 (PDT) From: Thiago Jung Bauermann To: Matthieu Longo Cc: gdb-patches@sourceware.org, Tom Tromey , Andrew Burgess Subject: Re: [PATCH v1] gdb: align siginfo_t with the Linux kernel definition In-Reply-To: <63fce133-4d28-4629-9a60-6d14cba49b86@arm.com> (Matthieu Longo's message of "Fri, 12 Jun 2026 11:42:45 +0100") References: <20260612101610.592338-1-matthieu.longo@arm.com> <63fce133-4d28-4629-9a60-6d14cba49b86@arm.com> User-Agent: mu4e 1.14.1; emacs 30.2 Date: Wed, 17 Jun 2026 06:07:36 +0000 Message-ID: <87se6lhf87.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 Matthieu, Matthieu Longo writes: > On 12/06/2026 11:16, Matthieu Longo wrote: >> GDB's current definition of siginfo_t is missing many fields present in >> the Linux kernel definition [1]. >> These fields are useful for providing detailed, user-friendly diagnostics >> when a fault occurs. Some new AArch64 extensions, such as Permission >> Overlay Enhancement used to implement Protection Keys [2], require the >> debugger to inspect 'si_pkey' alongside 'si_addr' to help the user ident= ify >> the problematic key. >> This patch aligns GDB's definition of the __sifields._sigfault member of >> siginfo_t with the definition from the Linux kernel master branch. >> [1]: https://github.com/torvalds/linux/blob/2b414a95b8f7307d42173ba9e580= d6 >> d3e2bcbfce/include/uapi/asm-generic/siginfo.h#L69-L100 >> [2]: https://lore.kernel.org/all/20160212210213.ABC488FA@viggo.jf.intel.= com/ >> --- >> gdb/linux-tdep.c | 39 +++++++++++++++++++++++++++++++++++++-- >> 1 file changed, 37 insertions(+), 2 deletions(-) >>=20 > I was not sure who I should include for the review. Please feel free to C= C the right > persons if they are not already in the list. > > I tested the patch above, and it seems to work fine without any change in= ./gdb/nat > However, in my understanding, compat_siginfo_t should also be impacted. W= hy is it still > working then without any change ? =E2=8B=AE > aarch64_siginfo_from_compat_siginfo (in gdb/nat/aarch64-linux.c) and its = friends for each > backend seem to provide some conversion logic between the siginfo_t from = the system > (/usr/include/asm-generic/siginfo.h) and some internal representation com= pat_siginfo_t. > From my research, this seems needed because, if the host and target syste= ms are not using > the same ABI (endianness, size of a pointer or int, etc...), GDB cannot r= ely on the local > definition of siginfo_t to interpret correctly the data in the blob that = it received from > the target. compat_siginfo_t is used when the inferior is an AArch32 process while GDB is AArch64. This will cause the 64-bit kernel to use the syscall compatibility layer =E2=80=94 and thus the 32-bit definition of siginfo_t = =E2=80=94 which GDB's compat_siginfo_t aims to represent. > However, I am confused by the definition of compat_siginfo_t in gdb/nat/a= arch64-linux.h > for instance. I see that addresses like _sigfaul._addr are converted to '= unsigned int' > (that should be equivalent to uint32_t I guess). Why is this working ? > > Please, could you provide explanations on the above, and guidances on the= changes required > in struct compat_siginfo_t ? I'm not sure I understand why it wouldn't work. In the example of _sigfault._addr, it is an unsigned int (equivalent to uint32_t as you point out) so it will match the width of the void * used for the corresponding void * field in 32-bit userspace. This is converted to siginfo_t's 64-bit void * in aarch64_siginfo_from_compat_siginfo with: to->si_addr =3D (void *) (intptr_t) from->cpt_si_addr; Do you see a problem in this process? --=20 Thiago (he/him)