lkml.org 
[lkml]   [2021]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v5 00/15] x86: Add support for Clang CFI
    On Wed, Oct 27, 2021 at 01:05:15PM +0100, Mark Rutland wrote:
    > On Tue, Oct 26, 2021 at 10:16:22PM +0200, Peter Zijlstra wrote:
    > > On Wed, Oct 13, 2021 at 11:16:43AM -0700, Sami Tolvanen wrote:
    > > > This series adds support for Clang's Control-Flow Integrity (CFI)
    > > > checking to x86_64. With CFI, the compiler injects a runtime
    > > > check before each indirect function call to ensure the target is
    > > > a valid function with the correct static type. This restricts
    > > > possible call targets and makes it more difficult for an attacker
    > > > to exploit bugs that allow the modification of stored function
    > > > pointers. For more details, see:
    > > >
    > > > https://clang.llvm.org/docs/ControlFlowIntegrity.html
    > >
    > > So, if I understand this right, the compiler emits, for every function
    > > two things: 1) the actual funcion and 2) a jump-table entry.
    > >
    > > Then, every time the address of a function is taken, 2) is given instead
    > > of the expected 1), right?
    >
    > Yes, and we had to bodge around this with function_nocfi() to get the
    > actual function address.

    The patch set under consideration seems to have forgotten to provide one
    for x86 :/

    > Really there should be a compiler intrinsic or attribute for this, given
    > the compiler has all the releveant information available. On arm64 we
    > had to us inine asm to generate the addres...

    Agreed, this *really* shouldn't be an arch asm hack trying to undo
    something the compiler did.

    \
     
     \ /
      Last update: 2021-10-27 14:47    [W:4.524 / U:0.464 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site