Skip to content

Commit

Permalink
bpf: export crash_kexec() as destructive kfunc
Browse files Browse the repository at this point in the history
Allow properly marked bpf programs to call crash_kexec().

Signed-off-by: Artem Savkov <asavkov@redhat.com>
Link: https://lore.kernel.org/r/20220810065905.475418-3-asavkov@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
  • Loading branch information
Artem Savkov authored and Alexei Starovoitov committed Aug 10, 2022
1 parent 4dd48c6 commit 1337905
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions kernel/bpf/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1725,3 +1725,21 @@ 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)
{
return register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, &tracing_kfunc_set);
}

late_initcall(kfunc_init);

0 comments on commit 1337905

Please sign in to comment.