From patchwork Fri Jun 10 23:35:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 12878217 Return-Path: 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 6BC52C43334 for ; Sat, 11 Jun 2022 00:42:30 +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=Rd2B/cVlwYCFKyiDGKuOAqk9IkHT1ZOpiNDGyEAxgJI=; b=ywd6zTxJJWbnc/E9bSgKt7CK75 tW8CDQs+yXSK9VqDyj5+XTQRVEt96vlTXUrCMpew8P5ieO21NP5TQQIsxP9GM9IhxarGfgn4iPeF4 DEkeJhTb0A4KuVuhINJhtT1+h1kvPXBoefKChMfvR5iLesbO5XWQ2sSM8q1kr7XfgBDMWHhG97TAg VYDYleHdXyGAcEi1DeOeNkMNK6LHVm0zPJzF2Ucw4OGuraW9RcUMmg6u0aOeUH17f7RNo46PB68ML 7tezEeUgFapdLjrCS+iLNPAqDb2SgAMMuuLttii22AbqjLCZRj1ydXkLwGGhDwKmlI/0b8mJbKse+ 8YmTEFAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzpBg-00Afdo-GD; Sat, 11 Jun 2022 00:41:12 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzpBE-00AfUK-SF for linux-arm-kernel@bombadil.infradead.org; Sat, 11 Jun 2022 00:40:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Cc:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=NcjHS6Suh3OhItEG/2MZtt/0Xj5mN4IWKhqbfh52Rno=; b=qXB0OfB9qv9dk5BastjF6Kv+x4 170jzfM6lx9W8GSdQQt5poxKWbP41dxdUiJ24fHotGlN/8UHDuD8s1VSt1jW4wOvvVU6s0AwEXUbq tg0B+jJuogJEVPDjhDUToH5Z+osB8PZmSFIXj8Gps9NtGIh32rBp7vYaXaivMawdpG8Als1wQ875j VMs4/HRoN5Gf+7pL0q4k3uUsoeFxTF0AjV6TVtXcCE85B0nJJssKJlzmRFOwCXq1gZl4uADWcDqaG /feCoYevE+y7oUJyDxR51lXdrJDHQgZmW6CVQt2k1yW6sQQQAmSsNP0VybtwGRVDIpefZN8U3DQRZ t7n4b7gQ==; Received: from mail-pf1-x449.google.com ([2607:f8b0:4864:20::449]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzoAE-006oBj-Sl for linux-arm-kernel@lists.infradead.org; Fri, 10 Jun 2022 23:35:41 +0000 Received: by mail-pf1-x449.google.com with SMTP id p123-20020a625b81000000b0051c31cc75dfso295179pfb.5 for ; Fri, 10 Jun 2022 16:35:36 -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=NcjHS6Suh3OhItEG/2MZtt/0Xj5mN4IWKhqbfh52Rno=; b=B6yAU5GEe4pZv/48yh6WLaI6mEXb6q5ek/xHD3FNdQztYNNt1boCQdLPa1Eoj+bFb0 IcRpSoqgwJeACNDoRbvXik97hjTOzyv6MAX9mnUDXEqkFElRkH/mbVQthzGmVv0VoW5V shtnOK+4rpBrCbU/1qxNlqiQ4avMTDXPZlIVe27ivwDSoSZ5/Z5JaL0bIVD4AVFn2s1p sZG06EBIRR6jFQ7sHdn7SkltPOKCP9uyEidLrsiFZ+405A0pylIsgI5jzXJ1cCfkTtq8 CxkV/5qTOb+qnKBdhYYE1CE2cmC7lI7sRQut6bHug9ResZugpE1Kql3uyWJJqVhYd605 sRlA== 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=NcjHS6Suh3OhItEG/2MZtt/0Xj5mN4IWKhqbfh52Rno=; b=4OOV1K6vGCaO8hxsXagTRsqBpK8vIZF05yILia/7b0GhGq8VMbJOBW6/Y0pJCuVq5l 4AiFiyeHB7oCdFh6J257Xkv2dO+ioMugFJ/hjRmxo2fNuSxpKRRukYQ6TblPKq4aFaYW gYfLHCHs3tPO4Od7gUf3E5cpzAltohnO2xIHJ/2PxTwngrJoSYBeqbdYRs5HVXNahEI5 F7k7RrTS8qB7bK7IFgfhxQEchzqmqxcHtL7vPn/ue/XyaxGi7EPmcM6jzV+UVJA2ITrt 9XoPyXLxhVjCgv+6wXOfhT98mQPfkgZjx8mqHVVHjSUKwTqsCo59cr9M/LeMO5kHm/jQ ELxw== X-Gm-Message-State: AOAM5314YYzKF8yhQ1qsbgfKUy6893wiDpCp/oBT+qQYTSmcZVPtSHsB VUxaOLmIeNh7WtP+ENOCY8s/Dzh5ryeSc2wqUVs= X-Google-Smtp-Source: ABdhPJxw7oIAK8hGCeVcNE80HM7NhVBaTN+eR2hseQO0/X0b/4Yf1tGUnNUottQiVCVizuJeiQD04X+aq1KSVb7CZow= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:f464:6db6:3d47:ed14]) (user=samitolvanen job=sendgmr) by 2002:a05:6a00:1a01:b0:51c:d4f:c2a7 with SMTP id g1-20020a056a001a0100b0051c0d4fc2a7mr31838209pfv.45.1654904134785; Fri, 10 Jun 2022 16:35:34 -0700 (PDT) Date: Fri, 10 Jun 2022 16:35:01 -0700 In-Reply-To: <20220610233513.1798771-1-samitolvanen@google.com> Message-Id: <20220610233513.1798771-9-samitolvanen@google.com> Mime-Version: 1.0 References: <20220610233513.1798771-1-samitolvanen@google.com> X-Developer-Key: i=samitolvanen@google.com; a=openpgp; fpr=35CCFB63B283D6D3AEB783944CB5F6848BBC56EE X-Developer-Signature: v=1; a=openpgp-sha256; l=3850; h=from:subject; bh=5ZgbGJz2ZEVaG6LF/2peYBgvNX5g5T9rQB8ZfRmBxaI=; b=owEB7QES/pANAwAKAUy19oSLvFbuAcsmYgBio9Ut3swgrYqngHqwtC1wp3RKCDV4QKgDfNVLYTiJ 6dF63+OJAbMEAAEKAB0WIQQ1zPtjsoPW0663g5RMtfaEi7xW7gUCYqPVLQAKCRBMtfaEi7xW7qYDC/ 4uoZDVEdEW9ia3dPSZOELy1obJP3wjydRD7Jb2lRl1j9YRC2vDbdRegiY/dAhKBUZJIhMFxhi7Ucda KBRlntq1sn5muM0HQLQW+2VQgGVUy6eswi1cnBJhF5weOCA5Yq8JqmkzpXMwmDQ15lHhdhWygirOmo YoyTdzn+9slce2r9w2kr8H7tKHOPpmByY8iM3OzE+cVOW9MTkuNi95Nzrccd8sFj2MDWuqGOfStQVv Rucb8+Vw6DbdPiJsNzUi4iTPWKMGooEKDKoO40U7zAARl068qUIzJNawJ2xy4ljp+UtBszmuNETnQD T0ouk5BQa4iYf7b1d4cbdz19cbiD6tkWIB8qleILbqaLLwWo/Qy2osauXT85QiQLludzGxtOVgotdy WF/4UkWdBS756ZuBpa1lLxpYbC2IVBSAtVs0C8isRpIIUnIl6TuTi4N4f0HRZbiuuluaWnw9wFxsqA iUejEfd5Gi6gRpLlSxdqzBG0a1c1VsXlwbq5mZ1fkSado= X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog Subject: [RFC PATCH v3 08/20] arm64: Add types to indirect called assembly functions From: Sami Tolvanen To: linux-kernel@vger.kernel.org Cc: Kees Cook , Josh Poimboeuf , Peter Zijlstra , x86@kernel.org, Catalin Marinas , Will Deacon , Mark Rutland , Nathan Chancellor , Nick Desaulniers , Joao Moreira , Sedat Dilek , Steven Rostedt , linux-hardening@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev, Sami Tolvanen X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220611_003539_911432_4722689B X-CRM114-Status: GOOD ( 13.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With CONFIG_CFI_CLANG, assembly functions indirectly called from C code must be annotated with type identifiers to pass CFI checking. Use SYM_TYPED_FUNC_START for the indirectly called functions. Signed-off-by: Sami Tolvanen Reviewed-by: Kees Cook --- arch/arm64/crypto/ghash-ce-core.S | 5 +++-- arch/arm64/crypto/sm3-ce-core.S | 3 ++- arch/arm64/kernel/cpu-reset.S | 5 +++-- arch/arm64/mm/proc.S | 5 +++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/arch/arm64/crypto/ghash-ce-core.S b/arch/arm64/crypto/ghash-ce-core.S index 7868330dd54e..ebe5558929b7 100644 --- a/arch/arm64/crypto/ghash-ce-core.S +++ b/arch/arm64/crypto/ghash-ce-core.S @@ -6,6 +6,7 @@ */ #include +#include #include SHASH .req v0 @@ -350,11 +351,11 @@ CPU_LE( rev64 T1.16b, T1.16b ) * void pmull_ghash_update(int blocks, u64 dg[], const char *src, * struct ghash_key const *k, const char *head) */ -SYM_FUNC_START(pmull_ghash_update_p64) +SYM_TYPED_FUNC_START(pmull_ghash_update_p64) __pmull_ghash p64 SYM_FUNC_END(pmull_ghash_update_p64) -SYM_FUNC_START(pmull_ghash_update_p8) +SYM_TYPED_FUNC_START(pmull_ghash_update_p8) __pmull_ghash p8 SYM_FUNC_END(pmull_ghash_update_p8) diff --git a/arch/arm64/crypto/sm3-ce-core.S b/arch/arm64/crypto/sm3-ce-core.S index ef97d3187cb7..ca70cfacd0d0 100644 --- a/arch/arm64/crypto/sm3-ce-core.S +++ b/arch/arm64/crypto/sm3-ce-core.S @@ -6,6 +6,7 @@ */ #include +#include #include .irp b, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 @@ -73,7 +74,7 @@ * int blocks) */ .text -SYM_FUNC_START(sm3_ce_transform) +SYM_TYPED_FUNC_START(sm3_ce_transform) /* load state */ ld1 {v8.4s-v9.4s}, [x0] rev64 v8.4s, v8.4s diff --git a/arch/arm64/kernel/cpu-reset.S b/arch/arm64/kernel/cpu-reset.S index 48a8af97faa9..6b752fe89745 100644 --- a/arch/arm64/kernel/cpu-reset.S +++ b/arch/arm64/kernel/cpu-reset.S @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -28,7 +29,7 @@ * branch to what would be the reset vector. It must be executed with the * flat identity mapping. */ -SYM_CODE_START(cpu_soft_restart) +SYM_TYPED_FUNC_START(cpu_soft_restart) mov_q x12, INIT_SCTLR_EL1_MMU_OFF pre_disable_mmu_workaround /* @@ -47,6 +48,6 @@ SYM_CODE_START(cpu_soft_restart) mov x1, x3 // arg1 mov x2, x4 // arg2 br x8 -SYM_CODE_END(cpu_soft_restart) +SYM_FUNC_END(cpu_soft_restart) .popsection diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index 50bbed947bec..dfa715315551 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -184,7 +185,7 @@ SYM_FUNC_END(cpu_do_resume) * This is the low-level counterpart to cpu_replace_ttbr1, and should not be * called by anything else. It can only be executed from a TTBR0 mapping. */ -SYM_FUNC_START(idmap_cpu_replace_ttbr1) +SYM_TYPED_FUNC_START(idmap_cpu_replace_ttbr1) save_and_disable_daif flags=x2 __idmap_cpu_set_reserved_ttbr1 x1, x3 @@ -224,7 +225,7 @@ SYM_FUNC_END(idmap_cpu_replace_ttbr1) */ __idmap_kpti_flag: .long 1 -SYM_FUNC_START(idmap_kpti_install_ng_mappings) +SYM_TYPED_FUNC_START(idmap_kpti_install_ng_mappings) cpu .req w0 num_cpus .req w1 swapper_pa .req x2