bpf: fix incorrect sign extension in check_alu_op()
BPF_ALU64|BPF_MOV|BPF_K (load 32-bit immediate, sign-extended to 64-bit)
and BPF_ALU|BPF_MOV|BPF_K (load 32-bit immediate, zero-padded to 64-bit);
only perform sign extension in the first case.
Starting with v4.14, this is exploitable by unprivileged users as long as
the unprivileged_bpf_disabled sysctl isn't set.
Debian assigned CVE-2017-16995 for this issue.
- add CVE number (Ben Hutchings)
Fixes: 484611357c19 ("bpf: allow access into map value arrays")
Signed-off-by: Jann Horn <email@example.com>
Acked-by: Edward Cree <firstname.lastname@example.org>
Signed-off-by: Alexei Starovoitov <email@example.com>
Signed-off-by: Daniel Borkmann <firstname.lastname@example.org>