Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp576741pxb; Tue, 19 Oct 2021 08:42:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7zhEEfrbqKafh4LJ75CL1yJDoa/DP9Cy2EV30yGvp3ogwrK31BbVawgmj6W2OHNcGlECf X-Received: by 2002:a17:902:8a83:b0:13d:9572:86c2 with SMTP id p3-20020a1709028a8300b0013d957286c2mr34258689plo.48.1634658179017; Tue, 19 Oct 2021 08:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634658179; cv=none; d=google.com; s=arc-20160816; b=g6pjC2qPIfEHR8EQ09NFYrVelnwLM+lBKsjEIaIpzhMDZfTL9PToITi/T/AOiHCAQQ 6VSTx3lSsav3nhnlMtEkaxG3oiHowcZfnhgOzaocV13bMT9L2ZLl8Vm7wBl6KpeXW7HW rAQXkURt14GAdpVfMImD0UDgO4sBLYI6PJFKmSBo7iE4HmpWkv7tSgdxMOuod1K7wIbv x00XXaBCPJP0kzk/s8fERHr9iY4y5zCgpXs/Cm3aGDFrmGXdaUsnX+hcalZIGpkiclNl TF37lCzDg1LcsywxjwuZJ7cKUHZMGM2pBz/6nRx6WUhtvOHe4OsM1X/KlY5PeynUnf8C EfnA== 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=FAz/rf9btWo86AlYRe/ss+IrFPzH4iWnZ+k8+VWp8Q4=; b=szMWtCMsj6YznABvGeKi7//mWFxrjOy4HmdoKd5sqT//2R5ZvB4TfZ3ip0YlBg5upf 99IVWQliEq3Mrcn5sO05761vdppkHxqU+4QyYEOO0caQuw16bD0UZaSKq+5/XTL8hHkT NfP7CrQNuoiBmhfePbACx9QU5JMC5QVqrtPKAeS0j59kd+ZL6u4LxA9YHxIxpLiOrG1A Iwzv+BYFY2FJ+uFaIoV3Csl1DueT+Z+YLVtcvNPfpr5LqRSC/uWn/gTn/Wlj7CHcmIdx /0bI1wHAotWoKmtTQ9+KpCaMCxSlvTBf+LZWSFNHjc6o57n8tNe0o/Zf7LDe4htT7Bks iO/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=by51BMJT; 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 x191si25228935pgd.621.2021.10.19.08.42.46; Tue, 19 Oct 2021 08:42:58 -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=20210112 header.b=by51BMJT; 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 S232329AbhJSPnW (ORCPT + 99 others); Tue, 19 Oct 2021 11:43:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231947AbhJSPnU (ORCPT ); Tue, 19 Oct 2021 11:43:20 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86739C06161C for ; Tue, 19 Oct 2021 08:41:07 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id u32so4528960ybd.9 for ; Tue, 19 Oct 2021 08:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FAz/rf9btWo86AlYRe/ss+IrFPzH4iWnZ+k8+VWp8Q4=; b=by51BMJTIeokyM48OQnVX9GSnteOHSgZC4WU5Mgi/G84VEUD0nYOdBQvrPR8o7xC/1 6veu8zh69CoAJ7if85N8Wd58wgPPbqLfu++KaBvFhZWhFWPJSmEHKafIq2bQRDfKRVkv yU2j/67aVTJBnlLMGfFFk9OGsVGgb5IniJkjIAs7MA/Hv1UTFSjBP1jPPKywUQD8Lgmx WDOxp6Dug5ka7nrz81imJn/5EUogGdVJp2EJlTQZnrZkjDnGQTNny2CkDl7T5RsYgtCm oLkN8Cy1UyUg0e0zFtXV2pOrK9M7VYWFYjg9QbBFkqUXNEuELxhZMjIKebiy9FzUbtKX rTog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FAz/rf9btWo86AlYRe/ss+IrFPzH4iWnZ+k8+VWp8Q4=; b=NE8mFu2wShAIwn4cW+orYkd/OhYBKKcajMqxnY4wJssC79piynQGub5x1ifgAquS07 9Ai9fSHlPmeIqH2rw/9X/iExb8ZX+r6B7XGcRZlt/Q9uZ1n3LSPXpgEmln5nnqK26N56 IKXM/mkj7jCL7NQKBr7e/cD7+vL8br/Z7ctwGvduWQ+Q+1FieqOMYU9RU/MVGq5NiB/a r00/7ObjwqEYSyRh2EpJhVkJRAw44r7qsYaeR7ePxXYObJhM9smNHqXO+iy8HyTbqRxc qoNJRmXZjMebbavDDpX0vRMWiS3yT50JAk1YEMRa2Nb0Mbcb5Pqm216+Hp8cU8DSSFnr 1VOQ== X-Gm-Message-State: AOAM5331YzowiRSb4hoxivSDNYQSxPge14aI+0vz2tUnZF+MR6nUgcxp 1I3Z8Mz6t3RAfe2jaJkZyQLGHCENXXqCaDBoJg4qqw== X-Received: by 2002:a25:5b8b:: with SMTP id p133mr36913300ybb.273.1634658066589; Tue, 19 Oct 2021 08:41:06 -0700 (PDT) MIME-Version: 1.0 References: <20211013181658.1020262-1-samitolvanen@google.com> <20211019095947.89257-1-alobakin@pm.me> In-Reply-To: <20211019095947.89257-1-alobakin@pm.me> From: Sami Tolvanen Date: Tue, 19 Oct 2021 08:40:55 -0700 Message-ID: Subject: Re: [PATCH v5 00/15] x86: Add support for Clang CFI To: Alexander Lobakin Cc: X86 ML , Kees Cook , Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Sedat Dilek , Steven Rostedt , linux-hardening@vger.kernel.org, LKML , llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 19, 2021 at 3:06 AM Alexander Lobakin wrote: > > From: Sami Tolvanen > Date: Wed, 13 Oct 2021 11:16:43 -0700 > > > 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 > > > > Note that v5 is based on tip/master. The first two patches contain > > objtool support for CFI, the remaining patches change function > > declarations to use opaque types, fix type mismatch issues that > > confuse the compiler, and disable CFI where it can't be used. > > > > You can also pull this series from > > > > https://github.com/samitolvanen/linux.git x86-cfi-v5 > > Hi, > > I found [0] while was testing Peter's retpoline series, wanted to > ask / double check if that is because I'm using ClangCFI for x86 > on unsupported Clang 12. It is fixed in 13 I suppose? > > [0] https://lore.kernel.org/all/20211019094038.80569-1-alobakin@pm.me No, it works exactly the same in later compiler versions. I also replied to that thread, but this looks like another instance where using an opaque type instead of a function declaration fixes the issue, and probably makes sense as the thunks are not directly callable from C code. Sami