]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
bpf: No need to simulate speculative domain for immediates
authorDaniel Borkmann <daniel@iogearbox.net>
Thu, 27 May 2021 21:36:00 +0000 (23:36 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Fri, 28 May 2021 14:30:29 +0000 (16:30 +0200)
commit7d4f535ad06af2062636fca239eeca488d3a075a
treeb4c73197a1302d78dc99deff4ef10f33bcdf58ed
parent9e86367ba51c537d4100bdab42da085a9a5bd301
bpf: No need to simulate speculative domain for immediates

In 801c6058d14a ("bpf: Fix leakage of uninitialized bpf stack under
speculation") we replaced masking logic with direct loads of immediates
if the register is a known constant. Given in this case we do not apply
any masking, there is also no reason for the operation to be truncated
under the speculative domain.

Therefore, there is also zero reason for the verifier to branch-off and
simulate this case, it only needs to do it for unknown but bounded scalars.
As a side-effect, this also enables few test cases that were previously
rejected due to simulation under zero truncation.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Piotr Krysiuk <piotras@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
(cherry picked from commit a7036191277f9fa68d92f2071ddc38c09b1e5ee5)
CVE-2021-33200
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Ian May <ian.may@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
kernel/bpf/verifier.c