Re: [PATCH bpf-next 2/2] selftests/bpf: check nullness propagation for reg to reg comparisons

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/15/22 12:31 PM, Eduard Zingerman wrote:
On Mon, 2022-11-14 at 10:01 -0800, Alexei Starovoitov wrote:
On Fri, Aug 26, 2022 at 10:30 AM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote:

Verify that nullness information is porpagated in the branches of
register to register JEQ and JNE operations.

Signed-off-by: Eduard Zingerman <eddyz87@xxxxxxxxx>
Acked-by: Yonghong Song <yhs@xxxxxx>
---
  .../bpf/verifier/jeq_infer_not_null.c         | 166 ++++++++++++++++++
  1 file changed, 166 insertions(+)
  create mode 100644 tools/testing/selftests/bpf/verifier/jeq_infer_not_null.c

These 4 new tests are failing in unpriv.

This is interesting. 'test_verifier' passed for me because of
kernel.unprivileged_bpf_disabled = 1 on my test VM.
But It also passed on CI ([1]) with the following log:

2022-11-06T21:15:53.2873411Z #686/u jne/jeq infer not null, PTR_TO_SOCKET_OR_NULL -> PTR_TO_SOCKET for JNE false branch SKIP
2022-11-06T21:15:53.2908232Z #686/p jne/jeq infer not null, PTR_TO_SOCKET_OR_NULL -> PTR_TO_SOCKET for JNE false branch OK

To skip or not to skip is decided by test_verifier.c:do_test:

		if (test_as_unpriv(test) && unpriv_disabled) {
			printf("#%d/u %s SKIP\n", i, test->descr);
			skips++;
		}

The 'test_as_unpriv(test)' is true for my tests because of the
.prog_type == BPF_PROG_TYPE_CGROUP_SKB.
'unpriv_disabled' is a global set by test_verifier.c:get_unpriv_disabled:

static void get_unpriv_disabled()
{
	char buf[2];
	FILE *fd;

	fd = fopen("/proc/sys/"UNPRIV_SYSCTL, "r");
         // ...
	if (fgets(buf, 2, fd) == buf && atoi(buf))
		unpriv_disabled = true;
	fclose(fd);
}

Might it be the case that CI configuration needs an update as below:
sysctl kernel.unprivileged_bpf_disabled=0
?

Yeah. Makes sense to enable unpriv in CI, since it's missing tests
in the current form.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux