Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3744420pxb; Wed, 13 Oct 2021 12:03:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzq6UkU/WptG3R96GnHSPW4jArHozyhEEdZPU3PLpZKtLn3oV2SrZIXK6002iZCX050LuG5 X-Received: by 2002:a50:cfc3:: with SMTP id i3mr1656463edk.36.1634151805683; Wed, 13 Oct 2021 12:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634151805; cv=none; d=google.com; s=arc-20160816; b=pIudKsWqe91eAHgzpjpPQWwrEaogUw6rS2dXzwlVOO9W/XSHXWsS+V/q23Wd4UjBhQ q4aaQD6y/lBT/cXuTv13Cd6USwimipJfmqD2t6uKbNkVSQs/+ICmaATc1FIvfvuKiY9x AG9jdT4epJ888EXrl8MVXmQv2higIFXlQ2pJh2gwCSWcxxjkoZHVhhe0J6DE4GIxecjk pM/h9mKSRIv5CMVS0Vq6KElxvPNIJgmxU2//QMwy95V2wk+zNemn9a9uvLfH7Mm7pdLf Wi1Ji93zHtPf7fKIUrTLnQjdnRKgG5N843QRs9PtykZw87F/W5s2e6RxuR8zMV39+093 TTgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vSdCvbsYkIt0Z0Dq92fR0cKB12M68Rwm2Rm4i81p0qg=; b=tmzhA+AQ58wMJ4NcPjTegOQkmtYYCA7xD1KDdFp64czW34J2GCPSKpQpCaQhFRVVBz WBC1TkUc75wXfQ15Or6HgJnWWWmhpRiX9YODhd7lUjzsQrFpYpFAaAciaVIwEwRKmjNu gV9RYEqMr/yNaQKQajDpmpFFbXXuJ6jxCV7WXSmcmV06iNQtt2IZJdo8OrCjAQq98GDi 4wc8DiA9hXTTB6a3HFCo8DyBoXyK5d6xJJObYPPvBTpbi0lXY7mhY4Fi6VdcrjIFECti J1UASrYPtWJLyDyI0eLVpJbV0W8MW6YXwNXsNu3d6wBRMOoSovujc1gzk09YQlUPoeAH ckdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=S83D+Knj; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w7si385161edq.616.2021.10.13.12.02.52; Wed, 13 Oct 2021 12:03:25 -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=@chromium.org header.s=google header.b=S83D+Knj; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238777AbhJMTCo (ORCPT + 99 others); Wed, 13 Oct 2021 15:02:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238881AbhJMTCn (ORCPT ); Wed, 13 Oct 2021 15:02:43 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C3FBC061746 for ; Wed, 13 Oct 2021 12:00:40 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id k23-20020a17090a591700b001976d2db364so3010649pji.2 for ; Wed, 13 Oct 2021 12:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=vSdCvbsYkIt0Z0Dq92fR0cKB12M68Rwm2Rm4i81p0qg=; b=S83D+KnjIrnVXCEAw6xUqC54LMfAZq7UxSajP3TNsE7IodzP4qkKJODPxsupKv1JV7 RBHwwjdxYBt1aj+Mkj3eJPnrmP1k1AKIcAcGx330nxxQuYr/bf9o91eAAqWtvyWUx/PU zrQk7dFVKsoXP9j7/aU62ewAhhYuReCo8f4j0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vSdCvbsYkIt0Z0Dq92fR0cKB12M68Rwm2Rm4i81p0qg=; b=tSwC4eVGdqv7XsYDKrZ0gMcilqLOBfLc2Os4wEBQ9vrwdzrr2AkQkxSMwNwEcmHIPz ltJhqcLTEXgdlS9xwHFu+1jk1VNZAPFxwFzL6M3TL/81rUhDLHIgL2WUI7Ovwil3nXOY P1nCc+a5vkJ37qW9a1Tcvk24zkpT3+gGCyhOXDS/3fVmTKxHLTbhqjkNesK6sznXAwYZ z6nlyMEAJTZjQFrFvfICtmF8507f6wyqXfeBQZBHQfnf0nX6OOSC+9jr609R/Li+qgMM 7QEWAOGxfEmUcukbH6JcLBQCs8+Gl9OCb31NBCj9xd4A4lZSZrBNodUDDeXj796xXJ6U 6a6Q== X-Gm-Message-State: AOAM532NF/vIdbn33xUR6LTz+b4dtTFxZN5VHL/mqDoXUVjtvCrmDVXI E9gUCeOJCvJaxajFtZFDHkkdVw== X-Received: by 2002:a17:90b:4d8e:: with SMTP id oj14mr6818560pjb.237.1634151639646; Wed, 13 Oct 2021 12:00:39 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id f15sm224820pfq.193.2021.10.13.12.00.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Oct 2021 12:00:39 -0700 (PDT) Date: Wed, 13 Oct 2021 12:00:38 -0700 From: Kees Cook To: Sami Tolvanen Cc: x86@kernel.org, Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Sedat Dilek , Steven Rostedt , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v5 03/15] linkage: Add DECLARE_NOT_CALLED_FROM_C Message-ID: <202110131200.1CAF319F@keescook> References: <20211013181658.1020262-1-samitolvanen@google.com> <20211013181658.1020262-4-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211013181658.1020262-4-samitolvanen@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 13, 2021 at 11:16:46AM -0700, Sami Tolvanen wrote: > The kernel has several assembly functions, which are not directly > callable from C but need to be referred to from C code. This change adds > the DECLARE_NOT_CALLED_FROM_C macro, which allows us to declare these > symbols using an opaque type, which makes misuse harder, and avoids the > need to annotate references to the functions for Clang's Control-Flow > Integrity (CFI). > > Suggested-by: Andy Lutomirski > Suggested-by: Steven Rostedt > Signed-off-by: Sami Tolvanen I like this; I have a sense CFI won't stay the only user of this annotation. Reviewed-by: Kees Cook -- Kees Cook