Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp256321pxm; Tue, 22 Feb 2022 09:59:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7JWnL5qh4MK3BuiinBNCxp3fAwIzvZzRAM5KBCeec9r75ezvq1BvQukHUddKat0+EO257 X-Received: by 2002:aa7:df17:0:b0:410:d029:ce90 with SMTP id c23-20020aa7df17000000b00410d029ce90mr27225963edy.50.1645552787964; Tue, 22 Feb 2022 09:59:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645552787; cv=none; d=google.com; s=arc-20160816; b=RZb+zkv91857/GZjLwsT+sRHog5QVMzxsxkTi/W6Cpq3pcAkk5YMbyUa9co2TxTfEw F0YGOgj1FC8DLEKABxVMxJp7FF3+5onmYL4ucE/Auo8F5a93Rqy4ZOu4MegZn4wd9jQN Vh96dS4e4S3m8Cxgec2M2MNL0CSsMQ2x/iERRtYBJh5cZ7PWSnmdxQeDYb7YOhsX7wek aNbvSVaCZ+MspvkHCeLwRuIqlFpzUy/i87lmA94TuCQEYch0aVer5CGlFMbLo+YYmcNA HXrkUg1E1Iw1QEW7xY3gknZXqx2zH9lRkhJU5mStCXS1pNX4FouxU7od3UzeaL+f4EYT aB5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bC0ScHQj0MkwYmcS0tlqrCca7RLjWPuQi65LzDvUAiI=; b=ZCGsqfL+EbBv+ESLH7+4jhILJLHPLi9SnRmbeivmBU7wfWoHm/yvmGHUP+nZv9Ygpf kMPtaSpFQe66YSg3QxFkkBprydY8pQJQ5+iWV5xTb/vFzJdCY/acVRG6vx5mQCcCa5J+ BAGogNDs9+oyfcuZezAWFAOG+6wvykPw7u6RoDZNFvr6KlOuFE9HbaTYr3bKiuqR3HYO VEJKtl2C2aSiM2d8Srg4x3iNn6q8Cgd5sbzWuzbz7uau496nvV2LrjE2+dyCRKC8w51z 6MvHSUtIG6xfdUUhjPen6LcybydS3/DHHJCAxngoUyMvgVz/Tx2W/4gMFVFiJrtxstPs RBrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sK8S8oMD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1si3209078edc.122.2022.02.22.09.59.25; Tue, 22 Feb 2022 09:59:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sK8S8oMD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234576AbiBVRIX (ORCPT + 99 others); Tue, 22 Feb 2022 12:08:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234573AbiBVRIS (ORCPT ); Tue, 22 Feb 2022 12:08:18 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6EE965795; Tue, 22 Feb 2022 09:07:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 55986CE13B8; Tue, 22 Feb 2022 17:07:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F5A7C340E8; Tue, 22 Feb 2022 17:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645549662; bh=fhc+sE0bQphu+0+3eMvHc0aupFbhQC00veXlE3qmN9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sK8S8oMDQBBikKCVCz066nSXb9LuPrYuTR5wcmFfqQeuAwAqZB+4XN+gTFJIROa0x tDaVSiiRa3YFgjkfXjDvu6mWfNDEnU4en0nTvL2GpaSET9fynsc9llElVBx4FSE+yH Q9QC98NekX1ACIJn9YIHPgUJL1TdvgOgwRDExjo9WZr5rrdMv6ueBBGm+rmh+BQdaP lQlOtXOIjjUbj9RXjZ9B+6hfiE+fhTKsxY0q/w5o5OkqFWgyQTclq4XX7E/duGrTGe 7Cj5n4ivnKUjtBP04GuZsoRyTCpHudlfvESAIFOJm9GQbPuq5NGIF1ZEXUTEJpnyqs 1I9rjEdWHUFGg== From: Jiri Olsa To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Masami Hiramatsu Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, lkml , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Steven Rostedt Subject: [PATCH 07/10] libbpf: Add bpf_link_create support for multi kprobes Date: Tue, 22 Feb 2022 18:05:57 +0100 Message-Id: <20220222170600.611515-8-jolsa@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220222170600.611515-1-jolsa@kernel.org> References: <20220222170600.611515-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding new kprobe_multi struct to bpf_link_create_opts object to pass multiple kprobe data to link_create attr uapi. Signed-off-by: Jiri Olsa --- tools/lib/bpf/bpf.c | 7 +++++++ tools/lib/bpf/bpf.h | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index 418b259166f8..5e180def2cef 100644 --- a/tools/lib/bpf/bpf.c +++ b/tools/lib/bpf/bpf.c @@ -853,6 +853,13 @@ int bpf_link_create(int prog_fd, int target_fd, if (!OPTS_ZEROED(opts, perf_event)) return libbpf_err(-EINVAL); break; + case BPF_TRACE_KPROBE_MULTI: + attr.link_create.kprobe_multi.syms = OPTS_GET(opts, kprobe_multi.syms, 0); + attr.link_create.kprobe_multi.addrs = OPTS_GET(opts, kprobe_multi.addrs, 0); + attr.link_create.kprobe_multi.cookies = OPTS_GET(opts, kprobe_multi.cookies, 0); + attr.link_create.kprobe_multi.cnt = OPTS_GET(opts, kprobe_multi.cnt, 0); + attr.link_create.kprobe_multi.flags = OPTS_GET(opts, kprobe_multi.flags, 0); + break; default: if (!OPTS_ZEROED(opts, flags)) return libbpf_err(-EINVAL); diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h index 16b21757b8bf..bd285a8f3420 100644 --- a/tools/lib/bpf/bpf.h +++ b/tools/lib/bpf/bpf.h @@ -413,10 +413,17 @@ struct bpf_link_create_opts { struct { __u64 bpf_cookie; } perf_event; + struct { + __u64 syms; + __u64 addrs; + __u64 cookies; + __u32 cnt; + __u32 flags; + } kprobe_multi; }; size_t :0; }; -#define bpf_link_create_opts__last_field perf_event +#define bpf_link_create_opts__last_field kprobe_multi.flags LIBBPF_API int bpf_link_create(int prog_fd, int target_fd, enum bpf_attach_type attach_type, -- 2.35.1