From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oSr4CpK+NGorng4AWB0awg (envelope-from ) for ; Thu, 18 Jun 2026 23:59:14 -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=cLATsIKJ; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 284E11E024; Thu, 18 Jun 2026 23:59:14 -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 27BCB1E024 for ; Thu, 18 Jun 2026 23:59:12 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 93FE74B9DB76 for ; Fri, 19 Jun 2026 03:59:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93FE74B9DB76 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=cLATsIKJ Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by sourceware.org (Postfix) with ESMTPS id AC91C4BA2E30 for ; Fri, 19 Jun 2026 03:58:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC91C4BA2E30 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 AC91C4BA2E30 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::f2f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781841517; cv=none; b=o2R0EQ+zrq+x8lmD58ulMRQe4oSimUTTLw82nQbbcjpKn23PRimYg1MB6sJImjS8xA9t0Bttk+OycE1ZZdA2Bz/sBmxnJq6z+VjfNaemN1n0NoisAUw0w4TNoBh2Ydqh59a32mxsz0tV8z6I24yKytBf/n9kQLznPy75nBa/AbU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781841517; c=relaxed/simple; bh=cqYX7c38gWknOV427G68K3PJsmIxBk56eK6GXzzfBFE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Q9HO2n3Wr3VwlenuPf+39JcUaoJhV4FSLNx9JdH3ulesSmcklusPYHrQ13xc+jLsK3wv29jJ9kLq2VdUEb4zif2CSlNfDz8K9QpQl/NWjniWtwVLk5VBDD1Stkf9ZkrJPlTH0unXVqoNFIczrbqWxLsv3ZdoQdw1RJfjYAr6pNU= 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=cLATsIKJ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC91C4BA2E30 Received: by mail-qv1-xf2f.google.com with SMTP id 6a1803df08f44-8dcc3f14b93so19254686d6.2 for ; Thu, 18 Jun 2026 20:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1781841516; x=1782446316; 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=jh1MvgXRcMF76uPuIaipZofylXAa+YY0nuXTZU4knJM=; b=cLATsIKJPi0S/KFUMePW92xcCShxIn/u+RVRPLrdj2sPKKwV4VWrCGeoDVvrbiKFnF vFlt1BHxpi6ZaI32P4/RYGVkduCCaalYoOCOYR/54GY3Eto5o8YrAnI8OXJTHNf29Aub y/oFUeBThw5BCIVelt3EQdFv2RbkvdgvoxDTAKPy9NH82o5lKMDTOrQIY9J+R7jdCvUA 5/PGgif8AMiNQGu63qvGeVz4ud41T8qXWU6rzcI6M8qLLAT9mcNkKB803SmdsL5nrYTk yT1mmVk/wuIcUfBfPaU1fw+IX2OL4IEi1/9HG0Vzy5q3/KDSE0FW/jiGkT0jq7Kla2ma Rd5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781841516; x=1782446316; h=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=jh1MvgXRcMF76uPuIaipZofylXAa+YY0nuXTZU4knJM=; b=j/oCHvSXGcQhD2xMKcvovP+n07K1GB4FcygHIiQD9u6Zy3PYQLKIQEOEaMXVv7rXhA aTFuCeuyM7gGyhlDq2g242OG6hYIOkTDty18W1PgKhGQr3Ht6yCmgSgcYJ9Xn+1E/igi 4EosLuCXBNBMTFhlFRxzffQEUGYFSe2RSrm51WyuuVStN5NwM1xhVWN4fscwP1mWeVGy os5heckacaxp01j/0r4F6+N+gUQA7GsEaAjFd1UwszKsmoVx62BQ+qYhpPrWWp9z/2UN paybQjMvS7FXKmAY1bbxcYgtTowFtiKdU6oS2Ki4ndYvtW+sjFphPvOBs3NYR5fsnVdO d+Nw== X-Gm-Message-State: AOJu0YxBcL8GJdqMblpQ1ND3IRIkgGbeS4gZ+dJtKvbVXzmn+1Ghr6I8 czc+2wWMT741gAjZGau/K5+z9X0uU9vZG0EQ3+/g+xtyS84ARvkxR76O/TY0CI03Law= X-Gm-Gg: AfdE7ck4Kt8zRC8jFDMqViJur49udYdnie2p6LHIr2u0Qxo0rRr4fjYfN5bobWcwVLO MQGe/ZDbIxVeL/EHKT61s2a7+HX8dFDWHSENrUS22Q4EfSDTqkcgnR126TH+BY8KH+vSY7E/PLg hef5u9o2uzqEV/8r+1xwpnGsNmvOXUPnbDSwvSMgePHVwfzNvwtd3q8cccdeww1M34OiapEAG1Q M4LWXcHqxDqduFZ5lkRSn4ySEe8Di8TxedDcWMCOdbc8pbcoQcOJLpGaVkAETNj3EdeK8YoqdYF 46+ttl7u2SRhJzNT/MxOBXMbt/ASs4Fp3gQi+6dT0/plXQNUvnrcHzMrUHCjOX9BbXiha3Kut1t 2mfOjr7DS4ngACuOh/EzO1etu4EPTAPXgv3STo5Mr2ZO3EZfoM0gC6TqfnTYesLQHvYAx6F0zAe BVfMNXhbC92OVhabzAueAprRY= X-Received: by 2002:a05:620a:6017:b0:915:9a7d:434 with SMTP id af79cd13be357-920912a002amr310847185a.34.1781841516034; Thu, 18 Jun 2026 20:58:36 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8083:f04c:42e3:5943:38f6]) by smtp.gmail.com with ESMTPSA id af79cd13be357-920a19160f2sm117429385a.21.2026.06.18.20.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 20:58:35 -0700 (PDT) From: Thiago Jung Bauermann To: Matthieu Longo Cc: , Tom Tromey , Andrew Burgess Subject: Re: [PATCH v1] gdb: align siginfo_t with the Linux kernel definition In-Reply-To: <20260612101610.592338-1-matthieu.longo@arm.com> (Matthieu Longo's message of "Fri, 12 Jun 2026 11:16:10 +0100") References: <20260612101610.592338-1-matthieu.longo@arm.com> User-Agent: mu4e 1.14.2; emacs 30.2 Date: Fri, 19 Jun 2026 03:58:32 +0000 Message-ID: <87ik7f5ggn.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 Matthieu, 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 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 identify > 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/2b414a95b8f7307d42173ba9e580d6 > d3e2bcbfce/include/uapi/asm-generic/siginfo.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 > [2]: https://lore.kernel.org/all/20160212210213.ABC488FA@viggo.jf.intel.com/ > --- > gdb/linux-tdep.c | 39 +++++++++++++++++++++++++++++++++++++-- > 1 file changed, 37 insertions(+), 2 deletions(-) > > diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c > index a7381677498..5baad41a083 100644 > --- a/gdb/linux-tdep.c > +++ b/gdb/linux-tdep.c > @@ -275,7 +275,7 @@ linux_get_siginfo_type (struct gdbarch *gdbarch) > struct type *void_ptr_type; > struct type *uid_type, *pid_type; > struct type *sigval_type, *clock_type; > - struct type *siginfo_type, *sifields_type; > + struct type *siginfo_type, *sifields_type, *sigfault_union_type; > struct type *type; > > linux_gdbarch_data = get_linux_gdbarch_data (gdbarch); > @@ -285,9 +285,12 @@ linux_get_siginfo_type (struct gdbarch *gdbarch) > type_allocator alloc (gdbarch); > > const struct builtin_type *builtin_types = builtin_type (gdbarch); > + struct type *short_type = builtin_types->builtin_short; > struct type *int_type = builtin_types->builtin_int; > struct type *uint_type = builtin_types->builtin_unsigned_int; > struct type *long_type = builtin_types->builtin_long; > + struct type *unsigned_long_type = builtin_types->builtin_unsigned_long; > + struct type *uint32_type = builtin_types->builtin_uint32; > > void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void); > > @@ -364,9 +367,41 @@ linux_get_siginfo_type (struct gdbarch *gdbarch) > append_composite_type_field (type, "si_stime", clock_type); > append_composite_type_field (sifields_type, "_sigchld", type); > > - /* _sigfault */ > + /* Begin _sigfault's anonymous union. */ > + sigfault_union_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION); > + /* used on alpha and sparc */ > + append_composite_type_field (sigfault_union_type, "si_trapno", int_type); > + /* used when si_code=BUS_MCEERR_AR or used when si_code=BUS_MCEERR_AO */ > + append_composite_type_field (sigfault_union_type, "si_addr_lsb", short_type); > + > + /* used when si_code=SEGV_BNDERR */ > + type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); > + 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[]) { siginfo_t siginfo; printf ("sizeof dummy_bnd = %lu\n", sizeof(siginfo._sifields._sigfault._addr_bnd._dummy_bnd)); return 0; } $ make siginfo_t cc siginfo_t.c -o siginfo_t $ ./siginfo_t sizeof dummy_bnd = 8 > + append_composite_type_field (type, "si_lower", void_ptr_type); > + append_composite_type_field (type, "si_upper", void_ptr_type); > + append_composite_type_field (sigfault_union_type, "_addr_bnd", type); > + > + /* used when si_code=SEGV_PKUERR */ > + type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); > + 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. -- Thiago (he/him)