summaryrefslogtreecommitdiff
path: root/gdb/i387-tdep.h
diff options
context:
space:
mode:
authorWalfred Tedeschi <walfred.tedeschi@intel.com>2017-03-07 13:53:41 +0100
committerWalfred Tedeschi <walfred.tedeschi@intel.com>2017-03-07 13:53:41 +0100
commit4a612d6f67d605f480ce7eec7fd9ca1cd1087b35 (patch)
tree326f4d3f1a5c7e1aebe2abeef5b7b3fc1d3e22ef /gdb/i387-tdep.h
parentea86f5344298e24801c262d9b52afcc9cb692959 (diff)
downloadbinutils-gdb-4a612d6f67d605f480ce7eec7fd9ca1cd1087b35.tar.gz
amd64-mpx: initialize BND register before performing inferior calls.
This patch initializes the BND registers before executing the inferior call. BND registers can be in arbitrary values at the moment of the inferior call. In case the function being called uses as part of the parameters BND register, e.g. when passing a pointer as parameter, the current value of the register will be used. This can cause boundary violations that are not due to a real bug or even desired by the user. In this sense the best to be done is set the BND registers to allow access to the whole memory, i.e. initialized state, before pushing the inferior call. 2017-03-07 Walfred Tedeschi <walfred.tedeschi@intel.com> gdb/ChangeLog: * i387-tdep.h (i387_reset_bnd_regs): Add function definition. * i387-tdep.c (i387_reset_bnd_regs): Add function implementation. * i386-tdep.c (i386_push_dummy_call): Call i387_reset_bnd_regs. * amd64-tdep (amd64_push_dummy_call): Call i387_reset_bnd_regs. gdb/testsuite/ChangeLog: * i386-mpx-call.c: New file. * i386-mpx-call.exp: New file. gdb/doc/ChangeLog: * Memory Protection Extensions: Add information about inferior calls.
Diffstat (limited to 'gdb/i387-tdep.h')
-rw-r--r--gdb/i387-tdep.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h
index 6a97e4f57f1..04551304238 100644
--- a/gdb/i387-tdep.h
+++ b/gdb/i387-tdep.h
@@ -161,4 +161,8 @@ extern void i387_collect_xsave (const struct regcache *regcache,
extern void i387_return_value (struct gdbarch *gdbarch,
struct regcache *regcache);
+/* Set all bnd registers to the INIT state. INIT state means
+ all memory range can be accessed. */
+extern void i387_reset_bnd_regs (struct gdbarch *gdbarch,
+ struct regcache *regcache);
#endif /* i387-tdep.h */