Commit 59df9f1f authored by Alexei Starovoitov's avatar Alexei Starovoitov
Browse files

Merge branch 'restrict-bpf_probe_read'

Daniel Borkmann says:

====================
Small set of fixes in order to restrict BPF helpers for tracing which are
broken on archs with overlapping address ranges as per discussion in [0].
I've targetted this for -bpf tree so they can be routed as fixes. Thanks!

v1 -> v2:
  - switch to reusable %pks, %pus format specifiers (Yonghong)
    - fixate %s on kernel_ds probing for archs with overlapping addr space

      [0] https://lore.kernel.org/bpf/CAHk-=wjJKo0GVixYLmqPn-Q22WFu0xHaBSjKEo7e7Yw72y5SPQ@mail.gmail.com/T/


====================

Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parents 6d74f64b b2a5212f
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -112,6 +112,20 @@ used when printing stack backtraces. The specifier takes into
consideration the effect of compiler optimisations which may occur
when tail-calls are used and marked with the noreturn GCC attribute.

Probed Pointers from BPF / tracing
----------------------------------

::

	%pks	kernel string
	%pus	user string

The ``k`` and ``u`` specifiers are used for printing prior probed memory from
either kernel memory (k) or user memory (u). The subsequent ``s`` specifier
results in printing a string. For direct use in regular vsnprintf() the (k)
and (u) annotation is ignored, however, when used out of BPF's bpf_trace_printk(),
for example, it reads the memory it is pointing to without faulting.

Kernel Pointers
---------------

+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ config ARM
	select ARCH_HAS_KEEPINITRD
	select ARCH_HAS_KCOV
	select ARCH_HAS_MEMBARRIER_SYNC_CORE
	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
	select ARCH_HAS_PTE_SPECIAL if ARM_LPAE
	select ARCH_HAS_PHYS_TO_DMA
	select ARCH_HAS_SETUP_DMA_OPS
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ config ARM64
	select ARCH_HAS_KCOV
	select ARCH_HAS_KEEPINITRD
	select ARCH_HAS_MEMBARRIER_SYNC_CORE
	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
	select ARCH_HAS_PTE_DEVMAP
	select ARCH_HAS_PTE_SPECIAL
	select ARCH_HAS_SETUP_DMA_OPS
+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ config X86
	select ARCH_HAS_KCOV			if X86_64
	select ARCH_HAS_MEM_ENCRYPT
	select ARCH_HAS_MEMBARRIER_SYNC_CORE
	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
	select ARCH_HAS_PMEM_API		if X86_64
	select ARCH_HAS_PTE_DEVMAP		if X86_64
	select ARCH_HAS_PTE_SPECIAL
+3 −0
Original line number Diff line number Diff line
@@ -2279,6 +2279,9 @@ config ASN1

source "kernel/Kconfig.locks"

config ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
	bool

config ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
	bool

Loading