mbox series

[bpf,v3,0/2] Add the missing BPF_LINK_TYPE invocation for sockmap

Message ID 20241024013558.1135167-1-houtao@huaweicloud.com (mailing list archive)
Headers show
Series Add the missing BPF_LINK_TYPE invocation for sockmap | expand

Message

Hou Tao Oct. 24, 2024, 1:35 a.m. UTC
From: Hou Tao <houtao1@huawei.com>

Hi,

The tiny patch set fixes the out-of-bound read problem when reading the
fdinfo of sock map link fd. And in order to spot such omission early for
the newly-added link type in the future, it also checks the validity of
the link->type and adds a WARN_ONCE() for missed invocation.

Please see individual patches for more details. And comments are always
welcome.

v3:
  * patch #2: check and warn the validity of link->type instead of
    adding a static assertion for bpf_link_type_strs array.

v2: http://lore.kernel.org/bpf/d49fa2f4-f743-c763-7579-c3cab4dd88cb@huaweicloud.com

Hou Tao (2):
  bpf: Add the missing BPF_LINK_TYPE invocation for sockmap
  bpf: Check validity of link->type in bpf_link_show_fdinfo()

 include/linux/bpf_types.h      |  1 +
 include/uapi/linux/bpf.h       |  3 +++
 kernel/bpf/syscall.c           | 14 +++++++++-----
 tools/include/uapi/linux/bpf.h |  3 +++
 4 files changed, 16 insertions(+), 5 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Oct. 24, 2024, 5:40 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Thu, 24 Oct 2024 09:35:56 +0800 you wrote:
> From: Hou Tao <houtao1@huawei.com>
> 
> Hi,
> 
> The tiny patch set fixes the out-of-bound read problem when reading the
> fdinfo of sock map link fd. And in order to spot such omission early for
> the newly-added link type in the future, it also checks the validity of
> the link->type and adds a WARN_ONCE() for missed invocation.
> 
> [...]

Here is the summary with links:
  - [bpf,v3,1/2] bpf: Add the missing BPF_LINK_TYPE invocation for sockmap
    https://git.kernel.org/bpf/bpf/c/c2f803052bc7
  - [bpf,v3,2/2] bpf: Check validity of link->type in bpf_link_show_fdinfo()
    https://git.kernel.org/bpf/bpf/c/8421d4c8762b

You are awesome, thank you!