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] New gdbarch method "dwarf_cfa_op" and migrate SPARC to it


On 21/04/17 15:43, Ivo Raisr wrote:


On 19.4.2017 12:17, Jiong Wang wrote:
Hi,

Recently a feature called "return address signing" has been added to GCC to
prevent stack smash stack on AArch64.  For details please refer:

  https://gcc.gnu.org/ml/gcc-patches/2017-01/msg00376.html

GDB needs to be aware of this feature so it can restore the original return
address which is critical for unwinding.

On compiler side, whenever return address, i.e. LR register, is mangled or
restored by hardware instruction, compiler is expected to generate a
DW_CFA_GNU_window_save CFA instruction to toggle the LR signing status.
DW_CFA_GNU_window_save was introduced by SPARC for their register window
feature, here AArch64 want to multiplex this DWARF CFA instruction as
it's in vendor space. So, a new gdbarch method, dwarf_cfa_op, is introduced.

Are you sure to reuse DW_CFA_GNU_window_save for AArch64 purposes? Because semantics of DW_CFA_GNU_window_save (implied from "window save") mean much more than just fiddling with return address. For example as you learned from dwarf2-frame.c, whole register window needs to be copied.

Hi Ivo,

  Thanks very much for testing this on SPARC platform.

What's really reused is the DWARF CFA number 0x2d behind DW_CFA_GNU_window_save. It is in vendor extension space ( DW_CFA_lo_user.. DW_CFA_hi_user) so the semantics depends on vendor interpreation.

Regards,
Jiong.


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