[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220808094623.387348-3-asavkov@redhat.com>
Date: Mon, 8 Aug 2022 11:46:22 +0200
From: Artem Savkov <asavkov@...hat.com>
To: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org,
netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Andrea Arcangeli <aarcange@...hat.com>,
Daniel Vacek <dvacek@...hat.com>,
Jiri Olsa <olsajiri@...il.com>, Song Liu <song@...nel.org>,
Daniel Xu <dxu@...uu.xyz>, Artem Savkov <asavkov@...hat.com>
Subject: [PATCH bpf-next v3 2/3] bpf: export crash_kexec() as destructive kfunc
Allow properly marked bpf programs to call crash_kexec().
Signed-off-by: Artem Savkov <asavkov@...hat.com>
---
kernel/bpf/helpers.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 1f961f9982d2..103dbddff41f 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -1711,3 +1711,24 @@ bpf_base_func_proto(enum bpf_func_id func_id)
return NULL;
}
}
+
+BTF_SET8_START(tracing_btf_ids)
+#ifdef CONFIG_KEXEC_CORE
+BTF_ID_FLAGS(func, crash_kexec, KF_DESTRUCTIVE)
+#endif
+BTF_SET8_END(tracing_btf_ids)
+
+static const struct btf_kfunc_id_set tracing_kfunc_set = {
+ .owner = THIS_MODULE,
+ .set = &tracing_btf_ids,
+};
+
+static int __init kfunc_init(void)
+{
+ if (register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, &tracing_kfunc_set))
+ pr_warn("failed to register kfunc id set for BPF_PROG_TYPE_TRACING\n");
+
+ return 0;
+}
+
+late_initcall(kfunc_init);
--
2.37.1
Powered by blists - more mailing lists