1
0
Fork 0
alistair23-linux/kernel/bpf
Daniel Borkmann aafe6ae9ce bpf: dynamically allocate digest scratch buffer
Geert rightfully complained that 7bd509e311 ("bpf: add prog_digest
and expose it via fdinfo/netlink") added a too large allocation of
variable 'raw' from bss section, and should instead be done dynamically:

  # ./scripts/bloat-o-meter kernel/bpf/core.o.1 kernel/bpf/core.o.2
  add/remove: 3/0 grow/shrink: 0/0 up/down: 33291/0 (33291)
  function                                     old     new   delta
  raw                                            -   32832  +32832
  [...]

Since this is only relevant during program creation path, which can be
considered slow-path anyway, lets allocate that dynamically and be not
implicitly dependent on verifier mutex. Move bpf_prog_calc_digest() at
the beginning of replace_map_fd_with_map_ptr() and also error handling
stays straight forward.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
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-17 21:27:44 -05:00
..
Makefile cgroup: add support for eBPF programs 2016-11-25 16:25:52 -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: dynamically allocate digest scratch buffer 2016-12-17 21:27:44 -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
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: dynamically allocate digest scratch buffer 2016-12-17 21:27:44 -05:00
verifier.c bpf: dynamically allocate digest scratch buffer 2016-12-17 21:27:44 -05:00