LLVM 22.0.0git
X86ReturnThunks.cpp File Reference

Pass that replaces ret instructions with a jmp to __x86_return_thunk. More...

Go to the source code of this file.

Macros

#define PASS_KEY   "x86-return-thunks"
#define DEBUG_TYPE   PASS_KEY

Detailed Description

Pass that replaces ret instructions with a jmp to __x86_return_thunk.

This corresponds to -mfunction-return=thunk-extern or attribute((function_return("thunk-extern").

This pass is a minimal implementation necessary to help mitigate RetBleed for the Linux kernel.

Should support for thunk or thunk-inline be necessary in the future, then this pass should be combined with x86-retpoline-thunks which already has machinery to emit thunks. Until then, YAGNI.

This pass is very similar to x86-lvi-ret.

Definition in file X86ReturnThunks.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   PASS_KEY

Definition at line 45 of file X86ReturnThunks.cpp.

◆ PASS_KEY

#define PASS_KEY   "x86-return-thunks"

Definition at line 44 of file X86ReturnThunks.cpp.