stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] Fix bpf: fix userspace access for bpf_probe_read{,str}()
@ 2021-04-21 13:05 Zidenberg, Tsahi
  2021-04-21 13:07 ` [PATCH 1/8] uaccess: Add strict non-pagefault kernel-space read, function Zidenberg, Tsahi
                   ` (10 more replies)
  0 siblings, 11 replies; 15+ messages in thread
From: Zidenberg, Tsahi @ 2021-04-21 13:05 UTC (permalink / raw)
  To: stable; +Cc: Greg KH

In arm64, kernelspace address accessors cannot be used to access
userspace addresses, which means bpf_probe_read{,str}() cannot access
userspace addresses. That causes e.g. command-line parameters to not
appear when snooping execve using bpf.

This patch series takes the upstream solution. This solution also
changes user API in the following ways:
* Add probe_read_{user, kernel}{,_str} bpf helpers
* Add skb_output helper to the enum only (calling it not supported)
* Add support for %pks, %pus specifiers

An alternative fix only takes the required logic to existing API without
adding new API, was suggested here:
https://www.spinics.net/lists/stable/msg454945.html

Another option is to only take patches [1-4] of this patchset, and add
on top of them commit 8d92db5c04d1 ("bpf: rework the compat kernel probe
handling"). In that case, the last patch would require function renames
and conflict resolutions that were avoided in this patchset by pulling
patches [5-7].

Christoph Hellwig (3):
  maccess: rename strncpy_from_unsafe_user to strncpy_from_user_nofault
  maccess: rename strncpy_from_unsafe_strict to
    strncpy_from_kernel_nofault
  bpf: rework the compat kernel probe handling

Daniel Borkmann (4):
  uaccess: Add strict non-pagefault kernel-space read function
  bpf: Add probe_read_{user, kernel} and probe_read_{user, kernel}_str
    helpers
  bpf: Restrict bpf_probe_read{, str}() only to archs where they work
  bpf: Restrict bpf_trace_printk()'s %s usage and add %pks, %pus
    specifier

Petr Mladek (1):
  powerpc/bpf: Enable bpf_probe_read{, str}() on powerpc again

 Documentation/core-api/printk-formats.rst |  14 +
 arch/arm/Kconfig                          |   1 +
 arch/arm64/Kconfig                        |   1 +
 arch/powerpc/Kconfig                      |   1 +
 arch/x86/Kconfig                          |   1 +
 arch/x86/mm/Makefile                      |   2 +-
 arch/x86/mm/maccess.c                     |  43 +++
 include/linux/uaccess.h                   |   8 +-
 include/uapi/linux/bpf.h                  | 123 ++++++---
 init/Kconfig                              |   3 +
 kernel/trace/bpf_trace.c                  | 302 ++++++++++++++++------
 kernel/trace/trace_kprobe.c               |   2 +-
 lib/vsprintf.c                            |  12 +
 mm/maccess.c                              |  48 +++-
 tools/include/uapi/linux/bpf.h            | 116 ++++++---
 15 files changed, 512 insertions(+), 165 deletions(-)
 create mode 100644 arch/x86/mm/maccess.c

-- 
2.25.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-04-24 14:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 13:05 [PATCH 0/8] Fix bpf: fix userspace access for bpf_probe_read{,str}() Zidenberg, Tsahi
2021-04-21 13:07 ` [PATCH 1/8] uaccess: Add strict non-pagefault kernel-space read, function Zidenberg, Tsahi
2021-04-21 13:08 ` bpf: Add probe_read_{user, kernel} and probe_read_{user,, kernel}_str helpers Zidenberg, Tsahi
2021-04-23 15:06   ` Greg KH
2021-04-21 13:09 ` [PATCH 3/8] bpf: Restrict bpf_probe_read{, str}() only to archs where, they work Zidenberg, Tsahi
2021-04-21 13:10 ` [PATCH 4/8] powerpc/bpf: Enable bpf_probe_read{, str}() on powerpc, again Zidenberg, Tsahi
2021-04-21 13:11 ` [PATCH 5/8] bpf: Restrict bpf_trace_printk()'s %s usage and add %pks,, %pus specifier Zidenberg, Tsahi
2021-04-21 13:12 ` [PATCH 6/8] maccess: rename strncpy_from_unsafe_user to, strncpy_from_user_nofault Zidenberg, Tsahi
2021-04-21 13:13 ` [PATCH 7/8] maccess: rename strncpy_from_unsafe_strict to, strncpy_from_kernel_nofault Zidenberg, Tsahi
2021-04-21 13:14 ` [PATCH 8/8] bpf: rework the compat kernel probe handling Zidenberg, Tsahi
2021-04-21 13:15 ` [PATCH 2/8] bpf: Add probe_read_{user, kernel} and probe_read_{user,, kernel}_str helpers Zidenberg, Tsahi
2021-04-21 13:18 ` [PATCH 0/8] Fix bpf: fix userspace access for bpf_probe_read{,str}() Greg KH
2021-04-21 14:27   ` [PATCH 0/8] Fix bpf: fix userspace access for bpf_probe_read{, str}() Zidenberg, Tsahi
2021-04-23 15:08 ` [PATCH 0/8] Fix bpf: fix userspace access for bpf_probe_read{,str}() Greg KH
2021-04-24 14:47   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).