|
|
Subscribe / Log in / New account

bpf: Add kfuncs for read-only string operations

From:  Viktor Malik <vmalik-AT-redhat.com>
To:  bpf-AT-vger.kernel.org
Subject:  [PATCH bpf-next 0/2] bpf: Add kfuncs for read-only string operations
Date:  Thu, 26 Sep 2024 08:18:20 +0200
Message-ID:  <cover.1727329823.git.vmalik@redhat.com>
Cc:  Alexei Starovoitov <ast-AT-kernel.org>, Daniel Borkmann <daniel-AT-iogearbox.net>, Andrii Nakryiko <andrii-AT-kernel.org>, Martin KaFai Lau <martin.lau-AT-linux.dev>, Eduard Zingerman <eddyz87-AT-gmail.com>, Song Liu <song-AT-kernel.org>, Yonghong Song <yonghong.song-AT-linux.dev>, John Fastabend <john.fastabend-AT-gmail.com>, KP Singh <kpsingh-AT-kernel.org>, Stanislav Fomichev <sdf-AT-fomichev.me>, Hao Luo <haoluo-AT-google.com>, Jiri Olsa <jolsa-AT-kernel.org>, Viktor Malik <vmalik-AT-redhat.com>
Archive-link:  Article

Kernel contains highly optimised implementation of traditional string
operations. Expose them as kfuncs to allow BPF programs leverage the
kernel implementation instead of needing to reimplement the operations.

These will be very helpful to bpftrace as it now needs to implement all
the string operations in LLVM IR.

Viktor Malik (2):
  bpf: Add kfuncs for read-only string operations
  selftests/bpf: Add tests for string kfuncs

 kernel/bpf/helpers.c                          |  66 ++++++
 .../selftests/bpf/prog_tests/string_kfuncs.c  |  37 +++
 .../selftests/bpf/progs/test_string_kfuncs.c  | 215 ++++++++++++++++++
 3 files changed, 318 insertions(+)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/string_kfuncs.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_string_kfuncs.c

-- 
2.46.0




Copyright © 2024, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds