Files
linux/kernel
Daniel Borkmann a0b2c35580 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().

Fixes: 1be7f75d16 ("bpf: enable non-root eBPF programs")
Fixes: cbd3570086 ("bpf: verifier (add ability to receive verification log)")
Change-Id: Icfc2f72c98470b106f6972fea3eaa26d5489c234
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>
2017-11-23 11:56:24 +09:00
..
2015-06-30 19:44:57 -07:00
2015-04-11 22:27:55 -04:00
2014-10-09 22:26:04 -04:00
2015-11-04 08:23:51 -05:00
2014-08-08 15:57:18 -07:00
2015-04-12 21:03:31 +02:00
2015-11-23 09:44:58 +01:00
2014-12-04 14:34:54 -05:00
2015-01-17 10:02:23 +13:00
2015-11-05 19:34:48 -08:00