This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[PATCH 08/22] Add Intel CET support for EH in libgcc.


Control-flow Enforcement Technology (CET), published by Intel, Introduces
the Shadow Stack feature, which ensures a return from a function is done
to exactly the same location from where the function was called. When EH
is present the control-flow transfer may skip some stack frames and the
shadow stack has to be adjusted not to signal a violation of a
control-flow transfer. It's done by counting a number of skipping frames
and adjusting shadow stack pointer by this number.

gcc/
	* config/i386/i386.c (ix86_expand_epilogue): Change simple
	return to indirect jump for EH return. Change explicit 'false'
	argument in pro_epilogue_adjust_stack with a value of
	flag_cf_protection.
	* config/i386/i386.md (simple_return_indirect_internal): Remove
	SImode restriction to support 64-bit.

libgcc/
	* config/i386/linux-unwind.h: Include
	config/i386/shadow-stack-unwind.h.
	* config/i386/shadow-stack-unwind.h: New file.
	* unwind-dw2.c: (uw_install_context): Add a FRAMES argument and
	pass it to _Unwind_Frames_Extra.
	* unwind-generic.h (FRAMES_P_DECL): New.
	(FRAMES_VAR): Likewise.
	(FRAMES_VAR_P): Likewise.
	(FRAMES_VAR_DECL): Likewise.
	(FRAMES_VAR_DECL_1): Likewise.
	(FRAMES_VAR_INC): Likewise.
	(FRAMES_P_UPDATE): Likewise.
	(_Unwind_Frames_Extra): Likewise.
	* unwind.inc (_Unwind_RaiseException_Phase2): Use FRAMES_P_DECL,
	FRAMES_VAR_DECL_1, FRAMES_VAR_INC and FRAMES_P_UPDATE.
	(_Unwind_RaiseException): Use FRAMES_VAR_DECL, FRAMES_VAR_P and
	FRAMES_VAR.
	(_Unwind_ForcedUnwind_Phase2): Use FRAMES_P_DECL,
	FRAMES_VAR_DECL_1, FRAMES_VAR_INC, FRAMES_P_UPDATE.
	(_Unwind_ForcedUnwind): Use FRAMES_VAR_DECL, FRAMES_VAR_P and
	FRAMES_VAR.
	(_Unwind_Resume): Use FRAMES_VAR_DECL, FRAMES_VAR_P and
	FRAMES_VAR.
	(_Unwind_Resume_or_Rethrow): Use FRAMES_VAR_DECL, FRAMES_VAR_P
	and FRAMES_VAR. 

Igor


Attachment: 0008-Add-Intel-CET-support-for-EH-in-libgcc.patch
Description: 0008-Add-Intel-CET-support-for-EH-in-libgcc.patch


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