From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119981 invoked by alias); 18 Nov 2015 23:01:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 119967 invoked by uid 89); 18 Nov 2015 23:01:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 18 Nov 2015 23:01:53 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id B934211632C; Wed, 18 Nov 2015 18:01:51 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id cVyANP0rE50r; Wed, 18 Nov 2015 18:01:51 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id A834511632B; Wed, 18 Nov 2015 18:01:51 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 26E9E405BE; Wed, 18 Nov 2015 18:01:51 -0500 (EST) Date: Wed, 18 Nov 2015 23:01:00 -0000 From: Joel Brobecker To: Walfred Tedeschi Cc: palves@redhat.com, gdb-patches@sourceware.org Subject: Re: [PATCH v1] Synchronize siginfo type described in GDB with the kernel and glibc ones. Message-ID: <20151118230151.GA7958@adacore.com> References: <1445864086-4831-1-git-send-email-walfred.tedeschi@intel.com> <1445864086-4831-3-git-send-email-walfred.tedeschi@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1445864086-4831-3-git-send-email-walfred.tedeschi@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-11/txt/msg00379.txt.bz2 > New kernel and glibc patches have introduced fields in the > segmentation fault fields. > > Kernel patch: > http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?id=ee1b58d36aa1b5a79eaba11f5c3633c88231da83 > > Glibc patch: > http://repo.or.cz/w/glibc.git/commit/d4358b51c26a634eb885955aea06cad26af6f696 > > 2015-07-21 Walfred Tedeschi > > * linux-tdep.c (linux_get_siginfo_type): Add the _addr_bnd > structure to the siginfo. I would really like someone like Pedro to review this patch, as I am really uncertain about the idea of extending our view of the structure without a way of checking that you have kernel and glibc support for it. As far as I can tell, this sets things up so as to ready undefined data, thus leading to undefined behavior. > > --- > gdb/linux-tdep.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c > index 7c24eaa..de773ae 100644 > --- a/gdb/linux-tdep.c > +++ b/gdb/linux-tdep.c > @@ -248,10 +248,10 @@ static struct type * > linux_get_siginfo_type (struct gdbarch *gdbarch) > { > struct linux_gdbarch_data *linux_gdbarch_data; > - struct type *int_type, *uint_type, *long_type, *void_ptr_type; > + struct type *int_type, *uint_type, *long_type, *void_ptr_type, *short_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_bnd_fields; > struct type *type; > > linux_gdbarch_data = get_linux_gdbarch_data (gdbarch); > @@ -264,6 +264,8 @@ linux_get_siginfo_type (struct gdbarch *gdbarch) > 1, "unsigned int"); > long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), > 0, "long"); > + short_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), > + 0, "short"); > void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void); > > /* sival_t */ > @@ -339,6 +341,12 @@ linux_get_siginfo_type (struct gdbarch *gdbarch) > /* _sigfault */ > type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); > append_composite_type_field (type, "si_addr", void_ptr_type); > + append_composite_type_field (type, "_addr_lsb", short_type); > + > + sigfault_bnd_fields = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); > + append_composite_type_field (sigfault_bnd_fields, "_lower", void_ptr_type); > + append_composite_type_field (sigfault_bnd_fields, "_upper", void_ptr_type); > + append_composite_type_field (type, "_addr_bnd", sigfault_bnd_fields); > append_composite_type_field (sifields_type, "_sigfault", type); > > /* _sigpoll */ > -- > 2.1.4 -- Joel