diff options
| author | Eduard Zingerman <eddyz87@gmail.com> | 2022-11-16 00:48:58 +0200 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2022-11-15 17:38:36 -0800 |
| commit | befae75856ab406a3f3fab2aa2118cf3b2dfe3e6 (patch) | |
| tree | df373b27a681958e041929cd5a91b7f679616905 /lib/mpi/mpi-sub-ui.c | |
| parent | 32637e33003f36e75e9147788cc0e2f21706ef99 (diff) | |
bpf: propagate nullness information for reg to reg comparisons
Propagate nullness information for branches of register to register
equality compare instructions. The following rules are used:
- suppose register A maybe null
- suppose register B is not null
- for JNE A, B, ... - A is not null in the false branch
- for JEQ A, B, ... - A is not null in the true branch
E.g. for program like below:
r6 = skb->sk;
r7 = sk_fullsock(r6);
r0 = sk_fullsock(r6);
if (r0 == 0) return 0; (a)
if (r0 != r7) return 0; (b)
*r7->type; (c)
return 0;
It is safe to dereference r7 at point (c), because of (a) and (b).
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/20221115224859.2452988-2-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'lib/mpi/mpi-sub-ui.c')
0 files changed, 0 insertions, 0 deletions
