]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
bpf: don't let ldimm64 leak map addresses on unprivileged
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 21 Jun 2017 14:13:32 +0000 (22:13 +0800)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Tue, 27 Jun 2017 13:22:50 +0000 (10:22 -0300)
commit0a96fac079093b17b4a4c2c50f6a24122c2a5f89
tree247353ccf8393abb030991b1341d57fc28b41204
parent164f9d04f8bd32b02f17507b25046e0afd458d9f
bpf: don't let ldimm64 leak map addresses on unprivileged

CVE-2017-9150

The patch fixes two things at once:

1) It checks the env->allow_ptr_leaks and only prints the map address to
   the log if we have the privileges to do so, otherwise it just dumps 0
   as we would when kptr_restrict is enabled on %pK. Given the latter is
   off by default and not every distro sets it, I don't want to rely on
   this, hence the 0 by default for unprivileged.

2) Printing of ldimm64 in the verifier log is currently broken in that
   we don't print the full immediate, but only the 32 bit part of the
   first insn part for ldimm64. Thus, fix this up as well; it's okay to
   access, since we verified all ldimm64 earlier already (including just
   constants) through replace_map_fd_with_map_ptr().

Fixes: 1be7f75d1668 ("bpf: enable non-root eBPF programs")
Fixes: cbd357008604 ("bpf: verifier (add ability to receive verification log)")
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(backported from commit 0d0e57697f162da4aa218b5feafe614fb666db07)
Signed-off-by: Wen-chien Jesse Sung <jesse.sung@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Shrirang Bagul <shrirang.bagul@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
kernel/bpf/verifier.c