HomePhabricator

[X86] Add RET-hardening Support to mitigate Load Value Injection (LVI)

Authored by sconstab on Apr 3 2020, 10:58 AM.

Description

[X86] Add RET-hardening Support to mitigate Load Value Injection (LVI)

Adding a pass that replaces every ret instruction with the sequence:

pop <scratch-reg>
lfence
jmp *<scratch-reg>

where <scratch-reg> is some available scratch register, according to the
calling convention of the function being mitigated.

Differential Revision: https://reviews.llvm.org/D75935