aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/bpf_trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/bpf_trace.c')
-rw-r--r--kernel/trace/bpf_trace.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 91800be0c8eb..8607aba1d882 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -915,6 +915,27 @@ const struct bpf_verifier_ops raw_tracepoint_verifier_ops = {
915const struct bpf_prog_ops raw_tracepoint_prog_ops = { 915const struct bpf_prog_ops raw_tracepoint_prog_ops = {
916}; 916};
917 917
918static bool raw_tp_writable_prog_is_valid_access(int off, int size,
919 enum bpf_access_type type,
920 const struct bpf_prog *prog,
921 struct bpf_insn_access_aux *info)
922{
923 if (off == 0) {
924 if (size != sizeof(u64) || type != BPF_READ)
925 return false;
926 info->reg_type = PTR_TO_TP_BUFFER;
927 }
928 return raw_tp_prog_is_valid_access(off, size, type, prog, info);
929}
930
931const struct bpf_verifier_ops raw_tracepoint_writable_verifier_ops = {
932 .get_func_proto = raw_tp_prog_func_proto,
933 .is_valid_access = raw_tp_writable_prog_is_valid_access,
934};
935
936const struct bpf_prog_ops raw_tracepoint_writable_prog_ops = {
937};
938
918static bool pe_prog_is_valid_access(int off, int size, enum bpf_access_type type, 939static bool pe_prog_is_valid_access(int off, int size, enum bpf_access_type type,
919 const struct bpf_prog *prog, 940 const struct bpf_prog *prog,
920 struct bpf_insn_access_aux *info) 941 struct bpf_insn_access_aux *info)
@@ -1204,6 +1225,9 @@ static int __bpf_probe_register(struct bpf_raw_event_map *btp, struct bpf_prog *
1204 if (prog->aux->max_ctx_offset > btp->num_args * sizeof(u64)) 1225 if (prog->aux->max_ctx_offset > btp->num_args * sizeof(u64))
1205 return -EINVAL; 1226 return -EINVAL;
1206 1227
1228 if (prog->aux->max_tp_access > btp->writable_size)
1229 return -EINVAL;
1230
1207 return tracepoint_probe_register(tp, (void *)btp->bpf_func, prog); 1231 return tracepoint_probe_register(tp, (void *)btp->bpf_func, prog);
1208} 1232}
1209 1233