Skip to content

net: lwt_bpf: replace name-based BPF program comparison with digest#11982

Open
kernel-patches-daemon-bpf[bot] wants to merge 1 commit intobpf-next_basefrom
series/1086467=>bpf-next
Open

net: lwt_bpf: replace name-based BPF program comparison with digest#11982
kernel-patches-daemon-bpf[bot] wants to merge 1 commit intobpf-next_basefrom
series/1086467=>bpf-next

Conversation

@kernel-patches-daemon-bpf
Copy link
Copy Markdown

Pull request for series with
subject: net: lwt_bpf: replace name-based BPF program comparison with digest
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1086467

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 9f5b3ff
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1086467
version: 1

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 2ca6723
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1086467
version: 1

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 2ca6723
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1086467
version: 1

bpf_lwt_prog_cmp() used strcmp() on program names as a workaround
because delete requests rebuild the LWT state, creating a new
bpf_prog instance for the same program.

Name comparison is unreliable: programs with the same name but
different instructions compare equal, while instruction-identical
programs with different names compare unequal.

Replace it with a two-step approach:
- Pointer equality as a cheap fast path.
- SHA256 digest comparison as the fallback. bpf_prog_calc_tag()
  computes the digest (instructions with map fds zeroed) at the
  end of bpf_check(), so it is valid for every successfully
  loaded BPF program.

Signed-off-by: Matan Cohen <matan@matanco.space>
@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 2ca6723
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1086467
version: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants