mbox series

[bpf-next,v2,0/2] bpf: Fix updating attached freplace prog to prog_array map

Message ID 20240726153952.76914-1-leon.hwang@linux.dev (mailing list archive)
Headers show
Series bpf: Fix updating attached freplace prog to prog_array map | expand

Message

Leon Hwang July 26, 2024, 3:39 p.m. UTC
The commit f7866c3587337731 ("bpf: Fix null pointer dereference in
resolve_prog_type() for BPF_PROG_TYPE_EXT") fixed a NULL pointer
dereference panic, but didn't fix the issue that fails to update attached
freplace prog to prog_array map.

This patch fixes the issue.

v1 -> v2:
 * Address comments from Yonghong:
   * Check then return prog->aux->saved_dst_prog_type.
   * Remove ASSERT_GE() that checks prog_fd and map_fd.
   * Remove #include "bpf_legacy.h".
   * Fix some code style issues.

RFC PATCH -> v1:
 * Respin the PATCH with updated message.

Links:
[0] https://lore.kernel.org/bpf/20240602122421.50892-1-hffilwlqm@gmail.com/

Leon Hwang (2):
  bpf: Fix updating attached freplace prog to prog_array map
  selftests/bpf: Add testcase for updating attached freplace prog to
    prog_array map

 include/linux/bpf_verifier.h                  |  4 +-
 .../selftests/bpf/prog_tests/tailcalls.c      | 65 ++++++++++++++++++-
 .../selftests/bpf/progs/tailcall_freplace.c   | 25 +++++++
 .../testing/selftests/bpf/progs/tc_bpf2bpf.c  | 21 ++++++
 4 files changed, 112 insertions(+), 3 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/tailcall_freplace.c
 create mode 100644 tools/testing/selftests/bpf/progs/tc_bpf2bpf.c

Comments

Yonghong Song July 26, 2024, 7:26 p.m. UTC | #1
On 7/26/24 8:39 AM, Leon Hwang wrote:
> The commit f7866c3587337731 ("bpf: Fix null pointer dereference in
> resolve_prog_type() for BPF_PROG_TYPE_EXT") fixed a NULL pointer

Typically 12 alphanums are used for a commit. So please use
   f7866c358733 ("bpf: Fix null pointer dereference in resolve_prog_type() for BPF_PROG_TYPE_EXT")
Please have the commit subject ("bpf: Fix ...") in the same line for easy search purpose.

> dereference panic, but didn't fix the issue that fails to update attached
> freplace prog to prog_array map.
>
> This patch fixes the issue.
>
> v1 -> v2:
>   * Address comments from Yonghong:
>     * Check then return prog->aux->saved_dst_prog_type.
>     * Remove ASSERT_GE() that checks prog_fd and map_fd.
>     * Remove #include "bpf_legacy.h".
>     * Fix some code style issues.
>
> RFC PATCH -> v1:
>   * Respin the PATCH with updated message.
>
> Links:
> [0] https://lore.kernel.org/bpf/20240602122421.50892-1-hffilwlqm@gmail.com/
>
> Leon Hwang (2):
>    bpf: Fix updating attached freplace prog to prog_array map
>    selftests/bpf: Add testcase for updating attached freplace prog to
>      prog_array map
>
>   include/linux/bpf_verifier.h                  |  4 +-
>   .../selftests/bpf/prog_tests/tailcalls.c      | 65 ++++++++++++++++++-
>   .../selftests/bpf/progs/tailcall_freplace.c   | 25 +++++++
>   .../testing/selftests/bpf/progs/tc_bpf2bpf.c  | 21 ++++++
>   4 files changed, 112 insertions(+), 3 deletions(-)
>   create mode 100644 tools/testing/selftests/bpf/progs/tailcall_freplace.c
>   create mode 100644 tools/testing/selftests/bpf/progs/tc_bpf2bpf.c
>