From: Song Liu <song@kernel.org>
To: <bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<live-patching@vger.kernel.org>
Cc: <daniel@iogearbox.net>, <kernel-team@fb.com>, <jolsa@kernel.org>,
<rostedt@goodmis.org>, Song Liu <song@kernel.org>
Subject: [PATCH v5 bpf-next 0/4] ftrace: host klp and bpf trampoline together
Date: Tue, 19 Jul 2022 17:21:22 -0700 [thread overview]
Message-ID: <20220720002126.803253-1-song@kernel.org> (raw)
Changes v4 => v5:
1. Cleanup direct_mutex handling in register_ftrace_function.
(Steven Rostedt, Petr Mladek).
2. Various smallish fixes. (Steven Rostedt, Petr Mladek).
Changes v3 => v4:
1. Fix build errors for different config. (kernel test robot)
Changes v2 => v3:
1. Major rewrite after discussions with Steven Rostedt. [1]
2. Remove SHARE_IPMODIFY flag from ftrace code. Instead use the callback
function to communicate this information. (Steven)
3. Add cleanup_direct_functions_after_ipmodify() to clear SHARE_IPMODIFY
on the DIRECT ops when the IPMODIFY ops is removed.
Changes v1 => v2:
1. Fix build errors for different config. (kernel test robot)
Kernel Live Patch (livepatch, or klp) and bpf trampoline are important
features for modern systems. This set allows the two to work on the same
kernel function as the same time.
live patch uses ftrace with IPMODIFY, while bpf trampoline use direct
ftrace. Existing policy does not allow the two to attach to the same kernel
function. This is changed by fine tuning ftrace IPMODIFY policy, and allows
one IPMODIFY ftrace_ops and one DIRECT ftrace_ops on the same kernel
function at the same time. Please see patch 2 and 4 for more details.
Note that, one of the constraint here is to let bpf trampoline use direct
call when it is not working on the same function as live patch. This is
achieved by allowing ftrace code to ask bpf trampoline to make changes.
[1] https://lore.kernel.org/all/20220602193706.2607681-2-song@kernel.org/
Jiri Olsa (1):
bpf, x64: Allow to use caller address from stack
Song Liu (3):
ftrace: Add modify_ftrace_direct_multi_nolock
ftrace: Allow IPMODIFY and DIRECT ops on the same function
bpf: Support bpf_trampoline on functions with IPMODIFY (e.g.
livepatch)
arch/x86/net/bpf_jit_comp.c | 13 +-
include/linux/bpf.h | 13 ++
include/linux/ftrace.h | 43 +++++
kernel/bpf/trampoline.c | 158 +++++++++++++++--
kernel/trace/ftrace.c | 328 ++++++++++++++++++++++++++++++------
5 files changed, 484 insertions(+), 71 deletions(-)
--
2.30.2
next reply other threads:[~2022-07-20 0:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-20 0:21 Song Liu [this message]
2022-07-20 0:21 ` [PATCH v5 bpf-next 1/4] ftrace: Add modify_ftrace_direct_multi_nolock Song Liu
2022-07-20 0:21 ` [PATCH v5 bpf-next 2/4] ftrace: Allow IPMODIFY and DIRECT ops on the same function Song Liu
2022-09-09 11:58 ` Naveen N. Rao
2022-09-09 14:05 ` Song Liu
2022-09-09 18:13 ` Naveen N. Rao
2022-07-20 0:21 ` [PATCH v5 bpf-next 3/4] bpf, x64: Allow to use caller address from stack Song Liu
2022-07-20 0:21 ` [PATCH v5 bpf-next 4/4] bpf: Support bpf_trampoline on functions with IPMODIFY (e.g. livepatch) Song Liu
2022-07-22 7:31 ` Jiri Olsa
2022-07-22 15:58 ` Song Liu
2022-07-21 22:59 ` [PATCH v5 bpf-next 0/4] ftrace: host klp and bpf trampoline together Song Liu
2022-07-22 16:56 ` Steven Rostedt
2022-07-22 18:02 ` Song Liu
2022-07-22 20:10 ` 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=20220720002126.803253-1-song@kernel.org \
--to=song@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jolsa@kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=rostedt@goodmis.org \
/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).