[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9dee19c7d39795242c15b2f7aa56fb4a6c3ebffa.camel@gmail.com>
Date: Thu, 14 Dec 2023 17:10:31 +0200
From: Eduard Zingerman <eddyz87@...il.com>
To: Hao Sun <sunhao.th@...il.com>
Cc: Andrii Nakryiko <andrii.nakryiko@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
bpf <bpf@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [Bug Report] bpf: incorrectly pruning runtime execution path
[...]
> The reason why retval checks fails is that the way you disable dead
> code removal pass is not complete. Disable opt_remove_dead_code()
> just prevent the instruction #30 from being removed, but also note
> opt_hard_wire_dead_code_branches(), which convert conditional jump
> into unconditional one, so #30 is still skipped.
>
> > Note that I tried this test with two functions:
> > - bpf_get_current_cgroup_id, with this function I get retval 2, not 4 :)
> > - bpf_get_prandom_u32, with this function I get a random retval each time.
> >
> > What is the expectation when 'bpf_get_current_cgroup_id' is used?
> > That it is some known (to us) number, but verifier treats it as unknown scalar?
> >
>
> Either one would work, but to make #30 always taken, r0 should be
> non-zero.
Oh, thank you, I made opt_hard_wire_dead_code_branches() a noop,
replaced r0 = 0x4 by r0 /= 0 and see "divide error: 0000 [#1] PREEMPT SMP NOPTI"
error in the kernel log on every second or third run of the test
(when using prandom).
Working to minimize the test case will share results a bit later.
Powered by blists - more mailing lists