This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH V2] ABI changes for MPX.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]