Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03566c46 authored by Daniel Borkmann's avatar Daniel Borkmann Committed by Srinivasa Rao Kuppala
Browse files

bpf: don't let ldimm64 leak map addresses on unprivileged



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().

Change-Id: I25392dede9879a8854e38ce82a68e13ba1391564
Fixes: 1be7f75d1668 ("bpf: enable non-root eBPF programs")
Fixes: cbd35700 ("bpf: verifier (add ability to receive verification log)")
Reported-by: default avatarJann Horn <jannh@google.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Git-commit: 0d0e57697f162da4aa218b5feafe614fb666db07
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarSrinivasa Rao Kuppala <srkupp@codeaurora.org>
parent 52a7f96c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment