Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2032419pxb; Mon, 23 Aug 2021 10:22:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHCowDYcgGxhgqiyw4iFxf5HKqNr1j0tXb44TWjU6zaZI+Ioddku9DFC1y+KojHCKzYp7n X-Received: by 2002:aa7:da56:: with SMTP id w22mr11451085eds.89.1629739349187; Mon, 23 Aug 2021 10:22:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629739349; cv=none; d=google.com; s=arc-20160816; b=NE7Dy6wTtGnllg8K5L0cjpPIMf2Rx8EKfpBNgRGrJP/1N6A7KRQ7WJIuDnJR08kEKv 7LLceJ8S5Ter6kENYoHhhi2N4vkS/MvoUAg4zZSiVqAhtOp3ngipDMByTvfevB4bxJow SxNXa+PewPc3ISEX6YieWiPtq9Cp0cMgmpthwnhyDg4KuJNdgr+MM/+CZPgRHJbTPC04 rXKefZ1LBDd5ZuvgD3JoffKzkgyUCBcsRkZnxXNK39MxBn49CiZfkjHnDjQ/Zx/IccNL ffbH95o4e4yju75K0xy1jVbW7+g0dZ2AmUwyYEHgFkngOMTam7VdyelF6R+sjqD4Aqej azSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=J8JSmD33jCZgI4ZSaQy5K3s54xcB739cSJ9JuXolesw=; b=UN/wkPZkY02h94EsjGuyFG5cv72lP0SpJF5ZAVLnnfMPOi/QsJqWSadqw6eWpWb1qJ iQR0wHQL2Cmjv4unDWNTuTg7gWRBA2FbrI0piqClr9tdBjNEqXcCWLTY3KdJRyjSxkSO yksqCUFdnggx9CukOVSAzlsyn8l8VRWe6rIfhT5fMh2uSmFoOWfAtx0ocSYgQ4dHyeDa vl+L+slbFZs7t+XLBFOOssV26+4yFVNV02qFxye072E4ZnOkI7vWcbG4v5cBP8OWul8W gzre4XzSMdiB7mdjxf3wKcUkNgoQiOM3spMuDvZgrRgDWTQelY0ogU5bRtytaluWaqL+ 1GVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=P5bg4x+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id js5si284818ejc.249.2021.08.23.10.22.03; Mon, 23 Aug 2021 10:22:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=P5bg4x+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229479AbhHWRV2 (ORCPT + 99 others); Mon, 23 Aug 2021 13:21:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229755AbhHWRV2 (ORCPT ); Mon, 23 Aug 2021 13:21:28 -0400 Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F6C3C061575 for ; Mon, 23 Aug 2021 10:20:45 -0700 (PDT) Received: by mail-yb1-xb30.google.com with SMTP id j13so14367283ybj.9 for ; Mon, 23 Aug 2021 10:20:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=J8JSmD33jCZgI4ZSaQy5K3s54xcB739cSJ9JuXolesw=; b=P5bg4x+sppTF8KfYOZ6xzQ2IuZWnsL3ygtYFeJxzzIIi7j7kAKCH8d/yLgi+zyFFqi u9TP3tE4mnS6dWJRj4pZ/QNn2d+GXi7o3wWSPRLMMRdeF1FPMZ60nP6MXVCNJAGbwIXV fIe5+7zt/iOBKvlNwwvgrHL0tJH/7XcHVDGoSGD7c5Jhx3VEkZ28AGT623sp1UIOB9EB UcXROEvoFM9pnMiLGIC8618oJxeRgF0QuUyiVNaX08KIj5PL3RUS36otWfBLa3DFyR6h G2gmRrNEu2l6hwmif6PddC4du1tO2qXJn9mEcfk3rI4szbm9lKzjqpQ/jyfmn/D7B+Vo nBdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=J8JSmD33jCZgI4ZSaQy5K3s54xcB739cSJ9JuXolesw=; b=VTpCGhi1U5dkfdT54CvrcImu7b+IX2442rTTqgu0X4fBCYTpR6VuiqUJIfqYl//UKt 6pTOR0Ds3T37HYp4ig1/vD4IyDmC0WFkKIpK/qJsXL6varq3kJv0D1LRXKVvNSdmJQeO DFFXpPwlzxogdMhAyK1wg0UzB+nQO/rb7/GZt6H98JCx7ilcT+QKEFP3YT1+ebt/cm+3 4ETNrjFMagfTJwijELYsYAqZGr5lZGFaOL9LZZ17bMxZ1B/Hr4LPKByM2J9AF8NvSNE3 6PsTJs9pl19SF6+mlE9LVzXtm80+R4TUap8J6P8uKzEM4qxo5GbmqbNs6WmYtiRKjOKe m7Qg== X-Gm-Message-State: AOAM530/U6JCEa2g9uqMt8Tn1qiuX/714+oaIaubFUknSXFhDZTIX3Aq 97ZI5GM24QppJ+HULILYRoofq8E8YZvtBRzjDl5qAA== X-Received: by 2002:a25:734e:: with SMTP id o75mr24134262ybc.498.1629739244588; Mon, 23 Aug 2021 10:20:44 -0700 (PDT) MIME-Version: 1.0 References: <20210823171318.2801096-1-samitolvanen@google.com> <1706ee8e-c21c-f867-c0be-24814a92b853@redhat.com> In-Reply-To: <1706ee8e-c21c-f867-c0be-24814a92b853@redhat.com> From: Sami Tolvanen Date: Mon, 23 Aug 2021 10:20:33 -0700 Message-ID: Subject: Re: [PATCH v2 00/14] x86: Add support for Clang CFI To: Tom Stellard Cc: X86 ML , Kees Cook , Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Sedat Dilek , linux-hardening@vger.kernel.org, LKML , clang-built-linux Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 23, 2021 at 10:16 AM Tom Stellard wrote: > > On 8/23/21 10:13 AM, 'Sami Tolvanen' via Clang Built Linux 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 > > > > Version 2 depends on Clang >=14, where we fixed the issue with > > referencing static functions from inline assembly. Based on the > > feedback for v1, this version also changes the declaration of > > functions that are not callable from C to use an opaque type, > > which stops the compiler from replacing references to them. This > > avoids the need to sprinkle function_nocfi() macros in the kernel > > code. > > How invasive are the changes in clang 14 necessary to make CFI work? > Would it be possible to backport them to LLVM 13? I'm not sure what the LLVM backport policy is, but this specific fix was quite simple: https://reviews.llvm.org/rG7ce1c4da7726 Sami