]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Don't promote bogus looking registers after null check.
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 5 Jan 2022 19:35:13 +0000 (11:35 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 5 Jan 2022 20:00:19 +0000 (12:00 -0800)
commita58e82de9461478ff3ba2f87f52d8f24055c6f40
treeb5f8436c56edd7b551079b06936efb2de2b27f96
parentcfbfa990aaaafc86e9b542f09d091e999f26582a
bpf: Don't promote bogus looking registers after null check.

If we ever get to a point again where we convert a bogus looking <ptr>_or_null
typed register containing a non-zero fixed or variable offset, then lets not
reset these bounds to zero since they are not and also don't promote the register
to a <ptr> type, but instead leave it as <ptr>_or_null. Converting to a unknown
register could be an avenue as well, but then if we run into this case it would
allow to leak a kernel pointer this way.

Fixes: 8e11845d64e4 ("bpf/verifier: rework value tracking")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c