|
@@ -147,6 +147,17 @@ static const struct bpf_func_proto bpf_trace_printk_proto = {
|
|
|
.arg2_type = ARG_CONST_STACK_SIZE,
|
|
|
};
|
|
|
|
|
|
+const struct bpf_func_proto *bpf_get_trace_printk_proto(void)
|
|
|
+{
|
|
|
+ /*
|
|
|
+ * this program might be calling bpf_trace_printk,
|
|
|
+ * so allocate per-cpu printk buffers
|
|
|
+ */
|
|
|
+ trace_printk_init_buffers();
|
|
|
+
|
|
|
+ return &bpf_trace_printk_proto;
|
|
|
+}
|
|
|
+
|
|
|
static const struct bpf_func_proto *kprobe_prog_func_proto(enum bpf_func_id func_id)
|
|
|
{
|
|
|
switch (func_id) {
|
|
@@ -168,15 +179,8 @@ static const struct bpf_func_proto *kprobe_prog_func_proto(enum bpf_func_id func
|
|
|
return &bpf_get_current_uid_gid_proto;
|
|
|
case BPF_FUNC_get_current_comm:
|
|
|
return &bpf_get_current_comm_proto;
|
|
|
-
|
|
|
case BPF_FUNC_trace_printk:
|
|
|
- /*
|
|
|
- * this program might be calling bpf_trace_printk,
|
|
|
- * so allocate per-cpu printk buffers
|
|
|
- */
|
|
|
- trace_printk_init_buffers();
|
|
|
-
|
|
|
- return &bpf_trace_printk_proto;
|
|
|
+ return bpf_get_trace_printk_proto();
|
|
|
default:
|
|
|
return NULL;
|
|
|
}
|