Message ID | 20230306064833.7932-1-imagedong@tencent.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1696997wrd; Sun, 5 Mar 2023 23:04:56 -0800 (PST) X-Google-Smtp-Source: AK7set9yIPaxJro6dYMhP6y9crjjopgsgEqPI5YVFVydTKJ+V74MFp69tkvQ8bwm/BE7JldT/TWW X-Received: by 2002:a17:907:5cb:b0:8b1:3a23:8ec7 with SMTP id wg11-20020a17090705cb00b008b13a238ec7mr12680865ejb.43.1678086296104; Sun, 05 Mar 2023 23:04:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678086296; cv=none; d=google.com; s=arc-20160816; b=ggQXCerLCSdTbtLhOUXg0+4PP3bVv6+PqjUB4bQHiA64HwlvW6qQG7ffxJbsAUfsO8 fzjQn95Tfz0V4M8Y5TEsAbvL3ssGcXx8QsCjs1BU+8xZuxI4ru4YPPMJSJhqMK7u/EdV Db6gjNUh4ao+s4k4O9jSK3yDvwI50Qaw5xy1n0Gv0+VjxVok/zsigrRu8GfzZJgLrAq6 1KFX8L4aWpYgFTjY2fMmnYj5erjK5JkPSShdgEND30IuOCRflaeKNfHPnR1QpJUTJoGS h+s3JaxRPHzP1XFXD1QnJSlL7NbmPNfWO0rreluxtPVXfJdauGnyd9vMsRPed0AlEPt3 GLVw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=eFHn5FfCLzXc2Zphnr99D4T7djusYGDgP5E+TmE5X9w=; b=E+/C3GoWJ2sZv9CPm+Jxd1U0MWeydx9I3FbSxxaxT1nA+wS8GkHh9IbwxwofciB5rb sBvTWLfeA+9EMzTNhJ+bhRSRY5E9Tse4d3wJttQ55wjt4d+l5axJqJnhw+tKeCwAHgnU M4WhD1bh9XHwiYheVYetRwQwKpsa6O4vEAXdvYHmI7DoQO3eOvxLjGyBPPHJmeE9a1by 5R1g4WqCpt7WNS+mAdqdsgSI1k9d7R30BxOeYeYvD3dIJGrdTEViCd7iUdsUgz2h5ZaC BItgCOUf5M9Vha1y/vlxKzlovkOddStFqgufwBfmZE9S42YuUeTaz7Vy2xqqSS3o3hYc Rwtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="hwfI/PoR"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc4-20020a1709071c0400b008d201d2ef0esi10689272ejc.367.2023.03.05.23.04.32; Sun, 05 Mar 2023 23:04:56 -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=@gmail.com header.s=20210112 header.b="hwfI/PoR"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbjCFGs5 (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Mon, 6 Mar 2023 01:48:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjCFGs4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 6 Mar 2023 01:48:56 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37C1F83E1; Sun, 5 Mar 2023 22:48:55 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id h31so4877006pgl.6; Sun, 05 Mar 2023 22:48:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678085335; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=eFHn5FfCLzXc2Zphnr99D4T7djusYGDgP5E+TmE5X9w=; b=hwfI/PoR3OCowF0hC6XGu7u3UjF3R0yxH+qvnJG/8wl1/Ea0AMk+bRwOM/wPuul/Py md27lKglZeoDlu9N5BwmftfOXWWIHw4NlwFOpU5K41k6TMgQSEaBHvnUTUQlHyWhDc2L yPt+gEDVtdp8ErkN3ZFeYYu1KgR+ouSSUpIx3LzW9BrokXlS1RUkulzIrF9LlhDwl/yE W4hr/eulkOxu52agwEyeAtVP7G6BFHKSN9+muKV9kyq2FTIJ1C95L8wJhvZmIqei+r3q GArGFNqusMujLWvOFz52CCjyeUqqQHpP+m6eh9gIMIeund5PqD2ubCER5WF0icFw/xQX uo2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678085335; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eFHn5FfCLzXc2Zphnr99D4T7djusYGDgP5E+TmE5X9w=; b=Ky/qihhwTG9pUUNtdfDCf4LQdoQ+sHT/TbIFmjc1+iZlxMUc2hOU/ljOnnvVudBhp6 /vdZTLYBP+IhErtv59rJeaf1aHNF3O7FrbDrf2HfnHj3O3eN4VjJZuQeLuaefM8xAdXV pp4UsHpgTnNuDwfotYf7ZNGquTI+dmtspXLDvUQ1sxJ8iKW5YrbFI4M7SjfunHESXsBw 1omwCvKDg+XbgnGVeb86GKpbz2+wwAYCW0AhT37AmiYj8UusIOGEkxMK7Qg/b8nmVtAj reXgj2u/3meCyjNQLuCw9d/bKDwGBGrNfasN2nU9ZPUeD6vEApX/V+MPVVaC1waxq+fl AbtQ== X-Gm-Message-State: AO0yUKU7p8nAo0ATh9Es9iol5RlMGpcrIsnMmmK//wbzySqeX38HfvR+ L9htqnFCYEpJ9WfYR5ppPS4= X-Received: by 2002:a62:4e43:0:b0:5a8:b649:99d4 with SMTP id c64-20020a624e43000000b005a8b64999d4mr9030345pfb.7.1678085334641; Sun, 05 Mar 2023 22:48:54 -0800 (PST) Received: from localhost.localdomain ([203.205.141.82]) by smtp.gmail.com with ESMTPSA id g9-20020aa78189000000b0061a942c8b62sm2378184pfi.43.2023.03.05.22.48.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Mar 2023 22:48:54 -0800 (PST) From: menglong8.dong@gmail.com X-Google-Original-From: imagedong@tencent.com To: andrii.nakryiko@gmail.com, alan.maguire@oracle.com Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, benbjiang@tencent.com, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Menglong Dong <imagedong@tencent.com> Subject: [PATCH bpf-next v4 0/3] libbpf: allow users to set kprobe/uprobe attach mode Date: Mon, 6 Mar 2023 14:48:30 +0800 Message-Id: <20230306064833.7932-1-imagedong@tencent.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759601016503387431?= X-GMAIL-MSGID: =?utf-8?q?1759601016503387431?= |
Series |
libbpf: allow users to set kprobe/uprobe attach mode
|
|
Message
Menglong Dong
March 6, 2023, 6:48 a.m. UTC
From: Menglong Dong <imagedong@tencent.com>
By default, libbpf will attach the kprobe/uprobe BPF program in the
latest mode that supported by kernel. In this series, we add the support
to let users manually attach kprobe/uprobe in legacy/perf/link mode in
the 1th patch.
And in the 2th patch, we split the testing 'attach_probe' into multi
subtests, as Andrii suggested.
In the 3th patch, we add the testings for loading kprobe/uprobe in
different mode.
Changes since v3:
- rename eBPF to BPF in the doc
- use OPTS_GET() to get the value of 'force_ioctl_attach'
- error out on attach mode is not supported
- use test_attach_probe_manual__open_and_load() directly
Changes since v2:
- fix the typo in the 2th patch
Changes since v1:
- some small changes in the 1th patch, as Andrii suggested
- split 'attach_probe' into multi subtests
Menglong Dong (3):
libbpf: add support to set kprobe/uprobe attach mode
selftests/bpf: split test_attach_probe into multi subtests
selftests/bpf: add test for legacy/perf kprobe/uprobe attach mode
tools/lib/bpf/libbpf.c | 47 ++-
tools/lib/bpf/libbpf.h | 31 +-
.../selftests/bpf/prog_tests/attach_probe.c | 291 ++++++++++++------
.../bpf/progs/test_attach_kprobe_sleepable.c | 23 ++
.../selftests/bpf/progs/test_attach_probe.c | 35 +--
.../bpf/progs/test_attach_probe_manual.c | 53 ++++
6 files changed, 347 insertions(+), 133 deletions(-)
create mode 100644 tools/testing/selftests/bpf/progs/test_attach_kprobe_sleepable.c
create mode 100644 tools/testing/selftests/bpf/progs/test_attach_probe_manual.c
Comments
Hello: This series was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <andrii@kernel.org>: On Mon, 6 Mar 2023 14:48:30 +0800 you wrote: > From: Menglong Dong <imagedong@tencent.com> > > By default, libbpf will attach the kprobe/uprobe BPF program in the > latest mode that supported by kernel. In this series, we add the support > to let users manually attach kprobe/uprobe in legacy/perf/link mode in > the 1th patch. > > [...] Here is the summary with links: - [bpf-next,v4,1/3] libbpf: add support to set kprobe/uprobe attach mode (no matching commit) - [bpf-next,v4,2/3] selftests/bpf: split test_attach_probe into multi subtests https://git.kernel.org/bpf/bpf-next/c/7391ec6391e2 - [bpf-next,v4,3/3] selftests/bpf: add test for legacy/perf kprobe/uprobe attach mode https://git.kernel.org/bpf/bpf-next/c/c7aec81b31e4 You are awesome, thank you!