[PATCH bpf-next v4 0/2] Add kfuncs bpf_strcasestr and bpf_strncasestr

Rong Tao
2025-10-09T01:26:40Z

From: Rong Tao <rongtao@cestc.cn>

Add kfuncs bpf_strcasestr and bpf_strncasestr, which are extensions of
bpf_strstr and bpf_strnstr, suitable for more scenarios.

Rong Tao (2):
bpf: add bpf_strcasestr,bpf_strncasestr kfuncs
selftests/bpf: Test bpf_strcasestr,bpf_strncasestr kfuncs

kernel/bpf/helpers.c | 98 +++++++++++++++----
.../selftests/bpf/prog_tests/string_kfuncs.c | 2 +
.../bpf/progs/string_kfuncs_failure1.c | 12 +++
.../bpf/progs/string_kfuncs_failure2.c | 2 +
.../bpf/progs/string_kfuncs_success.c | 10 ++
5 files changed, 103 insertions(+), 21 deletions(-)

---
v4: Fix wrong comment.
v3: keep __bpf_strnstr() static and compress some tests.
https://lore.kernel.org/lkml/tencent_6E59062E4249590597452A06AFCDA3098808@qq.com/
v2: remove extra __bpf_kfunc and fix comment of bpf_strncasestr().
https://lore.kernel.org/all/tencent_6D228941AB904DD6E1E58C8ACDEBEC280C06@qq.com/
v1: https://lore.kernel.org/all/tencent_8AF4D15B4475031E2185ACDE4B1495995707@qq.com/
--
2.51.0