From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>
Cc: <andrii@kernel.org>, <kernel-team@fb.com>,
Alan Maguire <alan.maguire@oracle.com>
Subject: [PATCH v5 bpf-next 0/3] libbpf: support custom SEC() handlers
Date: Fri, 4 Mar 2022 17:01:26 -0800 [thread overview]
Message-ID: <20220305010129.1549719-1-andrii@kernel.org> (raw)
Add ability for user applications and libraries to register custom BPF program
SEC() handlers. See patch #2 for examples where this is useful.
Patch #1 does some preliminary refactoring to allow exponsing program
init, preload, and attach callbacks as public API. It also establishes
a protocol to allow optional auto-attach behavior. This will also help the
case of sometimes auto-attachable uprobes.
v4->v5:
- API documentation improvements (Daniel);
v3->v4:
- init_fn -> prog_setup_fn, preload_fn -> prog_prepare_load_fn (Alexei);
v2->v3:
- moved callbacks and cookie into OPTS struct (Alan);
- added more test scenarios (Alan);
- address most of Alan's feedback, but kept API name;
v1->v2:
- resubmitting due to git send-email screw up.
Cc: Alan Maguire <alan.maguire@oracle.com>
Andrii Nakryiko (3):
libbpf: allow BPF program auto-attach handlers to bail out
libbpf: support custom SEC() handlers
selftests/bpf: add custom SEC() handling selftest
tools/lib/bpf/libbpf.c | 332 ++++++++++++------
tools/lib/bpf/libbpf.h | 109 ++++++
tools/lib/bpf/libbpf.map | 6 +
tools/lib/bpf/libbpf_version.h | 2 +-
.../bpf/prog_tests/custom_sec_handlers.c | 176 ++++++++++
.../bpf/progs/test_custom_sec_handlers.c | 63 ++++
6 files changed, 586 insertions(+), 102 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/custom_sec_handlers.c
create mode 100644 tools/testing/selftests/bpf/progs/test_custom_sec_handlers.c
--
2.30.2
next reply other threads:[~2022-03-05 1:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-05 1:01 Andrii Nakryiko [this message]
2022-03-05 1:01 ` [PATCH v5 bpf-next 1/3] libbpf: allow BPF program auto-attach handlers to bail out Andrii Nakryiko
2022-03-05 1:01 ` [PATCH v5 bpf-next 2/3] libbpf: support custom SEC() handlers Andrii Nakryiko
2022-03-05 1:01 ` [PATCH v5 bpf-next 3/3] selftests/bpf: add custom SEC() handling selftest Andrii Nakryiko
2022-03-05 17:50 ` [PATCH v5 bpf-next 0/3] libbpf: support custom SEC() handlers patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220305010129.1549719-1-andrii@kernel.org \
--to=andrii@kernel.org \
--cc=alan.maguire@oracle.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).