This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH V5 2/2] Add mpx-bnd-init-on-return set/show command for inferior calls.
- From: Walfred Tedeschi <walfred dot tedeschi at intel dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: Pedro Alves <palves at redhat dot com>, gdb-patches <gdb-patches at sourceware dot org>, Joel Brobecker <brobecker at adacore dot com>
- Date: Tue, 26 Apr 2016 17:38:04 +0200
- Subject: Re: [PATCH V5 2/2] Add mpx-bnd-init-on-return set/show command for inferior calls.
- Authentication-results: sourceware.org; auth=none
- References: <1458310577-20021-1-git-send-email-walfred dot tedeschi at intel dot com> <86potcflcw dot fsf at gmail dot com>
Am 4/26/2016 um 5:19 PM schrieb Yao Qi:
Walfred Tedeschi <walfred.tedeschi@intel.com> writes:
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 setting ("mpx-bnd-init-on-return") was added to control
the initialization of bound register when using the return command.
We need to investigate why does "return" cause bound violations. If the
violations are caused by the invalid or garbage return value, that is
expected, and it is a correct behavior to me. If the return value is
out of the bounds of registers settings, the violation is caused. Can we
tweak GDB to adjust the register settings to allow these memory accesses
in the "return"?
Yao,
Thanks again for the prompt review! :)
The "return" causes a premature exit from the function. BND is only
returning the bounds of the pointer which is returned in the usual way.
The novelty here is the BND registers. In case we are returning a
pointer or address BND0 will carry the bounds of the pointer being
returned. Once it is not set yet than garbage will be returned instead.
In this way the value is wrong and a bound violations is likely to happen.
Regards,
-Fred
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