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(-)