RE: [PATCH v1] Intel(R) MPX - Bound violation handling.

Tedeschi, Walfred
2015-11-05T10:04:19Z

Hello Joel,

Thanks a lot for your support and feedback! :)

The new fields are on the bottom of the structure and yes we are reading junk memory.
On the other hand those fields have meaning when the sig_code is 3, and meaningless otherwise.

Also see that reading the glibc version will not help a lot. Architecture and availability of fields might vary.

Possible solution is to zero the fields if value of sig_code is different than 3.

Or let the interpretation for the user, what is also an option the siginfo is already a set of unions. They have to be interpreted by the user anyhow.

Thanks and regards,
-Fred

-----Original Message-----
From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Joel Brobecker
Sent: Wednesday, November 04, 2015 3:55 PM
To: Tedeschi, Walfred
Cc: palves@redhat.com; gdb-patches@sourceware.org
Subject: Re: [PATCH v1] Intel(R) MPX - Bound violation handling.

> 2015-07-21 Walfred Tedeschi <walfred.tedeschi@intel.com>
>
> * amd64-linux-tdep.c (amd64_linux_init_abi_common):
> Add handler for bound violation signal.
> * gdbarch.sh (bound_violation_handler): New.
> * i386-linux-tdep.c (i386_mpx_bound_violation_handler): New.
> (i386_linux_init_abi): Use i386_mpx_bound_violation_handler.
> * i386-linux-tdep.h (i386_mpx_bound_violation_handler) New.
> * i386-tdep.c (i386_mpx_enabled): Add as external.
> * i386-tdep.c (i386_mpx_enabled): Add as external.
> * infrun.c (process_segmentation_faults): New.
> (print_signal_received_reason): Use process_segmentation_faults.
>
> testsuite/gdb.arch
> * i386-mpx-sigsegv.c: New.
> * i386-mpx-sigsegv.exp: New.
> * i386-mpx-simple_segv.c: New.
> * i386-mpx-simple_segv.exp: New.

This is not a full review (haven't had the time), but one question is nagging at me: How to do handle the case of older kernels/libc-s, where the info is not there? Does it look like you are just reading undefined memory?

--
Joel
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928