On Thu, 2024-09-26 at 09:29 +0200, Viktor Malik wrote: > 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. Note that existing string related helpers take a pointer to a string and it's maximal length, namely: - bpf_strtol - bpf_strtoul - bpf_snprintf_btf - bpf_strncmp The unbounded variants that are being exposed in this patch-set (like strcmp) are only safe to use if string is guaranteed to be null terminated. Verifier does not check this property at the moment (idk how easy/hard such analysis might be). I'd suggest not to expose unbounded variants of string functions. [...]