From 29c1c24429a099eca297080dba56a8c090e3136a Mon Sep 17 00:00:00 2001 From: Walfred Tedeschi Date: Tue, 9 Jun 2015 15:27:02 +0200 Subject: Add support for bound table in the Intel MPX context. Intel(R) Memory protection bound information are located in register to be tested using the MPX new instructions. Since the number of bound registers are limited a table is used to provide storage for bounds during run-time. In order to investigate the contents of the MPX bound table two new commands are added to GDB. "show mpx bound" and "set mpx bound" are used to display and set values on the MPX bound table. 2015-04-20 Walfred Tedeschi Mircea Gherzan * i386-tdep.c (MPX_BASE_MASK, MPX_BD_MASK, MPX_BT_MASK, MPX_BD_MASK_32, MPX_BT_MASK_32): New macros. (i386_mpx_set_bounds): New function that implements the command "set-mpx-bound". (i386_mpx_enabled) Helper function to test MPX availability. (i386_mpx_bd_base) Helper function to calculate the base directory address. (i386_mpx_get_bt_entry) Helper function to access a bound table entry. (i386_mpx_print_bounds) Effectively display bound information. (_initialize_i386_tdep): Qdd new commands to commands "set mpx" and "show mpx". (_initialize_i386_tdep): Add "bound" to the commands "show mpx" and "set mpx" commands. (mpx_set_cmdlist and mpx_show_cmdlist): list for the new prefixed "set mpx" and "show mpx" commands. * NEWS: List new commands for MPX support. testsuite: * gdb.arch/i386-mpx-map.c: New file. * gdb.arch/i386-mpx-map.exp: New File. doc: * gdb.texinfo (i386): Add documentation about "show mpx bound" and "set mpx bound". --- gdb/doc/gdb.texinfo | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'gdb/doc') diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 9ea846a..9e9138b 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -22127,7 +22127,7 @@ be returned in a register. @kindex show struct-convention Show the current setting of the convention to return @code{struct}s from functions. -@end table + @subsubsection Intel(R) @dfn{Memory Protection Extensions} (MPX). @cindex Intel(R) Memory Protection Extensions (MPX). @@ -22162,6 +22162,24 @@ counterpart. When the bnd0@dots{}bnd3 registers are displayed via Python, the display includes the memory size, in bits, accessible to the pointer. +Bounds can also be stored in bounds tables, which are stored in +application memory. These tables store bounds for pointers by specifying +the bounds pointer's value along with its bounds. Evaluating and changing +bounds located in bound tables is therefore interesting while investigating +bugs on MPX context. @value{GDBN} provides commands for this purpose: + +@item show mpx bound @var{pointer} +@kindex show mpx bound +Display bounds of the given @var{pointer}. + +@item set mpx bound @var{pointer}, @var{lbound}, @var{ubound} +@kindex set mpx bound +Set the bounds of a pointer in the bound table. +This command takes three parameters: @var{pointer} is the pointers +whose bounds are to be changed, @var{lbound} and @var{ubound} are new values +for lower and upper bounds respectively. +@end table + @node Alpha @subsection Alpha -- cgit v1.1