BPF List
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org, Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Yauheni Kaliuta <yauheni.kaliuta@redhat.com>,
	Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH RFC bpf-next 0/5] Do not include the original insn in zext patchlet
Date: Thu, 10 Sep 2020 01:34:34 +0200	[thread overview]
Message-ID: <20200909233439.3100292-1-iii@linux.ibm.com> (raw)

Hi!

This patch series attempts to fix test_progs failure on s390, which
Yauheni reported here:

https://lore.kernel.org/bpf/20200903140542.156624-1-yauheni.kaliuta@redhat.com/

The problem is that zext code includes the instruction, whose result
needs to be zero-extended, into the zero-extension patchlet. If this
instruction happens to be a call, its delta is not adjusted, and as a
result verifier rejects the program later.

The code seems to have been written this way, because there is no helper
function to insert bpf instructions: currently one can either replace or
remove. So insertion seems to have been emulated with replacement.

Patches 1-4 teach bpf_patch_insn_data() how to insert (by accepting
variable number of old insns, which is normally 1, but can now be 0
too). Patch 5 uses this new capability to resolve the issue.

Ilya Leoshkevich (5):
  bpf: Make bpf_patch_insn_single() accept variable number of old insns
  bpf: Make adjust_insn_aux_data() accept variable number of old insns
  bpf: Make adjust_subprog_starts() accept variable number of old insns
  bpf: Make bpf_patch_insn_data() accept variable number of old insns
  bpf: Do not include the original insn in zext patchlet

 include/linux/filter.h |   4 +-
 kernel/bpf/core.c      |  18 ++++----
 kernel/bpf/verifier.c  | 100 ++++++++++++++++++++++++-----------------
 3 files changed, 70 insertions(+), 52 deletions(-)

-- 
2.25.4


             reply	other threads:[~2020-09-10  2:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 23:34 Ilya Leoshkevich [this message]
2020-09-09 23:34 ` [PATCH RFC bpf-next 1/5] bpf: Make bpf_patch_insn_single() accept variable number of old insns Ilya Leoshkevich
2020-09-09 23:34 ` [PATCH RFC bpf-next 2/5] bpf: Make adjust_insn_aux_data() " Ilya Leoshkevich
2020-09-09 23:34 ` [PATCH RFC bpf-next 3/5] bpf: Make adjust_subprog_starts() " Ilya Leoshkevich
2020-09-09 23:34 ` [PATCH RFC bpf-next 4/5] bpf: Make bpf_patch_insn_data() " Ilya Leoshkevich
2020-09-09 23:34 ` [PATCH RFC bpf-next 5/5] bpf: Do not include the original insn in zext patchlet Ilya Leoshkevich
2020-09-10  6:59   ` Yauheni Kaliuta
2020-09-10  9:18     ` Ilya Leoshkevich
2020-09-11  0:25   ` Alexei Starovoitov
2020-09-11  6:33     ` Yauheni Kaliuta
2020-09-11 12:58     ` Ilya Leoshkevich
2020-09-29 20:03       ` Ilya Leoshkevich

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=20200909233439.3100292-1-iii@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=yauheni.kaliuta@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox