bpf: allow bpf_get_prandom_u32() to be used in tracing
authorAlexei Starovoitov <ast@fb.com>
Fri, 12 Aug 2016 01:17:18 +0000 (18:17 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Aug 2016 04:57:05 +0000 (21:57 -0700)
bpf_get_prandom_u32() was initially introduced for socket filters
and later requested numberous times to be added to tracing bpf programs
for the same reason as in socket filters: to be able to randomly
select incoming events.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/trace/bpf_trace.c

index 6b794d6669a7d0016472d8970020f23842bcbd56..ad35213b840512ad962d3e710d95cb2cb1330788 100644 (file)
@@ -437,6 +437,8 @@ static const struct bpf_func_proto *tracing_func_proto(enum bpf_func_id func_id)
                return bpf_get_probe_write_proto();
        case BPF_FUNC_current_task_under_cgroup:
                return &bpf_current_task_under_cgroup_proto;
+       case BPF_FUNC_get_prandom_u32:
+               return &bpf_get_prandom_u32_proto;
        default:
                return NULL;
        }