Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp543391lqp; Wed, 12 Jun 2024 09:00:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMI94v5wNYKnmgrF9dYtxRg2nSJvU1ZmIxy2ctt1Er1LLe8SxuAT2q59oDJSOR4DJu0/42xNsC834AoCMoG1ySdCSpqP+4pQ+A6lnZAA== X-Google-Smtp-Source: AGHT+IEDs03wUoHQM2XkdQZvZ7gfM3+Hwz0sL8zqD+1gHqLlPjf8I2P2SL+qPwRh1dwPUkOBLBXt X-Received: by 2002:a17:907:86a9:b0:a6f:256c:8163 with SMTP id a640c23a62f3a-a6f47b4eefdmr148292866b.0.1718208017557; Wed, 12 Jun 2024 09:00:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718208017; cv=pass; d=google.com; s=arc-20160816; b=i+a6cLB2bJbMAmC2RdMoKHQuBFeBiBxqRZ4Z2bhPVDNiTkfywVnBALaifbFQvt788e g2uO/Wa/w96lS2VRHd/CzE1/vsAbTfaN/CoCv7D8FXoJnqSmXvR1hlTKcwSglVNJ0Kfy +ouQX3MdOqSos4xYFaMAQo+Y++PYvjyppwx1ENYepC7O+J/muRBNO4gyUeYEvGvwiOqT dqQEdbUiyTzFt/vfJZdmfIQnpmMut7I92KY4OKQt1/2tQ+AGhhsPyYVHu0wznUMXxUca bfvYX24qqMtDQ6vZ09DXB3MVJHeEi/JCxEnhCTo8D8hHW4QZ4K6Qud0+jIPJbXk/dBDc mwPA== 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=lZNEnqp773uzAqziPN4z0qNlf0lINbmqCuH/tcesE+g=; fh=TvEFJjSfEzXAD/hfi030Y46DX738qBQPVS2bn9KNQD8=; b=H23OGjC5w4waFicqJFyXrnbweTCaHon5dvG4mBwD3F3sNiZblFmX35KIHC30/541Dv OPGMkOoB1AeaOd+YpLioReZsY8IyyGDk6ibESeSx7GIm2rygYqZr8XiJBmivxxKJ7T5v CBPsF4WE2+EHcSq3M6XOeTOOfEJ+m6zdRtQaPVjpxMT5P5IinawLx62kV8ZNlFQ327gJ 90BkRi13A764E+5GoQMswWWctBsgh5Rn4R6ZeuApSQlIIMmnUYxtlIc5rM2KMf3CW/Zy ovVzaQ9CA8yURUVKaBiRxyfJx1mmx3FYqAnYCVwjRPXtgc5ns2wtFuj5d3hmJx2391ri 8SCQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm3 header.b=HevoMQeH; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=pNgewxui; 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-211841-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211841-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f270249c0si276916466b.43.2024.06.12.09.00.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 09:00:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211841-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm3 header.b=HevoMQeH; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=pNgewxui; 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-211841-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211841-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 11E241F215DF for ; Wed, 12 Jun 2024 16:00:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 661FA181D1F; Wed, 12 Jun 2024 15:58:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dxuuu.xyz header.i=@dxuuu.xyz header.b="HevoMQeH"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="pNgewxui" 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 5B807181CE2; Wed, 12 Jun 2024 15:58:53 +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=1718207935; cv=none; b=jSy4EmMmDEZ2RIDC/BlT5oqQaxtGQR+GVbw7Qqjxem/x5b5pqTybVc396rChMNDDTDEPThhv+6e5VrmdQOj6XKvBFvs2sDt+8mQOEtq4BVfRXev6zhS3aLzH2iWcQ0iTa1JkGNyN9FJQybfGeUUJrb8bh65SRFSxY50kF8fVDyU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718207935; c=relaxed/simple; bh=W+jeMBnxhS6jlPaTrEAMDVDFNqWeLN6ix77HMDsJyOE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FqvunDzDlYkB2WbvdbPTxqeDAaBh0Pq9l3yLzJG6542fr1Td9q2QaqR3fMxQkczxo0IM35ZQX+DfzI7lBEXM+BWDprF26p3+vozZzzM6YoPoCZZli6HggB16jjIQjF5DiK/p9vdLLpczkBMoVt3jF6Kb1EGoC0YT3FDiyFcpUpg= 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=HevoMQeH; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=pNgewxui; 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 compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.west.internal (Postfix) with ESMTP id B0AF41C000FC; Wed, 12 Jun 2024 11:58:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 12 Jun 2024 11:58:52 -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=1718207931; x=1718294331; bh=lZNEnqp773uzAqziPN4z0 qNlf0lINbmqCuH/tcesE+g=; b=HevoMQeHXigG+6FXskHzOBLCeauAiRxC8h389 dej5hFVj6zR0aoICtH1AtSY+Ryt+tLMtszdrsDxP00dTkmqB7+9TtISMilMmBQIu 9HkEbwSseUZ8zWLs39Pe2Y5Xdui7FAVsFjLRoFZs9U9obAFcOvABgWKB2MoLwwlM m2QJGfw/kjQbOqrwe2nvhYZBTZpoM+dMpBh+ncNo2dEdSSRS8QWdH8b6kKi6M61I quylEi3QeddM8x2ra2R8Av8oU586A5e+5fkMapHOyoSxVWM5UOzU4VoLA/cSuD9s Ma3tMuNyJt+mFPio/dIVZxzfYTY7fB+qpUMcwTZ8T0loBIJQg== 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=1718207931; x=1718294331; bh=lZNEnqp773uzAqziPN4z0qNlf0lI NbmqCuH/tcesE+g=; b=pNgewxui531SonZy0q0p0krvK2Mlrb5HK89Ht4MzBaVb J/d0QC4zarry+HE7mfOOKkRCpLQROBmxtEL2xa+MRweTqtPrpDNThCpoiZH4NNAL 58LxIwt/AsRkU/A2QRNG9NS8ipdJI/DtjSEu61whmv3iwroVsGFvfP3HDRwT/2HP SrzuiHmOF3rG7SawQ+hJMNigPT3SWHLTkTXhcXapYL87404PLwm3DoGgasI9aJDy 28X26vh+up5KcXCrLrz/gK/rb3ZYqdVZBe6cS5amnJ/2nhGY3wzBm0XNEr9oZXLe tNgMtwxU3/c2apvUTKVgp5BRWoB8pbvXlVyFH2gTFw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedugedgleefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdlfeehmdenucfjughrpefhvf evufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeffrghnihgvlhcuighuuceougig uhesugiguhhuuhdrgiihiieqnecuggftrfgrthhtvghrnhepiedtkefgudevteevvefgue fhgeeikeelgeehfedtkefffeejgfetteefueekgfeknecuffhomhgrihhnpehgihhthhhu sgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegugihusegugihuuhhurdighiii X-ME-Proxy: Feedback-ID: i6a694271:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 12 Jun 2024 11:58:49 -0400 (EDT) From: Daniel Xu To: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, fsverity@lists.linux.dev, andrii@kernel.org, jolsa@kernel.org, linux-kbuild@vger.kernel.org, linux-trace-kernel@vger.kernel.org, netdev@vger.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 v5 00/12] bpf: Support dumping kfunc prototypes from BTF Date: Wed, 12 Jun 2024 09:58:24 -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 which was released on 6/11/24. With it, 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. Tested with and without the required pahole changes: * https://github.com/kernel-patches/bpf/pull/7186 * https://github.com/kernel-patches/bpf/pull/7187 === Changelog === From v4: * Change bpf_session_cookie() return type * Only fixup used fentry test kfunc prototypes * Extract out projection detection into shared btf_is_projection_of() * Fix kernel test robot build warnings about doc comments 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: Make bpf_session_cookie() kfunc return long * 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 | 5 +- include/linux/bpf.h | 8 +-- include/linux/btf.h | 1 + kernel/bpf/btf.c | 13 ++++- kernel/bpf/crypto.c | 24 +++++--- kernel/bpf/helpers.c | 39 +++++++++---- kernel/bpf/verifier.c | 12 +++- kernel/trace/bpf_trace.c | 17 +++--- 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/progs/bpf_dctcp.c | 36 ++++++------ .../selftests/bpf/progs/get_func_ip_test.c | 7 +-- .../selftests/bpf/progs/ip_check_defrag.c | 10 ++-- .../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, 193 insertions(+), 84 deletions(-) -- 2.44.0