From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id IKYwGiNQPGrozRYAWB0awg (envelope-from ) for ; Wed, 24 Jun 2026 17:46:11 -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=lwHjMC4M; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5BAB21E070; Wed, 24 Jun 2026 17:46:11 -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 649941E070 for ; Wed, 24 Jun 2026 17:46:10 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 883C44BA23D0 for ; Wed, 24 Jun 2026 21:46:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 883C44BA23D0 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=lwHjMC4M Received: from mail-dl1-x1232.google.com (mail-dl1-x1232.google.com [IPv6:2607:f8b0:4864:20::1232]) by sourceware.org (Postfix) with ESMTPS id 81E804BA2E2B for ; Wed, 24 Jun 2026 21:45:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 81E804BA2E2B 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 81E804BA2E2B Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1232 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1782337544; cv=none; b=G79mJqUrnLD5+rTW/tpLHUqlmVs4uoOHuB84h3aredhcxOQIpLoPNJN3XSAX+ExfL9XAmFYzvNDcbzkabBA5mn/lhXd3PZBioH17VWSBe+duTvm/A9UIpVBo1irAAdxKVGoXrzB6rGnjEwEzVrNU99efArdG0ksF8JJJTH6j8Bc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1782337544; c=relaxed/simple; bh=EjAZs9d7djRqacBO1R4sFJHDFvHqAXsic5/YwKmqTWc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=dCH3Yk2K67yhNMUS73Jtzghe+kmAxmyfLbmGLfUc9tJTIGp/t5mEQ8rv3XUTV+VBZWZE7vrm5TkvdX59ts6EZsrPd1jSbfJVF7oTy0ZalKJ+7NgyCa/DkVo+/WpyoXGuIa0XCy9X61Vx5v3BIfL49aPpcXbFErwltuxwRL62ga8= 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=lwHjMC4M DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81E804BA2E2B Received: by mail-dl1-x1232.google.com with SMTP id a92af1059eb24-139aff562e1so2178645c88.1 for ; Wed, 24 Jun 2026 14:45:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1782337543; x=1782942343; 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=l5r0QMC0Nf+aNUow1ZDuBWuLZCUHI7Z2otcI01pj18I=; b=lwHjMC4M49afwX/c2AU/0qN3LZiZyKUe9rJvf24PDxR9JLLd824GzUMHt5P9NTDAwk mUTXsW+gkY7XhTtVoHQJVPP8v9OWcTuBC0aehTN3DjwuEQODD6+yVuLbPpJRQtVHAdBg URY7DIjA5c6OD+VCL2DkLmS5XSojSROyEPCLlriMkIyfk7Pf6lK9uoerse87kD1e+z7+ rrQW3j3CDuutiB+JTz6f/0ehDmiEDFpgLWpp5RIZlarR7GzNbCVawHqjP0RAO9lbT6zF rOjMIn65RMC/zMStfqzNX1pzM3DW/udhpYTLx2YiTD7dOM+oMx5TsTzyTFdLiB/rrBnC 4btA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782337543; x=1782942343; 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=l5r0QMC0Nf+aNUow1ZDuBWuLZCUHI7Z2otcI01pj18I=; b=KZLWTHRYtR2LAqRO1sBFfHdSsn8I0rHysQia2LNJ7tnzQcumKzEud6/s6zo6uot7gn wu1s9E2t1LZ4ebL6CHFHrajdE5kl2Ur+/NhsJbHTxibK0DGMRzxIs9YpBc6IRPd+lyMQ pDb9S71kyv/NMYUHQO11DqgCaPuMhzqCfiZLAXRtUzZLwyQtNcA3m++QlXktN6yVhB3Q X9KOj5ZqJFTtz/UMYvKfAhQU+IGs7N3MrOtn8XnETwKJL0APpq7eHzg41gjjsDFAPzqC c8chxHTAtYOteuyZHWvMbpA2oVzWuEe6I/t+7xoVOkpCA7e7Rn/mBXMDy1PPCIF82qqw pO1g== X-Gm-Message-State: AOJu0YxovVSQfExGRO7q0EHaFKdK0nUOPDC90vemnQ8MkVOjQrWyIj30 +G8c2alXXxzoiCwGnp8YnLj6IMVRIju8lBtKSIXhR13VySzKhl58m88qSDJMv3v+nec= X-Gm-Gg: AfdE7clGwPL/DsMC3TM3+ETW1zmDXkanJBgsxgBNPfkplLJJ2rVFi0gn5p4RN5u6cXe 6ylibutjwaUyaurN8zasGV5KI1l81zGK+5Py7Ufax5WKvLeDySisSWuGdhrGeMtN32twA60ivGc AGRsk/+b5hselqzYt/WBDoZ1mFDCMmySIqajHNw1Waa4fP03ZaeIw1+vY1J116o8xY9iMMJ2lUF bkS/ZYR96koul9xP1t2DJG0LFeNeKQUwgTar6cmDcb5qTz3bw/fXxgaqF6CsFBgtLLG6EN2W5nj ttTojMpSbS40sKhfhjj13TlsOksvH/zsRbICwU43TmOCz+1JrETEvLsp2VXC0vZy4H7vECss5uB gbDNP2P8CgPytYCcrG+5QYMOBxTQzS6JXb5vPHZN/XMF/leJ0o4bJCZLiJcd830uJShMmiPB9n/ 3wUmxtM5nB8qqzyjXkLxSaLUA= X-Received: by 2002:a05:7022:41a7:b0:139:7a48:651b with SMTP id a92af1059eb24-139d0c10467mr3457533c88.14.1782337543278; Wed, 24 Jun 2026 14:45:43 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8083:f04c:42e3:5943:38f6]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30c7c58831asm1767113eec.13.2026.06.24.14.45.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2026 14:45:42 -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: <9c509d3f-280f-42d8-b12f-100a3d018f09@arm.com> (Matthieu Longo's message of "Mon, 22 Jun 2026 09:42:06 +0100") References: <20260612101610.592338-1-matthieu.longo@arm.com> <87ik7f5ggn.fsf@linaro.org> <9c509d3f-280f-42d8-b12f-100a3d018f09@arm.com> User-Agent: mu4e 1.14.2; emacs 30.2 Date: Wed, 24 Jun 2026 21:45:40 +0000 Message-ID: <87zf0jwr23.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, Sorry for the delay in responding. Matthieu Longo writes: > On 19/06/2026 11:45, Matthieu Longo wrote: >> On 19/06/2026 04:58, Thiago Jung Bauermann wrote: >>> >>> Matthieu Longo writes: >>> >>>> 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 diagnost= ics >>>> 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 ide= ntify >>>> 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/2b414a95b8f7307d42173ba9e5= 80d6 >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 d3e2bcbfce/include/uapi/asm-generic/sig= info.h#L69-L100 >>> >>> Nit: https://github.com/torvalds/linux/ is a mirror. It's better to use >>> the official address at >>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git >>> >> Fixed. Thank you for the fixes! >>>> +=C2=A0 /* used when si_code=3DSEGV_BNDERR */ >>>> +=C2=A0 type =3D arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); >>>> +=C2=A0 append_composite_type_field (type, "_dummy_bnd", short_type); >>> >>> The type of _dummy_bnd isn't that important in practice because the >>> field is just for padding, but its size is wrong AFAICS: >>> >>> $ cat siginfo_t.c >>> #include >>> #include >>> >>> int main (int argc, char *argv[]) { >>> =C2=A0=C2=A0=C2=A0=C2=A0 siginfo_t siginfo; >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0 printf ("sizeof dummy_bnd =3D %lu\n", >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 sizeof(siginfo._sifields._sigfault._addr_bnd._dummy_bnd)); >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0 return 0; >>> } >>> $ make siginfo_t >>> cc=C2=A0=C2=A0=C2=A0=C2=A0 siginfo_t.c=C2=A0=C2=A0 -o siginfo_t >>> $ ./siginfo_t >>> sizeof dummy_bnd =3D 8 >>> >> Sorry, I misread the macro __ADDR_BND_PKEY_PAD. >>=20 >>>> +=C2=A0 append_composite_type_field (type, "si_lower", void_ptr_type); >>>> +=C2=A0 append_composite_type_field (type, "si_upper", void_ptr_type); >>>> +=C2=A0 append_composite_type_field (sigfault_union_type, "_addr_bnd",= type); >>>> + >>>> +=C2=A0 /* used when si_code=3DSEGV_PKUERR */ >>>> +=C2=A0 type =3D arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); >>>> +=C2=A0 append_composite_type_field (type, "_dummy_pkey", short_type); >>> >>> This one also has the wrong size, because uses the same >>> __ADDR_BND_PKEY_PAD constant for the size of _dummy_bnd and of >>> _dummy_pkey. >>> >> Fixed as follows: >> diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c >> index 5baad41a083..19289cf4b3f 100644 >> --- a/gdb/linux-tdep.c >> +++ b/gdb/linux-tdep.c >> @@ -293,6 +293,13 @@ linux_get_siginfo_type (struct gdbarch *gdbarch) >> =C2=A0=C2=A0 struct type *uint32_type =3D builtin_types->builtin_uint32; >> =C2=A0=C2=A0 void_ptr_type =3D lookup_pointer_type (builtin_type (gdbar= ch)->builtin_void); >> +=C2=A0 /* Compute padding length, i.e. __ADDR_BND_PKEY_PAD.=C2=A0 */ >> +=C2=A0 unsigned alignof_void_ptr =3D type_align (void_ptr_type); >> +=C2=A0 unsigned padding_size =3D (alignof_void_ptr < sizeof(short) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 ? sizeof(short) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 : alignof_void_ptr); Nit: the two lines above are indented with spaces rather than tabs. The binutils-gdb repo has an .editorconfig file, so one way to make it easier to follow the project coding style is to make your editor follow it. Many editors have built-in support for the file, others have plugins available: https://editorconfig.org/ > By the way, I forgot to ask. > Would you prefer me to publish a v2 instead of the diff above ? Yes, please. Also note that I can't approve this patch. With the above whitespace issue fixed, you can add to it: Reviewed-by: Thiago Jung Bauermann --=20 Thiago (he/him)