Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp241743lqp; Sat, 8 Jun 2024 14:16:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWayZCGwqV63ilQzRv2ebeTCjQO9e1NLPyo20FpgZcImYi2KRImVoIoKMluHyyxB25OvgZlZpCZqI8mJTfdtNjS/xpgw+2r899EBp/IbQ== X-Google-Smtp-Source: AGHT+IF+dkFjq55JX7C6qTk9Y5hp5gc3QChX0mPTq6WQSNfq+/Pdspmcjlz94gu9ioYNJY/r9hut X-Received: by 2002:a81:e20c:0:b0:61b:3356:f1b5 with SMTP id 00721157ae682-62cd55f6a0dmr64450127b3.28.1717881401900; Sat, 08 Jun 2024 14:16:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717881401; cv=pass; d=google.com; s=arc-20160816; b=IzMnXHuFlgZV/EGXDIyu3n6B5CH0lUqY3bgKnJ/5L9bLAfdE8Edb/V5dMWPF28VJRN rWXtg2l7L01ywSuvEvX8vziSmQRsCcn/Yu+38WmgANpENeQ2jCAQ2d/YuW4WFMzgUMPq YGg/OHuSS3bVXDvi/Ol0FEE3u0yVD1HS4t4Zcke2l6dTUqvVgTssBh7q8qgaAjeAAuwu rT1yHIFOAI+8JVR0BJ494YSZvXwlE69i8+Kpzc3+z4cVO6icARZ47NKMo5PiUm7QVNY7 LO/IPmW6Whs3+wjtHuUbFGXlcIIsodYPUqz/rja96GYSTcGTxwe+RrZ3OSnIAZC5oCfy ChoQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:feedback-id:dkim-signature:dkim-signature; bh=0YjzCY6kziUrd0juArDnYi2Mlm4V8ledwTgp3zoKTHM=; fh=7p3zW3H9e6UszM/AJaLmHPpuflcO/2GflVHwlaDGNQU=; b=HhTEs4RNYpTvsS7rfA5r+kEWXE1zsj2/aVLZR2IUZEXAQBpxs6pFyyU80JeUZNM+0C BJr4G9HomhAE7l7dTEmjbHeULJV1UISvB/Iggz+Tx7l06yon4lq5FutMrK11guUcWPyI SHrGsc0yANgu0e+lJHyr4czm0EPsrHRzgvBCpHerV0TKWdP5S0fqr5lK7XEtmtYZbt94 /IbN/vDiLIR9e2k+HO9rBtP3lj9n9OsY0rFH+qeh0qr/f1Q02/isg/lecKRj3vWmGSqp BwmWbVBR0bKj3kfoBAglVyR4sQ40+H+3lixjsVUatX5nQ/VyD8Mq7gv+7en+WmWkmKwD UbPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm3 header.b="C/2UCxEc"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=ekWp98Kd; arc=pass (i=1 spf=pass spfdomain=dxuuu.xyz dkim=pass dkdomain=dxuuu.xyz dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-207191-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207191-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-44038b16209si70981591cf.249.2024.06.08.14.16.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 14:16:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207191-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm3 header.b="C/2UCxEc"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=ekWp98Kd; arc=pass (i=1 spf=pass spfdomain=dxuuu.xyz dkim=pass dkdomain=dxuuu.xyz dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-207191-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207191-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 804FE1C20D50 for ; Sat, 8 Jun 2024 21:16:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE154288DB; Sat, 8 Jun 2024 21:16:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dxuuu.xyz header.i=@dxuuu.xyz header.b="C/2UCxEc"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ekWp98Kd" Received: from wfout6-smtp.messagingengine.com (wfout6-smtp.messagingengine.com [64.147.123.149]) (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 16DCC6FC6; Sat, 8 Jun 2024 21:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717881383; cv=none; b=LaiDAERb66VRcHzus4cXsKeCEFUj9Gu5FsqQt0NUgFn9WY0l7JlZcHp375YKn0Ofs2DZc2GZwK+kja1SQtBuMzzU9oA8p4GK90R606tSJErgAyUumYpT1t8BLyDSTJw3Z6EuILMmselF+gO83O0s35XZsdnP874G0xzaoN7zx9s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717881383; c=relaxed/simple; bh=ILnuGu5r6cuHQ9wdUVbkAPXhJPVeZtLb6jYztlxoK3Q=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rTdccNit8euZF51MKXKObF1cPTlDm53YFUGXSFw8ACj/V66O8HqYEhfRttjVFpv724gRfkjP2jduzuOFHTBVA84RhWQdd3eIwua6X0qjemceM20Rb9DyLINXlt1uA5C7xXT9q0qw9XkJuZ14Do9VAqeRSDFnfd1OaqlzYpxSkYQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dxuuu.xyz; spf=pass smtp.mailfrom=dxuuu.xyz; dkim=pass (2048-bit key) header.d=dxuuu.xyz header.i=@dxuuu.xyz header.b=C/2UCxEc; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ekWp98Kd; arc=none smtp.client-ip=64.147.123.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dxuuu.xyz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dxuuu.xyz Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfout.west.internal (Postfix) with ESMTP id 7C1F31C00091; Sat, 8 Jun 2024 17:16:20 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sat, 08 Jun 2024 17:16:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dxuuu.xyz; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to; s=fm3; t=1717881380; x=1717967780; bh=0YjzCY6kziUrd0juArDnY i2Mlm4V8ledwTgp3zoKTHM=; b=C/2UCxEcrta2pXIQsQBSLsP5dh3P/OXAmTLTF mYPK2tbDh9O5/BWTx/NXJ92yEdolAXahFJLFsXq3RnMzQJNQjYQkDgSSQYbt0FcH AGfluzboETbuhYl4dSBCibukN9wzGxzBmX74S1KpZ4qPh9YoZzsAMaBPtAd28Drq SN0gq2PUXqDZH6Iw8PXNG4AUwnkvxutxvPEXGuhxEB81wqGm93SJuzwlb43mRpql m3ERGu3cj3oArbBWBR436SeoBpnOcyt6rQv/gV0KM97HPHsKxlyC1XaPHnonUrTO KbtUTChrm0XH5nWmUHNIYFifHf7+xJrykdtEcp7xVlQGw20qg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1717881380; x=1717967780; bh=0YjzCY6kziUrd0juArDnYi2Mlm4V 8ledwTgp3zoKTHM=; b=ekWp98Kdaj4NLFqyv137QlWn0Oq4q0VzN6XzuCs8a0qq MOmHo8VLWG5gOvu9CIUnb8Lrzh6pbU5Pq26GJaoYs17tI4plC+K7eSbZZXA/SuW/ powdCyu+V34uTsI2Hh2ImtHO6D0OKCIKRU81g5ewFMqZFZKR8iTRRTzhyHfsaWfs th5gnmKlr7ZmxhFn2koA1HPGJQdJF5gihtR63MEgxFONLMeeXEIMCKXJdyK9sSeb rwe3m/2KJsgb3krIMsz0cyExxJEtHP0jfAm7WiYziREI2/wJBzNlVRV4S46RRicg FK698k+04raY/IhfsgH+LKgSNK5lLs7L2Y3WK4rLtg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedtgedgleegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvf evufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeffrghnihgvlhcuighuuceougig uhesugiguhhuuhdrgiihiieqnecuggftrfgrthhtvghrnhepvdeggfetgfelhefhueefke duvdfguedvhfegleejudduffffgfetueduieeikeejnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomhepugiguhesugiguhhuuhdrgiihii X-ME-Proxy: Feedback-ID: i6a694271:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 8 Jun 2024 17:16:18 -0400 (EDT) From: Daniel Xu To: linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, fsverity@lists.linux.dev, andrii@kernel.org, olsajiri@gmail.com, quentin@isovalent.com, alan.maguire@oracle.com, acme@kernel.org, eddyz87@gmail.com Cc: kernel-team@meta.com Subject: [PATCH bpf-next v4 00/12] bpf: Support dumping kfunc prototypes from BTF Date: Sat, 8 Jun 2024 15:15:56 -0600 Message-ID: X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This patchset enables both detecting as well as dumping compilable prototypes for kfuncs. The first commit instructs pahole to DECL_TAG kfuncs when available. This requires v1.27 or newer. v1.27 is nearing release at time of writing. Following this, users will be able to look at BTF inside vmlinux (or modules) and check if the kfunc they want is available. The final commit teaches bpftool how to dump kfunc prototypes. This is done for developer convenience. The rest of the commits are fixups to enable selftests to use the newly dumped kfunc prototypes. With these, selftests will regularly exercise the newly added codepaths. === Changelog === From v3: * Teach selftests to use dumped prototypes From v2: * Update Makefile.btf with pahole flag * More error checking * Output formatting changes * Drop already-merged commit From v1: * Add __weak annotation * Use btf_dump for kfunc prototypes * Update kernel bpf_rdonly_cast() signature Daniel Xu (12): kbuild: bpf: Tell pahole to DECL_TAG kfuncs bpf: selftests: Fix bpf_iter_task_vma_new() prototype bpf: selftests: Fix fentry test kfunc prototypes bpf: selftests: Fix bpf_cpumask_first_zero() kfunc prototype bpf: selftests: Fix bpf_map_sum_elem_count() kfunc prototype bpf: selftests: Fix bpf_session_cookie() kfunc prototype bpf: selftests: Namespace struct_opt callbacks in bpf_dctcp bpf: verifier: Relax caller requirements for kfunc projection type args bpf: treewide: Align kfunc signatures to prog point-of-view bpf: selftests: nf: Opt out of using generated kfunc prototypes bpf: selftests: xfrm: Opt out of using generated kfunc prototypes bpftool: Support dumping kfunc prototypes from BTF fs/verity/measure.c | 3 +- include/linux/bpf.h | 8 +-- kernel/bpf/crypto.c | 24 +++++--- kernel/bpf/helpers.c | 39 +++++++++---- kernel/bpf/verifier.c | 12 +++- kernel/trace/bpf_trace.c | 9 ++- net/core/filter.c | 32 +++++++---- scripts/Makefile.btf | 2 +- tools/bpf/bpftool/btf.c | 55 +++++++++++++++++++ .../testing/selftests/bpf/bpf_experimental.h | 2 +- tools/testing/selftests/bpf/bpf_kfuncs.h | 2 +- tools/testing/selftests/bpf/progs/bpf_dctcp.c | 36 ++++++------ .../selftests/bpf/progs/get_func_ip_test.c | 14 ++--- .../selftests/bpf/progs/ip_check_defrag.c | 10 ++-- .../bpf/progs/kprobe_multi_session_cookie.c | 2 +- .../selftests/bpf/progs/map_percpu_stats.c | 2 +- .../selftests/bpf/progs/nested_trust_common.h | 2 +- .../testing/selftests/bpf/progs/test_bpf_nf.c | 1 + .../selftests/bpf/progs/test_bpf_nf_fail.c | 1 + .../bpf/progs/verifier_netfilter_ctx.c | 6 +- .../selftests/bpf/progs/xdp_synproxy_kern.c | 1 + tools/testing/selftests/bpf/progs/xfrm_info.c | 1 + 22 files changed, 183 insertions(+), 81 deletions(-) -- 2.44.0