linux/tools/testing/selftests/bpf
Martin KaFai Lau 3fbfadce60 bpf: Fix test_lru_sanity5() in test_lru_map.c
test_lru_sanity5() fails when the number of online cpus
is fewer than the number of possible cpus.  It can be
reproduced with qemu by using cmd args "--smp cpus=2,maxcpus=8".

The problem is the loop in test_lru_sanity5() is testing
'i' which is incorrect.

This patch:
1. Make sched_next_online() always return -1 if it cannot
   find a next cpu to schedule the process.
2. In test_lru_sanity5(), the parent process does
   sched_setaffinity() first (through sched_next_online())
   and the forked process will inherit it according to
   the 'man sched_setaffinity'.

Fixes: 5db58faf98 ("bpf: Add tests for the LRU bpf_htab")
Reported-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-01-17 15:39:39 -05:00
..
.gitignore bpf: Preserve const register type on const OR alu ops 2016-12-05 13:40:05 -05:00
bpf_sys.h bpf: add initial suite for selftests 2016-10-18 11:35:55 -04:00
bpf_util.h bpf: fix multiple issues in selftest suite and samples 2016-11-27 20:38:47 -05:00
config bpf: add initial suite for selftests 2016-10-18 11:35:55 -04:00
Makefile bpf: Add tests for the LRU bpf_htab 2016-11-15 11:50:43 -05:00
test_kmod.sh selftests: do not require bash to run bpf tests 2017-01-05 13:19:47 -07:00
test_lru_map.c bpf: Fix test_lru_sanity5() in test_lru_map.c 2017-01-17 15:39:39 -05:00
test_maps.c bpf: fix multiple issues in selftest suite and samples 2016-11-27 20:38:47 -05:00
test_verifier.c bpf, test_verifier: fix a test case error result on unprivileged 2016-12-17 10:51:31 -05:00