Commit 2aa07b3
ftrace: bpf: Fix IPMODIFY + DIRECT in modify_ftrace_direct()
ftrace_hash_ipmodify_enable() checks IPMODIFY and DIRECT ftrace_ops on
the same kernel function. When needed, ftrace_hash_ipmodify_enable()
calls ops->ops_func() to prepare the direct ftrace (BPF trampoline) to
share the same function as the IPMODIFY ftrace (livepatch).
ftrace_hash_ipmodify_enable() is called in register_ftrace_direct() path,
but not called in modify_ftrace_direct() path. As a result, the following
operations will break livepatch:
1. Load livepatch to a kernel function;
2. Attach fentry program to the kernel function;
3. Attach fexit program to the kernel function.
After 3, the kernel function being used will not be the livepatched
version, but the original version.
Fix this by adding ftrace_hash_ipmodify_enable() to modify_ftrace_direct()
and adjust some logic around the call.
Signed-off-by: Song Liu <[email protected]>1 parent 8a03fbb commit 2aa07b3
2 files changed
+17
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
224 | 231 | | |
225 | 232 | | |
226 | 233 | | |
| |||
479 | 486 | | |
480 | 487 | | |
481 | 488 | | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | 489 | | |
488 | 490 | | |
489 | 491 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2020 | 2020 | | |
2021 | 2021 | | |
2022 | 2022 | | |
2023 | | - | |
2024 | | - | |
2025 | 2023 | | |
2026 | 2024 | | |
2027 | 2025 | | |
| |||
6128 | 6126 | | |
6129 | 6127 | | |
6130 | 6128 | | |
| 6129 | + | |
| 6130 | + | |
| 6131 | + | |
| 6132 | + | |
| 6133 | + | |
| 6134 | + | |
| 6135 | + | |
| 6136 | + | |
| 6137 | + | |
6131 | 6138 | | |
6132 | 6139 | | |
6133 | 6140 | | |
| |||
6149 | 6156 | | |
6150 | 6157 | | |
6151 | 6158 | | |
| 6159 | + | |
6152 | 6160 | | |
6153 | 6161 | | |
6154 | 6162 | | |
| |||
0 commit comments