Skip to contentSkip to conversation

selftests/bpf: don't exit on failed bpf_testmod unload

PATCH Applied Andrii Nakryiko 2 participants 2 messages Jan 26, 2021

Subsystems (5)
lore
Share & tools
lore

Andrii Nakryiko

author maintainer
#0 lore raw

PATCH 1/1 selftests/bpf: don't exit on failed bpf_testmod unload

Fix bug in handling bpf_testmod unloading that will cause test_progs exiting prematurely if bpf_testmod unloading failed. This is especially problematic when running a subset of test_progs that doesn't require root permissions and doesn't rely on bpf_testmod, yet will fail immediately due to exit(1) in unload_bpf_testmod().

Fixes 9f7fa225894c ("selftests/bpf: Add bpf_testmod kernel module for testing")
---
 tools/testing/selftests/bpf/test_progs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/test_progs.c +1 -1
index 213628ee721c..6396932b97e2 100644
@@ -390,7 +390,7 @@ static void unload_bpf_testmod(void)
 			return;
 		}
 		fprintf(env.stderr, "Failed to unload bpf_testmod.ko from kernel: %d\n", -errno);
-		exit(1);
+		return;
 	}
 	if (env.verbosity > VERBOSE_NONE)
 		fprintf(stdout, "Successfully unloaded bpf_testmod.ko.\n");
Signature · 1 line
2.24.1
#1 lore raw
This patch was applied to bpf/bpf-next.git (refs/heads/master):

Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

Quoted 10 lines · On Mon, 25 Jan 2021 22:50:18 -0800 you wrote:

Fix bug in handling bpf_testmod unloading that will cause test_progs exiting prematurely if bpf_testmod unloading failed. This is especially problematic when running a subset of test_progs that doesn't require root permissions and doesn't rely on bpf_testmod, yet will fail immediately due to exit(1) in unload_bpf_testmod().

Fixes 9f7fa225894c ("selftests/bpf: Add bpf_testmod kernel module for testing")

[...]

Here is the summary with links:
- [bpf-next] selftests/bpf: don't exit on failed bpf_testmod unload

    https://git.kernel.org/bpf/bpf-next/c/86ce322d21eb

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html