public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Artem Savkov <asavkov@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>,
	 Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	bpf@vger.kernel.org,  netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf] selftests/bpf: fix unpriv_disabled check in test_verifier
Date: Tue, 12 Sep 2023 15:31:58 +0300	[thread overview]
Message-ID: <3f91e97d95e2d8cf667071d18b4552fe13fd2b95.camel@gmail.com> (raw)
In-Reply-To: <20230912120631.213139-1-asavkov@redhat.com>

On Tue, 2023-09-12 at 14:06 +0200, Artem Savkov wrote:
> 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.
> 
> Fixes: 1d56ade032a49 ("selftests/bpf: Unprivileged tests for test_loader.c")
> Signed-off-by: Artem Savkov <asavkov@redhat.com>

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.
Acked-by: Eduard Zingerman <eddyz87@gmail.com>

> ---
>  tools/testing/selftests/bpf/test_verifier.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
> index 31f1c935cd07d..98107e0452d33 100644
> --- a/tools/testing/selftests/bpf/test_verifier.c
> +++ b/tools/testing/selftests/bpf/test_verifier.c
> @@ -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);


  reply	other threads:[~2023-09-12 12:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 12:06 [PATCH bpf] selftests/bpf: fix unpriv_disabled check in test_verifier Artem Savkov
2023-09-12 12:31 ` Eduard Zingerman [this message]
2023-09-12 20:20 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3f91e97d95e2d8cf667071d18b4552fe13fd2b95.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=asavkov@redhat.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox