Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Tedeschi, Walfred" <walfred.tedeschi@intel.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "brobecker@adacore.com" <brobecker@adacore.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH V2] ABI changes for MPX.
Date: Thu, 17 Dec 2015 16:44:00 -0000	[thread overview]
Message-ID: <AC542571535E904D8E8ADAE745D60B1944507386@IRSMSX104.ger.corp.intel.com> (raw)
In-Reply-To: <83bn9pyqv8.fsf@gnu.org>

Eli,

Thanks for your review!

Explaining a bit more:

Where this initialization comes into play is when you are in the middle of a function that returns a pointer.

You issue the command "return a", where a is a pointer.
BND0 should contain that boundary of a, but it will in fact return any value presented in the register at that moment.
In this way application will be in a not good state.  Continuing the execution the user might have a bound violation due to the return.
This behaviour is when the " mpx-bnd-init-on-return" is 0.

In case the " mpx-bnd-init-on-return" is 1 the BND0 will be set to zero, INIT state, and the pointer a will be able to access the whole memory.

Thanks again,

-Fred

-----Original Message-----
From: Eli Zaretskii [mailto:eliz@gnu.org] 
Sent: Thursday, December 17, 2015 5:36 PM
To: Tedeschi, Walfred
Cc: brobecker@adacore.com; gdb-patches@sourceware.org
Subject: Re: [PATCH V2] ABI changes for MPX.

> From: Walfred Tedeschi <walfred.tedeschi@intel.com>
> Cc: gdb-patches@sourceware.org, Walfred Tedeschi 
> <walfred.tedeschi@intel.com>
> Date: Thu, 17 Dec 2015 14:23:44 +0100
> 
> Code reflects what is presented in the ABI document:
> https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI
> Here new class POINTER was added.  GDB code is modified to mirror this 
> new class. (page 134)
> 
> When using the return command, execution of a function is aborted and 
> present values are returned from that point.  That can cause bound 
> violations in the MPX context.  To avoid such side-effects a new set 
> variable was added "mpx-bnd-init-on-return" which controls the 
> initialization of bound register when using the return command.
> 
> As bound initialization it is understood the set of the BND register 
> to zero allowing the associated pointer to access the whole memory.
> 
> As default the value of "mpx-bnd-init-on-return" is set to 1.  So 
> bound register are initilized when using the "return" command.

Thanks.  Review comments for the documentation parts follow:

> +      add_setshow_boolean_cmd ("mpx-bnd-init-on-return", no_class,
> +				&mpx_bnd_init_on_return, _("\
> +Set the bnd registers to INIT state when returning from a call."), 
> +_("\

I think "bnd" should be "BND", in caps.

> +Show the state of the mpx-bnd-init-on-return."),

We usually repeat here the same text as in the "Set" part, except replace "Set" with "Show".  So something like

 Show whether BND registers are set to INIT state when returning from a call.

will be better.

> +While calling functions from the debugger, of an Intel(R) MPX enabled 
> +program, boundary registers have to be initialized before performing 
> +the call, to avoid boundary violations while performing the call.  A 
> +bound is defined to be

"bound" or "boundary"?  You use the latter in the previous text.

> +initialized when the pointer associated to that boundary can access 
> +the whole memory, in this case the register bound register associated 
> +to it has value 0, e.g. if the register associated is bnd0raw its value will be @{0x0, 0x0@}.

Suggest to break this into 3 separate sentences, as this is too complex for a single one.

> +It is possible to change the boundary values, if desired, by placing 
> +a breakpoint at prologue's end and setting bound registers as wished.

Are we sure every reader will immediately know how to set a breakpoint "at prologue's end"?  If not, perhaps a hint or a cross-reference to where this is explained is in order.

> +After the call is performed bound register might be keept or not for 
> +further investigations.

Typo: "keept" should be "kept".

I also don't understand what this sentence is trying to explain.  Can you clarify?

> +While the using the @command{return} bounds can propagate through

"When", not "while".  And please delete the "the" before "using".

> +execution causing a boundary violation.
> +The behaviour of initializing bounds when using @command{return} can 
> +be controlled and vizualized via the following commands:
                         ^^^^^^^^^^
Typo: should be "visualized".

> +@table @code
> +@kindex set mpx-bnd-init-on-return
> +When set to 1 bound registers will be initialized when returning from 
> +a calling a program function @kindex show mpx-bnd-init-on-return Show 
> +the state of mpx-bnd-init-on-return.
> +@end table

I didn't quite understand the effect and the need in this variable.
Can you clarify, please?
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


  reply	other threads:[~2015-12-17 16:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17 13:24 Walfred Tedeschi
2015-12-17 16:35 ` Eli Zaretskii
2015-12-17 16:44   ` Tedeschi, Walfred [this message]
2015-12-18 15:11     ` Eli Zaretskii
2015-12-18 17:24       ` Joel Brobecker
2015-12-19  8:16         ` Eli Zaretskii
2015-12-18 17:19 ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AC542571535E904D8E8ADAE745D60B1944507386@IRSMSX104.ger.corp.intel.com \
    --to=walfred.tedeschi@intel.com \
    --cc=brobecker@adacore.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox