*** DO NOT MERGE! ***
This is a temporarily workaround, which will be fixed/replaced
in the next version.
--
Bpf oom handler hook has to:
1) have a trusted pointer to the oom_control structure,
2) return a value,
3) be sleepable to use cgroup iterator functions.
fmodret tracing programs fulfill 2) and 3).
This patch enables 1), however this change contradicts
the commit c6b0337f0120 ("bpf: Don't mark arguments to fentry/fexit
programs as trusted.").
Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
---
kernel/bpf/btf.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index a91822bae043..aa86c4eabfa0 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -6424,7 +6424,14 @@ static bool prog_args_trusted(const struct bpf_prog *prog)
switch (prog->type) {
case BPF_PROG_TYPE_TRACING:
- return atype == BPF_TRACE_RAW_TP || atype == BPF_TRACE_ITER;
+ switch (atype) {
+ case BPF_TRACE_RAW_TP:
+ case BPF_TRACE_ITER:
+ case BPF_MODIFY_RETURN:
+ return true;
+ default:
+ return false;
+ }
case BPF_PROG_TYPE_LSM:
return bpf_lsm_is_trusted(prog);
case BPF_PROG_TYPE_STRUCT_OPS:
--
2.49.0.901.g37484f566f-goog