alistair23-linux/tools
Yonghong Song d6f1837107 selftests/bpf: fix segfault of test_progs when prog loading failed
The test_progs subtests, test_spin_lock() and test_map_lock(),
requires BTF present to run successfully.
Currently, when BTF failed to load, test_progs will segfault,
  $ ./test_progs
  ...
  12: (bf) r1 = r8
  13: (85) call bpf_spin_lock#93
  map 'hash_map' has to have BTF in order to use bpf_spin_lock

  libbpf: -- END LOG --
  libbpf: failed to load program 'map_lock_demo'
  libbpf: failed to load object './test_map_lock.o'
  test_map_lock:bpf_prog_load errno 13
  Segmentation fault

The segfault is caused by uninitialized variable "obj", which
is used in bpf_object__close(obj), when bpf prog failed to load.

Initializing variable "obj" to NULL in two occasions fixed the problem.
  $ ./test_progs
  ...
  Summary: 219 PASSED, 2 FAILED

Fixes: b4d4556c32 ("selftests/bpf: add bpf_spin_lock verifier tests")
Fixes: ba72a7b4ba ("selftests/bpf: test for BPF_F_LOCK")
Reported-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2019-03-12 21:55:54 +01:00
..
accounting delayacct: track delays from thrashing cache pages 2018-10-26 16:26:32 -07:00
arch powerpc fixes for 5.0 #3 2019-01-19 05:55:42 +12:00
bpf tools: libbpf: add a correctly named define for map iteration 2019-03-01 00:53:45 +01:00
build perf build: Don't unconditionally link the libbfd feature test to -liberty and -lz 2018-12-21 09:42:46 -03:00
cgroup
crypto crypto: user - rename err_cnt parameter 2018-12-07 14:15:00 +08:00
firewire
firmware tools: Add 'firmware' category and add ihex2fw tool 2018-11-11 12:58:27 -08:00
gpio tools gpio: Allow overriding CFLAGS 2018-12-28 16:33:08 -03:00
hv Tools: hv: kvp: Fix a warning of buffer overflow with gcc 8.0.1 2018-11-11 12:58:27 -08:00
iio tools: iio: iio_generic_buffer: make num_loops signed 2019-01-12 18:17:56 +00:00
include bpf: sync bpf.h to tools and update bpf_helpers.h 2019-03-02 10:48:27 -08:00
kvm/kvm_stat tools/kvm_stat: switch to python3 2018-11-27 12:53:44 +01:00
laptop
leds
lib libbpf: handle BTF parsing and loading properly 2019-03-11 10:14:12 +01:00
memory-model tools/memory-model: Add more LKMM limitations 2018-10-02 10:28:04 +02:00
nfsd
objtool objtool: Fix segfault in .cold detection with -ffunction-sections 2018-11-20 18:59:00 +01:00
pci tools: PCI: Change pcitest compiling process 2018-10-03 11:19:52 +01:00
pcmcia
perf tools: libbpf: add a correctly named define for map iteration 2019-03-01 00:53:45 +01:00
power perf/core improvements and fixes: 2019-01-03 14:05:16 +01:00
scripts
spi spi: spidev_test: Improve decoded text part of hex dump 2018-09-04 17:00:37 +01:00
testing selftests/bpf: fix segfault of test_progs when prog loading failed 2019-03-12 21:55:54 +01:00
thermal/tmon tools thermal tmon: Use -O3 instead of -O1 if available 2019-01-04 12:54:49 -03:00
time
usb usbip: tools: fix atoi() on non-null terminated string 2018-10-18 19:44:39 +02:00
virtio virtio: fix test build after uio.h change 2018-12-19 18:23:49 -05:00
vm tools/vm/page_owner: use page_owner_sort in the use example 2019-01-08 17:15:11 -08:00
wmi
Makefile tools: Add 'firmware' category and add ihex2fw tool 2018-11-11 12:58:27 -08:00