<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/62498>62498</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang CFI-values are spilled onto the stack
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          viktorolof
      </td>
    </tr>
</table>

<pre>
    Hi,
When researching different CFI implementations I found out that Clang CFI has an issue of spilling CFI-related values onto the stack. Specifically this can happen when a function (the caller) invokes another function (the callee). The callee might need to use registers occupied by the caller, and therefore the caller values are temporarily saved onto the stack.  Sometimes, these values that are spilled onto the stack are necessary for enforcing the CFI policy.  If an attacker manages to alter the CFI-related values, it is possible to bypass CFI checks.

This was all discovered by Mauro Conti *et. al.* in their article "Losing Control: On the Effectiveness of Control-Flow Integrity under Stack Attacks". They specify the issue in section 4.1, a POC in section 5.2, and suggest a patch for Clang in section 6.1. Their article is linked below:
https://www.ics.uci.edu/~perl/ccs15_stackdefiler.pdf
 
I opened a topic on this on the llvm forums in order to find out if this was ever adressed, but to no avail. I have also searched among the issues on this git repo, however I have not found any evidence of this being patched. Is there already a patch for this? If so, it would be great if somebody could direct me to it. If there are obvious reasons for why the authors' patch should not be implemented, I would greatly appreciate hearing them.

Given that this was discovered a few years ago it is possible that it has already been properly adressed, if that is the case I apologize for opening this already handled issue.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsVU2P4zYS_TXypdCCmrbc44MPvT3rXQMJJsAMkGNQokpSpSmWwKJsKIf89oCUu8edmYsNkfX53qsiqnLviY5F_Z-i_rzBOQ4Sjhd-jRLESbdppF2O_-fCvBTV56J6_n0gD4GUMNiBfQ8tdx0F8hFeTmfgcXI0ko8YWbzCGTqZfQsyR4gDRnhx6PtsOqACemDVmUA60Imd4_XyIZDDSC1c0M2kID4KxIFAI9rX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