Message ID | 20220429203644.2868448-14-samitolvanen@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B8A8AC433F5 for <linux-arm-kernel@archiver.kernel.org>; Fri, 29 Apr 2022 20:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Si2FsbwOtgVXUNhbGquIwtpA+NaKz2UEA5+rZu38QKs=; b=hKMdIfwOAmd9rcHoViT0NGwYxO mTRHmV7fo6uv4WeXfFupfqaq9YWAMTzL1BGTTE6RVO+XAHot0hKa4gGUSHO+mpGwgwcZnhwzAFUNa cFdH+dFj/TYm4UhxS8QIYLi4ITAK46yaxYNK/+cNX/WAiQ3ejSikdPSaJZWqhr5sc9tgUnBT2AnWy k4uZ2CBPFpM898kqr4UUeNHkns5UDarFK0b9jx/gLzfzsrblpLH5n6IEEuepe2TXSzpTrX3Uysgql 6qkLDZVziNix1CsQBX6kfN3xEwY91IEPuTlH5e7eapsciLf9yCUsyeHdxnWvzaqpgvB6nI06Qt313 49RPd1Bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkXUZ-00CaPj-WC; Fri, 29 Apr 2022 20:45:32 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkXMe-00CXIf-9z for linux-arm-kernel@lists.infradead.org; Fri, 29 Apr 2022 20:37:24 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id b12-20020a056902030c00b0061d720e274aso8350429ybs.20 for <linux-arm-kernel@lists.infradead.org>; Fri, 29 Apr 2022 13:37:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=tv2NfEjyfprEjH/WagRqqCH1hQfxPpGMj5Z2HbEgkRA=; b=pB+2omq61Q3217AvI0rEZSjmyFqJ9NJ7YuTSaZYQdZKihILOoXitcHp4Aqk4DfNuJC Ii1imHx96bqsVsHF4LbRU0itbEjHrNgVdkQ3irES1Ih8mxUshYfbtfCT+TfHZ/oz1dtP NY0q6seVOURhumX36uwOxNHojZ45LOr10er9aVaKi/UiJRMGUW9RPY1W/crXdM6e/nzW jbvzkhILVLoFfcKOggaouemXiLcCzeXKkf/R9rS3XSJYuy1mUw5kXCtFqCb5OkWHmIae AVmKCEcuaeO8akCJpncoE0TcUuvyXfT1iSaAa7lBOHuy3YgYc6i8BTmI6s6WYnCNi+AU t24g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=tv2NfEjyfprEjH/WagRqqCH1hQfxPpGMj5Z2HbEgkRA=; b=7FbWPi4+wGHspWEp/MdOERU9akiUbFgDZCcuqZR3Vh+mF9Qq8rmYU4jmRJdJPXzrgj sifjGZzSIRcM2lYJz3xoMq7RZi/0goW1sgDWvH0NCGzXnh8kAZtWYO0m7ktNqVCv6kVf R32QYagG8geXJ1JeHZkWUIPR01hTXZ6Ido+DZMe3+EUM3c5mGsV4BYqq8JcSafQyeLSs 2/2Y23KnfWmGSzM90kVhJwPoUqUC8IZyfRFhZaWZx7CRFUBFlVz61Ho7cEdOaKmay+YH 5rbI/oruDYcCHSyfb9M3wvCGel0k0JiLjxRf5KqK6oC3uyDzf72VSD1RACSvn636urJ/ u4gw== X-Gm-Message-State: AOAM532k7dH7EvJ/cKA127wGIeoLely0+DJXXSsAkiGMu137WJ3MO2gM zfIR2paOUR6No5Nm2GeQn4Mv6mmSCvx4nnx1nKs= X-Google-Smtp-Source: ABdhPJzf8F6MhhQvERk6o6aC905EfQk7qKag0BcoEBBD0uWfioudMPTHJnGQUhT5pwFx9Z28Q9LGUrtznvm+L73jrDw= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:351:bea9:f158:1021]) (user=samitolvanen job=sendgmr) by 2002:a81:234b:0:b0:2f8:4082:bbd3 with SMTP id j72-20020a81234b000000b002f84082bbd3mr1122079ywj.47.1651264638553; Fri, 29 Apr 2022 13:37:18 -0700 (PDT) Date: Fri, 29 Apr 2022 13:36:36 -0700 In-Reply-To: <20220429203644.2868448-1-samitolvanen@google.com> Message-Id: <20220429203644.2868448-14-samitolvanen@google.com> Mime-Version: 1.0 References: <20220429203644.2868448-1-samitolvanen@google.com> X-Developer-Key: i=samitolvanen@google.com; a=openpgp; fpr=35CCFB63B283D6D3AEB783944CB5F6848BBC56EE X-Developer-Signature: v=1; a=openpgp-sha256; l=1454; h=from:subject; bh=tehRW82jP0RyTtdlRN0VdoftCcUQiAtEwsyBl3tnXQM=; b=owEB7QES/pANAwAKAUy19oSLvFbuAcsmYgBibExXrPGtzBdwEr3WsUJMcTa5SnMpMUdhtG1ELjyr Yo4vk3yJAbMEAAEKAB0WIQQ1zPtjsoPW0663g5RMtfaEi7xW7gUCYmxMVwAKCRBMtfaEi7xW7gG8C/ 4rBi6pp+EX2VhofKNrL5OB4Nbj0tmkbvch9On+rothI5RrjLElKTQ7rJKCbeCMf/fd9MhXmmy30ZDc 0i6d/nQFbMUJNbP3YvHszFfVozL5oetNY0LKa1tEWLrl1PmBWiMM1Y0hzUx695EFNuB9Z/IgzAWJHc VyKoFSgqL/HZvX7mFYcG2EAsOE+icuxIZICSAVt8NfVenhy3oKckN6+QZSZVHFbTE8sAiAE8x4UgZ4 nSjkqIrcznKGhg5HogEmdwZzCaAcGZxDqdA0V1aaU4kyfLHFp9XZzKmiiUwTYYSWwvCY9Tvo+xL+Vu 0CTamYHWDP1HUePZ8CB/mw9CsUeTuhu6zkvuMYcG354jmx7ooV+gAhNyCiEi4fKTuxQ5a1mRQuNNRE 8SsQdB8squmkfEfpsoDlQCt5QaUw4WeUghUIX9vTwT7ISqGIun7rYMiGMRNi2bz7Bl6AT0hPw82Lgr VbBurkClkSn9jw/pGy7ura6cWEncKA6ChV3483s2teTmc= X-Mailer: git-send-email 2.36.0.464.gb9c8b46e94-goog Subject: [RFC PATCH 13/21] cfi: Add the cfi_unchecked macro From: Sami Tolvanen <samitolvanen@google.com> To: linux-kernel@vger.kernel.org Cc: Kees Cook <keescook@chromium.org>, Josh Poimboeuf <jpoimboe@redhat.com>, Peter Zijlstra <peterz@infradead.org>, x86@kernel.org, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Joao Moreira <joao@overdrivepizza.com>, Sedat Dilek <sedat.dilek@gmail.com>, Steven Rostedt <rostedt@goodmis.org>, linux-hardening@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev, Sami Tolvanen <samitolvanen@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220429_133720_466477_50C02E00 X-CRM114-Status: GOOD ( 13.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
KCFI support
|
expand
|
diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index c4ff42859077..0d6a0e7e36dc 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -94,4 +94,6 @@ #if CONFIG_CFI_CLANG /* Disable CFI checking inside a function. */ #define __nocfi __attribute__((__no_sanitize__("kcfi"))) +/* Disable CFI checking for the indirect call expression. */ +#define cfi_unchecked(expr) __builtin_kcfi_call_unchecked(expr) #endif diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index bdd2526af46a..41f547fe9724 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -263,6 +263,10 @@ struct ftrace_likely_data { # define __nocfi #endif +#ifndef cfi_unchecked +# define cfi_unchecked(expr) expr +#endif + /* * Any place that could be marked with the "alloc_size" attribute is also * a place to be marked with the "malloc" attribute. Do this as part of the
The cfi_unchecked macro allows CFI checking to be disabled for a specific indirect call expression, by passing the expression as an argument to the macro. For example: static void call(void (*f)(void)) { cfi_unchecked(f()); } Signed-off-by: Sami Tolvanen <samitolvanen@google.com> --- include/linux/compiler-clang.h | 2 ++ include/linux/compiler_types.h | 4 ++++ 2 files changed, 6 insertions(+)