diff options
author | Dave Airlie <airlied@redhat.com> | 2017-05-30 15:54:15 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2017-05-30 15:54:15 +1000 |
commit | 2a1720376adda5ecf8e636fbfb05339c7dad1c55 (patch) | |
tree | cdb76abac82306516aa556d9e9ddb15571f07517 /tools/lib/bpf/bpf.c | |
parent | a82256bc026722800d1fdeca5521f1ba487bc2ef (diff) | |
parent | 5ed02dbb497422bf225783f46e6eadd237d23d6b (diff) | |
download | blackbird-obmc-linux-2a1720376adda5ecf8e636fbfb05339c7dad1c55.tar.gz blackbird-obmc-linux-2a1720376adda5ecf8e636fbfb05339c7dad1c55.zip |
Backmerge tag 'v4.12-rc3' into drm-next
Linux 4.12-rc3
Daniel has requested this for some drm-intel-next work.
Diffstat (limited to 'tools/lib/bpf/bpf.c')
-rw-r--r-- | tools/lib/bpf/bpf.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index 4fe444b8092e..6e178987af8e 100644 --- a/tools/lib/bpf/bpf.c +++ b/tools/lib/bpf/bpf.c @@ -117,6 +117,28 @@ int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns, return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); } +int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns, + size_t insns_cnt, int strict_alignment, + const char *license, __u32 kern_version, + char *log_buf, size_t log_buf_sz) +{ + union bpf_attr attr; + + bzero(&attr, sizeof(attr)); + attr.prog_type = type; + attr.insn_cnt = (__u32)insns_cnt; + attr.insns = ptr_to_u64(insns); + attr.license = ptr_to_u64(license); + attr.log_buf = ptr_to_u64(log_buf); + attr.log_size = log_buf_sz; + attr.log_level = 2; + log_buf[0] = 0; + attr.kern_version = kern_version; + attr.prog_flags = strict_alignment ? BPF_F_STRICT_ALIGNMENT : 0; + + return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); +} + int bpf_map_update_elem(int fd, const void *key, const void *value, __u64 flags) { |