public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>
Cc: <andrii@kernel.org>, <kernel-team@fb.com>
Subject: [PATCH v2 bpf-next 0/3] Fix BPF verifier global subprog context argument logic
Date: Wed, 15 Feb 2023 20:59:51 -0800	[thread overview]
Message-ID: <20230216045954.3002473-1-andrii@kernel.org> (raw)

Fix kernel bug in determining whether global subprog's argument is PTR_TO_CTX,
which is done based on type names. Currently KPROBE programs are broken.

Add few tests validating that KPROBE context can be passed to global subprog.
For that also refactor test_global_funcs test to use test_loader framework.

v1->v2:
  - fix compilation warning on arm64 and s390x by force-casting ctx to
    `void *`, to discard const from `const struct user_pt_regs *`, when
    passing it to bpf_get_stack().

Andrii Nakryiko (3):
  bpf: fix global subprog context argument resolution logic
  selftests/bpf: convert test_global_funcs test to test_loader framework
  selftests/bpf: add global subprog context passing tests

 kernel/bpf/btf.c                              |  13 +-
 .../bpf/prog_tests/test_global_funcs.c        | 133 +++++-------------
 .../selftests/bpf/progs/test_global_func1.c   |   6 +-
 .../selftests/bpf/progs/test_global_func10.c  |   4 +-
 .../selftests/bpf/progs/test_global_func11.c  |   4 +-
 .../selftests/bpf/progs/test_global_func12.c  |   4 +-
 .../selftests/bpf/progs/test_global_func13.c  |   4 +-
 .../selftests/bpf/progs/test_global_func14.c  |   4 +-
 .../selftests/bpf/progs/test_global_func15.c  |   4 +-
 .../selftests/bpf/progs/test_global_func16.c  |   4 +-
 .../selftests/bpf/progs/test_global_func17.c  |   4 +-
 .../selftests/bpf/progs/test_global_func2.c   |  43 +++++-
 .../selftests/bpf/progs/test_global_func3.c   |  10 +-
 .../selftests/bpf/progs/test_global_func4.c   |  55 +++++++-
 .../selftests/bpf/progs/test_global_func5.c   |   4 +-
 .../selftests/bpf/progs/test_global_func6.c   |   4 +-
 .../selftests/bpf/progs/test_global_func7.c   |   4 +-
 .../selftests/bpf/progs/test_global_func8.c   |   4 +-
 .../selftests/bpf/progs/test_global_func9.c   |   4 +-
 .../bpf/progs/test_global_func_ctx_args.c     | 105 ++++++++++++++
 20 files changed, 292 insertions(+), 125 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/test_global_func_ctx_args.c

-- 
2.30.2


             reply	other threads:[~2023-02-16  5:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16  4:59 Andrii Nakryiko [this message]
2023-02-16  4:59 ` [PATCH v2 bpf-next 1/3] bpf: fix global subprog context argument resolution logic Andrii Nakryiko
2023-02-16  4:59 ` [PATCH v2 bpf-next 2/3] selftests/bpf: convert test_global_funcs test to test_loader framework Andrii Nakryiko
2023-02-16  4:59 ` [PATCH v2 bpf-next 3/3] selftests/bpf: add global subprog context passing tests Andrii Nakryiko
2023-02-17 20:24   ` Daniel Borkmann
2023-02-16 17:40 ` [PATCH v2 bpf-next 0/3] Fix BPF verifier global subprog context argument logic Stanislav Fomichev
2023-02-16 19:53   ` Andrii Nakryiko
2023-02-17 20:30 ` patchwork-bot+netdevbpf

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=20230216045954.3002473-1-andrii@kernel.org \
    --to=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.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