selftests/bpf: fix unpriv_disabled check in test_verifier
Subsystems (5)
PATCH 1/1 selftests/bpf: fix unpriv_disabled check in test_verifier
Commit 1d56ade032a49 changed the function get_unpriv_disabled() to return its results as a bool instead of updating a global variable, but test_verifier was not updated to keep in line with these changes. Thus unpriv_disabled is always false in test_verifier and unprivileged tests are not properly skipped on systems with unprivileged bpf disabled.
--- tools/testing/selftests/bpf/test_verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/test_verifier.c +1 -1
@@ -1880,7 +1880,7 @@ int main(int argc, char **argv) } } -get_unpriv_disabled (); + unpriv_disabled =get_unpriv_disabled ();if (unpriv && unpriv_disabled) {printf ("Cannot run as unprivileged user with sysctl %s.\n" ,UNPRIV_SYSCTL );
Signature · 1 line
2.41.0
Quoted 8 lines · Artem Savkov
Commit
1d56ade032a49changed the functionget_unpriv_disabled()to return its results as a bool instead of updating a global variable, buttest_verifierwas not updated to keep in line with these changes. Thusunpriv_disabledis always false intest_verifierand unprivileged tests are not properly skipped on systems with unprivileged bpf disabled.Fixes 1d56ade032a49 ("selftests/bpf: Unprivileged tests for test_loader.c")Signed-off-by Artem Savkov <[email protected]>
Yep, my bad, without this patch test_verifier fails when /proc/sys/kernel/unprivileged_bpf_disabled is set to 1. Thank you for fixing it.
Quoted 17 lines
--- tools/testing/selftests/bpf/test_verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/bpf/test_verifier.c +1
-1@@ -1880,7 +1880,7 @@ int main(int argc, char **argv) } } -get_unpriv_disabled (); + unpriv_disabled =get_unpriv_disabled ();if (unpriv && unpriv_disabled) {printf ("Cannot run as unprivileged user with sysctl %s.\n" ,UNPRIV_SYSCTL );
This patch was applied to bpf/bpf.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <[email protected]>:
Quoted 10 lines · On Tue, 12 Sep 2023 14:06:31 +0200 you wrote:
Commit
1d56ade032a49changed the functionget_unpriv_disabled()to return its results as a bool instead of updating a global variable, buttest_verifierwas not updated to keep in line with these changes. Thusunpriv_disabledis always false intest_verifierand unprivileged tests are not properly skipped on systems with unprivileged bpf disabled.Fixes 1d56ade032a49 ("selftests/bpf: Unprivileged tests for test_loader.c")Signed-off-by Artem Savkov <[email protected]>[...]
Here is the summary with links:
- [bpf] selftests/bpf: fix unpriv_disabled check in test_verifier
https://git.kernel.org/bpf/bpf/c/d128860dbb29
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html