[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4BzZ=pBcoUA7jxS7MiO8dYT4s-JGR1HG++DmbmqoKYM5qWw@mail.gmail.com>
Date: Thu, 31 Oct 2019 13:12:06 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Masami Hiramatsu <mhiramat@...nel.org>, x86@...nel.org
Subject: Re: [PATCH bpf-next v2 2/8] uaccess: Add strict non-pagefault
kernel-space read function
On Wed, Oct 30, 2019 at 6:00 PM Daniel Borkmann <daniel@...earbox.net> wrote:
>
> Add two new probe_kernel_read_strict() and strncpy_from_unsafe_strict()
> helpers which by default alias to the __probe_kernel_read() and the
> __strncpy_from_unsafe(), respectively, but can be overridden by archs
> which have non-overlapping address ranges for kernel space and user
> space in order to bail out with -EFAULT when attempting to probe user
> memory including non-canonical user access addresses [0].
>
> The idea is that these helpers are complementary to the probe_user_read()
> and strncpy_from_unsafe_user() which probe user-only memory. Both added
> helpers here do the same, but for kernel-only addresses.
>
> Both set of helpers are going to be used for BPF tracing. They also
> explicitly avoid throwing the splat for non-canonical user addresses from
> 00c42373d397 ("x86-64: add warning for non-canonical user access address
> dereferences").
>
> For compat, the current probe_kernel_read() and strncpy_from_unsafe() are
> left as-is.
>
> [0] Documentation/x86/x86_64/mm.txt
>
> 4-level page tables: 0x0000800000000000 - 0xffff7fffffffffff
> 5-level page tables: 0x0100000000000000 - 0xfeffffffffffffff
>
> Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Cc: Masami Hiramatsu <mhiramat@...nel.org>
> Cc: x86@...nel.org
> ---
Acked-by: Andrii Nakryiko <andriin@...com>
> arch/x86/mm/Makefile | 2 +-
> arch/x86/mm/maccess.c | 38 ++++++++++++++++++++++++++++++++++++++
> include/linux/uaccess.h | 4 ++++
> mm/maccess.c | 25 ++++++++++++++++++++++++-
> 4 files changed, 67 insertions(+), 2 deletions(-)
> create mode 100644 arch/x86/mm/maccess.c
>
[...]
Powered by blists - more mailing lists