Received: by 2002:ab2:715a:0:b0:1fd:c064:50c with SMTP id l26csp20491lqm; Mon, 10 Jun 2024 11:19:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWG9e0VuHyKxe/wyHMz+XppphfgJm/6oBpHzN2/8WayMi0p//yxYHobaKp0v9/IPTquB3CsqDHJI30b+r7RBIkFxOgyi/Zk/L//3u0jTw== X-Google-Smtp-Source: AGHT+IEH65QiYcLF+GV/Up+qtFd1Y2nd2Wf4QnOZGMRnJDkelVchptg4/1n8LHCU2dEwqf4AEijj X-Received: by 2002:a05:6359:6b83:b0:19f:34c5:db76 with SMTP id e5c5f4694b2df-19f34c5dcb0mr736871555d.23.1718043561864; Mon, 10 Jun 2024 11:19:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718043561; cv=pass; d=google.com; s=arc-20160816; b=enF3gelOppjaLe8YDvOdoDdQjbdXHwI2aD9v2kbZzRW+Vo9D7PMJZ7WycsTRQ8Nqn7 gTZeDJuqaYQXkHRfso58u8LVLYn2vXZllI/4Zdz0s0GZC69kKmurjg9Z5DTUXLlfjXsx JD+WewaN/HLWJcsW+t86FXZZVc/0qlig/U5Lg2be2dHlvqA2TzAHF24p372aeIizxgZJ kYpOn1jdBDARLKic4Zy69YP1KAADOZE0rYMD4svdhgc9ctJkdaII2xpxpsgQjmEiHwCO pia1Lw5b3/YqZ8Fn5bUtMlmN6TAseCtt5mY8Drw9aJDWQ3T6IwYly6TpTvj/UjKwBIH0 lOXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=2Gnp3PO7oU3dzU8H0CiRDGU9SqVqHXr7nHqbHwRrpoI=; fh=6T1cn+zZISETfkSQY+ffbsWoINvS+CfK4zu/XnbAny8=; b=TPEwv5V0ejMDJiPLuPkaSwR4DTMxRsCAnrowQn6cbpfuJr7NLZp9TQm2T0D1eLxgwS GT293C12fny7qGBAmUKkOuWMSg2mIVWNQF6NONCo/+GpBwEC1lxefHZyC84P2j0WuJQV pv9cFFdvOlu9Z0rTTQXQBPjGuY4TqerNJsYpyBkl/mS585Og8TNbUU66nQNQp/iWE/fC YyOm8S/pVrsAwGAbrwnpSiyDgc8IVQUoq8nCooHuv1thpQqg2LnVfzH7nvrDVuKQ+pPd qANK/epk9SPfUQGQjUzLtrcJSaIFrabTRNt/2ZFSJ9cnc0hx4GhItFa5cgAPUrhSW5W9 tM3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@motorola.com header.s=DKIM202306 header.b=Moz7MRho; arc=pass (i=1 spf=pass spfdomain=motorola.com dkim=pass dkdomain=motorola.com dmarc=pass fromdomain=motorola.com); spf=pass (google.com: domain of linux-kernel+bounces-208722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208722-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=motorola.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de2819a2f9si7972706a12.568.2024.06.10.11.19.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 11:19:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@motorola.com header.s=DKIM202306 header.b=Moz7MRho; arc=pass (i=1 spf=pass spfdomain=motorola.com dkim=pass dkdomain=motorola.com dmarc=pass fromdomain=motorola.com); spf=pass (google.com: domain of linux-kernel+bounces-208722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208722-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=motorola.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2810C283D40 for ; Mon, 10 Jun 2024 18:19:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB6221494B9; Mon, 10 Jun 2024 18:19:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=motorola.com header.i=@motorola.com header.b="Moz7MRho" Received: from mx0a-00823401.pphosted.com (mx0a-00823401.pphosted.com [148.163.148.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FEFB15A8; Mon, 10 Jun 2024 18:19:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.148.104 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718043551; cv=none; b=qe6hCwlZCb8+arJ/28aa8ANP/S8p3CC9jAm5Mfand8iU/wm3D0H3fYNaNUU6BbTCBjP2xBMTvFUIWrAAJVDgLg7VcAF2jSD7QMuNy8V2o8VdUGH5P+1kcWo0t3kTS/6s4vw1hLvfnWF6O/EUCWo24U0fisNR2A9AvIm+4ljlePo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718043551; c=relaxed/simple; bh=iSlArSiy4r9V/ntgrh4SI4jK9M/oixVSelyA9EMIjfQ=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=p2cjuRyc5PqV4tSahZbBqFrxAmWDAQIFUPKZiIA5Y+LZYy4jkuApiHXbJIMQSByUAGocQkJPNZ5uhlAfzlLZDTSTMr3SXEj2qm9QkEZRxC6UsxQW3AaLpEadSEPJTf8bRTaC+Utef/86R5j8OqfO/YQbK5UBaUIwH+iJPPW27Ls= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=motorola.com; spf=pass smtp.mailfrom=motorola.com; dkim=pass (2048-bit key) header.d=motorola.com header.i=@motorola.com header.b=Moz7MRho; arc=none smtp.client-ip=148.163.148.104 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=motorola.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=motorola.com Received: from pps.filterd (m0355088.ppops.net [127.0.0.1]) by m0355088.ppops.net (8.18.1.2/8.18.1.2) with ESMTP id 45AAbPfO004869; Mon, 10 Jun 2024 18:18:46 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=2Gnp3PO7oU3dzU8H0CiRDGU9SqVqHXr7nHqbHwRrpoI=; b=M oz7MRhosPGhg66J2FpX91d/Fd6iJDWcj9oOHohIQSaSGEFQB5hFH1O7eqTHa1rMJ HYr89M1Di5KgHj8v43foF1qvcVWpqhbuexZLBJDZ4EvAiEbz73T9yClI/lcPr+VZ 7zwRRw+iVlhfmQL2in6kR5aR7+EDDLKFK0QYVKrHOyt5j+ZQ3DbAkTt1+TA7HTZk Ky5piOrntaVrExD8EAJTgX7bmoI1ELAPr/ypx++GArwQlPf09L5YyxHqRiiPIcvf mhSd3ECuulVM1VJyStjitFC1v4M5/39aks7RiUykZstBklIwzXOEe8G5jwYcXZUf WKAZKSe+mBWWvidaUx5IQ== Received: from va32lpfpp03.lenovo.com ([104.232.228.23]) by m0355088.ppops.net (PPS) with ESMTPS id 3yn4ft2b9v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jun 2024 18:18:45 +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 va32lpfpp03.lenovo.com (Postfix) with ESMTPS id 4Vyg6X686lz4xlJP; Mon, 10 Jun 2024 18:18:44 +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 4Vyg6X4pfQz3p6jp; Mon, 10 Jun 2024 18:18:44 +0000 (UTC) Date: Mon, 10 Jun 2024 13:18:43 -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 v5 0/3] Support kCFI + BPF on arm64 Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Proofpoint-GUID: 6ZfICFZVn1vTS0dbMdV5CMaxemFOaXVN X-Proofpoint-ORIG-GUID: 6ZfICFZVn1vTS0dbMdV5CMaxemFOaXVN 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-10_04,2024-06-10_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 bulkscore=0 spamscore=0 priorityscore=1501 malwarescore=0 phishscore=0 suspectscore=0 mlxlogscore=999 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406100138 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 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 Maxwell Bland (1): arm64/cfi,bpf: Use DEFINE_CFI_TYPE in arm64 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 | 34 ++------------------------------ arch/x86/kernel/alternative.c | 35 +++------------------------------ include/linux/cfi_types.h | 23 ++++++++++++++++++++++ 6 files changed, 87 insertions(+), 67 deletions(-) create mode 100644 arch/arm64/include/asm/cfi.h -- Sorry for the extreme delay Puranjay and other maintainers on the submission for this. The past month I was on incident response rotation here at Moto and my hands were full with scripting build scanning steps and other product deployment nonsense. Better late than never, though, if these changes have not been merged yet. (-: Tested on a cortex-a76 qemu instance and self-tests are matching the baseline bpf-next success rate (Summary: 509/3700 PASSED, 77 SKIPPED, 37 FAILED). Thanks for your review and regards, Maxwell 2.39.2