linux-stable/kernel/bpf
Daniel Borkmann 7bd509e311 bpf: add prog_digest and expose it via fdinfo/netlink
When loading a BPF program via bpf(2), calculate the digest over
the program's instruction stream and store it in struct bpf_prog's
digest member. This is done at a point in time before any instructions
are rewritten by the verifier. Any unstable map file descriptor
number part of the imm field will be zeroed for the hash.

fdinfo example output for progs:

  # cat /proc/1590/fdinfo/5
  pos:          0
  flags:        02000002
  mnt_id:       11
  prog_type:    1
  prog_jited:   1
  prog_digest:  b27e8b06da22707513aa97363dfb11c7c3675d28
  memlock:      4096

When programs are pinned and retrieved by an ELF loader, the loader
can check the program's digest through fdinfo and compare it against
one that was generated over the ELF file's program section to see
if the program needs to be reloaded. Furthermore, this can also be
exposed through other means such as netlink in case of a tc cls/act
dump (or xdp in future), but also through tracepoints or other
facilities to identify the program. Other than that, the digest can
also serve as a base name for the work in progress kallsyms support
of programs. The digest doesn't depend/select the crypto layer, since
we need to keep dependencies to a minimum. iproute2 will get support
for this facility.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-05 15:33:11 -05:00
..
arraymap.c bpf: Add bpf_current_task_under_cgroup helper 2016-08-12 21:49:41 -07:00
bpf_lru_list.c bpf: Fix compilation warning in __bpf_lru_list_rotate_inactive 2016-11-16 11:30:56 -05:00
bpf_lru_list.h bpf: Add percpu LRU list 2016-11-15 11:50:20 -05:00
cgroup.c bpf: Add new cgroup attach type to enable sock modifications 2016-12-02 13:46:08 -05:00
core.c bpf: add prog_digest and expose it via fdinfo/netlink 2016-12-05 15:33:11 -05:00
hashtab.c bpf: Add BPF_MAP_TYPE_LRU_PERCPU_HASH 2016-11-15 11:50:20 -05:00
helpers.c bpf: add helper for retrieving current numa node id 2016-10-22 17:05:52 -04:00
inode.c bpf: allow for mount options to specify permissions 2016-11-27 20:38:47 -05:00
Makefile cgroup: add support for eBPF programs 2016-11-25 16:25:52 -05:00
percpu_freelist.c bpf: introduce percpu_freelist 2016-03-08 15:28:31 -05:00
percpu_freelist.h bpf: introduce percpu_freelist 2016-03-08 15:28:31 -05:00
stackmap.c bpf: add BPF_CALL_x macros for declaring helpers 2016-09-09 19:36:04 -07:00
syscall.c bpf: add prog_digest and expose it via fdinfo/netlink 2016-12-05 15:33:11 -05:00
verifier.c bpf: add prog_digest and expose it via fdinfo/netlink 2016-12-05 15:33:11 -05:00