From patchwork Mon Jun 17 16:27:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxwell Bland X-Patchwork-Id: 13701040 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 2B01BC27C79 for ; Mon, 17 Jun 2024 16:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=YluCWb0ojQ+sLHWHo/Wdxu6CuCEISS/qXFHRcH7Ut98=; b=KplxFOhn3TuY0QdcHET4TZaTcY T34At9OT2M8ODp2ZRHtUAJrutvpeIFPNFPBGOXT3yBP2qTMSeZ8Zh8VtA/7Jtj5NYc5Cf6dKF/jH9 MQ1eFMslD1dJXt5gEwYXkc7Gua2Vo1myb4pG4PQMY5sfafYmYIQ2RSlI5WVkA4ZKILV59SNpdRmxL jqPu2ucBcSJS3d2nLXQmYlVLiOq9/NrAL0H8XakW1JoQfVrLmx0XmTzYlhzNKpaUWMmFeF3hhDqfp DxaBgviEJ1SKiPlrkeJf6eOKdCMvfKPpHYPAgPIOUXzmIdV6AjGjBjLLLQQd3Vd8iCJRwIfX8O0QZ EVo3J+6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJFCz-0000000Bj7E-2rqW; Mon, 17 Jun 2024 16:27:53 +0000 Received: from mx0b-00823401.pphosted.com ([148.163.152.46]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJFCw-0000000Bj6T-1eZa for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2024 16:27:52 +0000 Received: from pps.filterd (m0355091.ppops.net [127.0.0.1]) by mx0b-00823401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45HBbXS8023300; Mon, 17 Jun 2024 16:27:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motorola.com; h= cc:content-type:date:from:message-id:mime-version:subject:to; s= DKIM202306; bh=YluCWb0ojQ+sLHWHo/Wdxu6CuCEISS/qXFHRcH7Ut98=; b=S OrWozwyW640x7ssxlxdrTsV0yJLlmqlrfPf2TkSqlSxcZbPA097fUWgWJ5meSRP5 1BJz+lIjnCtF3wROzfQXM1nmqEn6I5jxr2BkIK0FtiemPgjbB1OGggoTXahR2Kon 7ryzkoQDQ0cu9U6Td+yuvgiyfZ75aL2jbrEE0Xu9XIzu1iqBQKuMLltSeUkAUbrq m9cRLuCcm84al5g4Z+v3xA9OV+JFmSpyAkWQBw8RvzwMuXIgeE5XSsHygoxUf+83 d4ooCCfbAvtbp/nidLF0wx6/7kADHUfK9znJ911h7tHaLxVQmAPDlFexws2JwNCi Jw7YFMOTb8ZYx7cTD/wRw== Received: from va32lpfpp02.lenovo.com ([104.232.228.22]) by mx0b-00823401.pphosted.com (PPS) with ESMTPS id 3ysr2gjvh2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jun 2024 16:27:19 +0000 (GMT) Received: from ilclmmrp02.lenovo.com (ilclmmrp02.mot.com [100.65.83.26]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by va32lpfpp02.lenovo.com (Postfix) with ESMTPS id 4W2wJk6ffZz50DhP; Mon, 17 Jun 2024 16:27:18 +0000 (UTC) Received: from ilclasset02 (ilclasset02.mot.com [100.64.49.13]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mbland) by ilclmmrp02.lenovo.com (Postfix) with ESMTPSA id 4W2wJk5Bvkz3p6jp; Mon, 17 Jun 2024 16:27:18 +0000 (UTC) Date: Mon, 17 Jun 2024 11:27:17 -0500 From: Maxwell Bland To: "open list:BPF [GENERAL] (Safe Dynamic Programs and Tools)" Cc: Catalin Marinas , Will Deacon , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Zi Shen Lim , Mark Rutland , Suzuki K Poulose , Mark Brown , linux-arm-kernel@lists.infradead.org, open list , Josh Poimboeuf , Puranjay Mohan Subject: [PATCH bpf-next v7 0/2] Support kCFI + BPF on arm64 Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Proofpoint-GUID: DCrRkzBGYObmSj7eeOhAY7az4W0sahWh X-Proofpoint-ORIG-GUID: DCrRkzBGYObmSj7eeOhAY7az4W0sahWh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-17_14,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=814 adultscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406170127 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240617_092750_699854_2C8A1354 X-CRM114-Status: GOOD ( 10.95 ) 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 Adds CFI checks to BPF dispatchers on aarch64. E.g. : paciasp stp x29, x30, [sp, #-0x10]! mov x29, sp + ldur w16, [x2, #-0x4] + movk w17, #0x1881 + movk w17, #0xd942, lsl #16 + cmp w16, w17 + b.eq + brk #0x8222 blr x2 ldp x29, x30, [sp], #0x10 autiasp ret Changes in v6->v7 https://lore.kernel.org/all/illfkwuxwq3adca2h4shibz2xub62kku3g2wte4sqp7xj7cwkb@ckn3qg7zxjuv/ - Squash one of the commits to avoid code churn Changes in v5->v6 https://lore.kernel.org/all/mafwhrai2nz3u4wn4fu72kvzjm6krs57klc3qqvd2sz2mham6d@x4ukf6xqp4f4/ - Add include for cfi_types, fixing riscv compile error - Fix authorship sign-off information Changes in v4->v5 https://lore.kernel.org/all/wtb6czzpvtqq23t4g6hf7on257dtxzdb4fa4nuq3dtq32odmli@xoyyrtthafar/ - Fix failing BPF selftests from misplaced variable declaration Changes in v3->v4 https://lore.kernel.org/all/fhdcjdzqdqnoehenxbipfaorseeamt3q7fbm7ghe6z5s2chif5@lrhtasolawud/ - Fix authorship attribution. Changes in v2->v3: https://lore.kernel.org/all/20240324211518.93892-1-puranjay12@gmail.com/ - Simplify cfi_get_func_hash to avoid needless failure case - Use DEFINE_CFI_TYPE as suggested by Mark Rutland Changes in v1->v2: https://lore.kernel.org/bpf/20240227151115.4623-1-puranjay12@gmail.com/ - Rebased on latest bpf-next/master Mark Rutland (1): cfi: add C CFI type macro Puranjay Mohan (1): arm64/cfi,bpf: Support kCFI + BPF on arm64 arch/arm64/include/asm/cfi.h | 23 ++++++++++++++++++++++ arch/arm64/kernel/alternative.c | 18 +++++++++++++++++ arch/arm64/net/bpf_jit_comp.c | 21 +++++++++++++++++--- arch/riscv/kernel/cfi.c | 35 +++------------------------------ arch/x86/kernel/alternative.c | 35 +++------------------------------ include/linux/cfi_types.h | 23 ++++++++++++++++++++++ 6 files changed, 88 insertions(+), 67 deletions(-) create mode 100644 arch/arm64/include/asm/cfi.h