All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gary Lin <glin@suse.com>
To: netdev@vger.kernel.org, bpf@vger.kernel.org,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	andreas.taschner@suse.com
Subject: [PATCH v4 0/3] bpf,x64: implement jump padding in jit
Date: Tue, 19 Jan 2021 18:24:58 +0800	[thread overview]
Message-ID: <20210119102501.511-1-glin@suse.com> (raw)

This patch series implements jump padding to x64 jit to cover some
corner cases that used to consume more than 20 jit passes and caused
failure.

v4:
  - Add the detailed comments about the possible padding bytes
  - Add the second test case which triggers jmp_cond padding and imm32 nop
    jmp padding.
  - Add the new test case as another subprog

v3:
  - Copy the instructions of prologue separately or the size calculation
    of the first BPF instruction would include the prologue.
  - Replace WARN_ONCE() with pr_err() and EFAULT
  - Use MAX_PASSES in the for loop condition check
  - Remove the "padded" flag from x64_jit_data. For the extra pass of
    subprogs, padding is always enabled since it won't hurt the images
    that converge without padding.
v2:
  - Simplify the sample code in the commit description and provide the
    jit code
  - Check the expected padding bytes with WARN_ONCE
  - Move the 'padded' flag to 'struct x64_jit_data'
  - Remove the EXPECTED_FAIL flag from bpf_fill_maxinsns11() in test_bpf
  - Add 2 verifier tests

Gary Lin (3):
  bpf,x64: pad NOPs to make images converge more easily
  test_bpf: remove EXPECTED_FAIL flag from bpf_fill_maxinsns11
  selftests/bpf: Add verifier tests for x64 jit jump padding

 arch/x86/net/bpf_jit_comp.c                 | 140 ++++++++++++++++----
 lib/test_bpf.c                              |   7 +-
 tools/testing/selftests/bpf/test_verifier.c |  72 ++++++++++
 tools/testing/selftests/bpf/verifier/jit.c  |  24 ++++
 4 files changed, 209 insertions(+), 34 deletions(-)

-- 
2.29.2


             reply	other threads:[~2021-01-19 14:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19 10:24 Gary Lin [this message]
2021-01-19 10:24 ` [PATCH v4 1/3] bpf,x64: pad NOPs to make images converge more easily Gary Lin
2021-01-19 10:25 ` [PATCH v4 2/3] test_bpf: remove EXPECTED_FAIL flag from bpf_fill_maxinsns11 Gary Lin
2021-01-19 10:25 ` [PATCH v4 3/3] selftests/bpf: Add verifier tests for x64 jit jump padding Gary Lin
2021-01-19 20:54 ` [PATCH v4 0/3] bpf,x64: implement jump padding in jit Alexei Starovoitov

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=20210119102501.511-1-glin@suse.com \
    --to=glin@suse.com \
    --cc=andreas.taschner@suse.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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.