linux-stable/include
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
..
acpi Merge branches 'acpica-fixes', 'acpi-cppc-fixes' and 'acpi-tools-fixes' 2016-11-18 21:34:42 +01:00
asm-generic default exported asm symbols to zero 2016-12-02 08:51:22 -08:00
clocksource
crypto
drm drm: Don't force all planes to be added to the state due to zpos 2016-10-26 18:48:05 +02:00
dt-bindings dt-bindings: net: add EEE capability constants 2016-11-29 19:38:31 -05:00
keys
kvm
linux bpf: add prog_digest and expose it via fdinfo/netlink 2016-12-05 15:33:11 -05:00
math-emu
media
memory
misc
net net_sched: gen_estimator: complete rewrite of rate estimators 2016-12-05 15:21:59 -05:00
pcmcia
ras
rdma
rxrpc
scsi
soc
sound
target target: Make EXTENDED_COPY 0xe4 failure return COPY TARGET DEVICE NOT REACHABLE 2016-10-19 21:22:32 -07:00
trace net/phy: add trace events for mdio accesses 2016-11-24 11:55:43 -05:00
uapi bpf: add prog_digest and expose it via fdinfo/netlink 2016-12-05 15:33:11 -05:00
video
xen
Kbuild