All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andriin@fb.com>
To: <bpf@vger.kernel.org>, <netdev@vger.kernel.org>, <ast@fb.com>,
	<daniel@iogearbox.net>
Cc: <andrii.nakryiko@gmail.com>, <kernel-team@fb.com>,
	Andrii Nakryiko <andriin@fb.com>,
	Luka Perkov <luka.perkov@sartura.hr>,
	Tony Ambardar <tony.ambardar@gmail.com>
Subject: [PATCH bpf-next 0/3] libbpf: auto-resize relocatable LOAD/STORE instructions
Date: Thu, 1 Oct 2020 18:06:30 -0700	[thread overview]
Message-ID: <20201002010633.3706122-1-andriin@fb.com> (raw)

Patch set implements logic in libbpf to auto-adjust memory size (1-, 2-, 4-,
8-bytes) of load/store (LD/ST/STX) instructions which have BPF CO-RE field
offset relocation associated with it. In practice this means transparent
handling of 32-bit kernels, both pointer and unsigned integers. Signed
integers are not relocatable with zero-extending loads/stores, so libbpf
poisons them and generates a warning. If/when BPF gets support for sign-extending
loads/stores, it would be possible to automatically relocate them as well.

All the details are contained in patch #1 comments and commit message.
Patch #2 is a simple change in libbpf to make advanced testing with custom BTF
easier. Patch #3 validates correct uses of auto-resizable loads, as well as
check that libbpf fails invalid uses.

I'd really appreciate folks that use BPF on 32-bit architectures to test this
out with their BPF programs and report if there are any problems with the
approach.

Cc: Luka Perkov <luka.perkov@sartura.hr>
Cc: Tony Ambardar <tony.ambardar@gmail.com>

Andrii Nakryiko (3):
  libbpf: support safe subset of load/store instruction resizing with
    CO-RE
  libbpf: allow specifying both ELF and raw BTF for CO-RE BTF override
  selftests/bpf: validate libbpf's auto-sizing of LD/ST/STX instructions

 tools/lib/bpf/libbpf.c                        | 146 ++++++++++++-
 .../selftests/bpf/prog_tests/core_autosize.c  | 199 ++++++++++++++++++
 .../selftests/bpf/progs/test_core_autosize.c  | 148 +++++++++++++
 3 files changed, 483 insertions(+), 10 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/core_autosize.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_core_autosize.c

-- 
2.24.1


             reply	other threads:[~2020-10-02  1:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02  1:06 Andrii Nakryiko [this message]
2020-10-02  1:06 ` [PATCH bpf-next 1/3] libbpf: support safe subset of load/store instruction resizing with CO-RE Andrii Nakryiko
2020-10-06 18:08   ` Alexei Starovoitov
2020-10-06 18:17     ` Andrii Nakryiko
2020-10-02  1:06 ` [PATCH bpf-next 2/3] libbpf: allow specifying both ELF and raw BTF for CO-RE BTF override Andrii Nakryiko
2020-10-02  1:06 ` [PATCH bpf-next 3/3] selftests/bpf: validate libbpf's auto-sizing of LD/ST/STX instructions Andrii Nakryiko
2020-10-07 17:56 ` [PATCH bpf-next 0/3] libbpf: auto-resize relocatable LOAD/STORE instructions Luka Perkov
2020-10-07 18:01   ` Andrii Nakryiko
2020-10-08 10:34     ` Luka Perkov
2020-10-08 17:59       ` Andrii Nakryiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201002010633.3706122-1-andriin@fb.com \
    --to=andriin@fb.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=luka.perkov@sartura.hr \
    --cc=netdev@vger.kernel.org \
    --cc=tony.ambardar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.