]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Cap retries in sys_bpf_prog_load
authorStanislav Fomichev <sdf@google.com>
Wed, 2 Dec 2020 23:13:32 +0000 (15:13 -0800)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 3 Dec 2020 20:01:18 +0000 (12:01 -0800)
commitc8eea8dcb87b5abe620d8b7b9db36e1eb466b334
treeed992bd637cd557b9fa76b204ef4a9ac01a6e7b6
parent1abc378b0212f83c8cc4ce5071c11d34cbfe64b8
libbpf: Cap retries in sys_bpf_prog_load

I've seen a situation, where a process that's under pprof constantly
generates SIGPROF which prevents program loading indefinitely.
The right thing to do probably is to disable signals in the upper
layers while loading, but it still would be nice to get some error from
libbpf instead of an endless loop.

Let's add some small retry limit to the program loading:
try loading the program 5 (arbitrary) times and give up.

v2:
* 10 -> 5 retires (Andrii Nakryiko)

Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20201202231332.3923644-1-sdf@google.com
tools/lib/bpf/bpf.c