]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bpf: add _impl suffix for bpf_stream_vprintk() kfunc
authorMykyta Yatsenko <yatsenko@meta.com>
Tue, 4 Nov 2025 22:54:26 +0000 (22:54 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 5 Nov 2025 01:50:25 +0000 (17:50 -0800)
Rename bpf_stream_vprintk() to bpf_stream_vprintk_impl().

This makes bpf_stream_vprintk() follow the already established "_impl"
suffix-based naming convention for kfuncs with the bpf_prog_aux
argument provided by the verifier implicitly. This convention will be
taken advantage of with the upcoming KF_IMPLICIT_ARGS feature to
preserve backwards compatibility to BPF programs.

Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Link: https://lore.kernel.org/r/20251104-implv2-v3-2-4772b9ae0e06@meta.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev>
kernel/bpf/helpers.c
kernel/bpf/stream.c
tools/bpf/bpftool/Documentation/bpftool-prog.rst
tools/lib/bpf/bpf_helpers.h
tools/testing/selftests/bpf/progs/stream_fail.c

index 33173b027ccf8893ce18aad474b88f8544f7b344..e4007fea49091c01c1d23af55a25f5567417e978 100644 (file)
@@ -4380,7 +4380,7 @@ BTF_ID_FLAGS(func, bpf_strnstr);
 #if defined(CONFIG_BPF_LSM) && defined(CONFIG_CGROUPS)
 BTF_ID_FLAGS(func, bpf_cgroup_read_xattr, KF_RCU)
 #endif
-BTF_ID_FLAGS(func, bpf_stream_vprintk, KF_TRUSTED_ARGS)
+BTF_ID_FLAGS(func, bpf_stream_vprintk_impl, KF_TRUSTED_ARGS)
 BTF_ID_FLAGS(func, bpf_task_work_schedule_signal_impl, KF_TRUSTED_ARGS)
 BTF_ID_FLAGS(func, bpf_task_work_schedule_resume_impl, KF_TRUSTED_ARGS)
 BTF_KFUNCS_END(common_btf_ids)
index eb6c5a21c2efee96c41f4c5e43d54062694a4859..ff16c631951bb685e8ecf1707206dad603121a65 100644 (file)
@@ -355,7 +355,8 @@ __bpf_kfunc_start_defs();
  * Avoid using enum bpf_stream_id so that kfunc users don't have to pull in the
  * enum in headers.
  */
-__bpf_kfunc int bpf_stream_vprintk(int stream_id, const char *fmt__str, const void *args, u32 len__sz, void *aux__prog)
+__bpf_kfunc int bpf_stream_vprintk_impl(int stream_id, const char *fmt__str, const void *args,
+                                       u32 len__sz, void *aux__prog)
 {
        struct bpf_bprintf_data data = {
                .get_bin_args   = true,
index 009633294b0934ac282601cf21a0fd03c388de2c..35aeeaf5f71166f0e1e8759da8639c2533d47482 100644 (file)
@@ -182,7 +182,7 @@ bpftool prog tracelog
 
 bpftool prog tracelog { stdout | stderr } *PROG*
     Dump the BPF stream of the program. BPF programs can write to these streams
-    at runtime with the **bpf_stream_vprintk**\ () kfunc. The kernel may write
+    at runtime with the **bpf_stream_vprintk_impl**\ () kfunc. The kernel may write
     error messages to the standard error stream. This facility should be used
     only for debugging purposes.
 
index 80c028540656176376909cb796e56de433ef3aab..d4e4e388e625894f8ec27b5a6278dbb46e658720 100644 (file)
@@ -315,20 +315,20 @@ enum libbpf_tristate {
                          ___param, sizeof(___param));          \
 })
 
-extern int bpf_stream_vprintk(int stream_id, const char *fmt__str, const void *args,
-                             __u32 len__sz, void *aux__prog) __weak __ksym;
-
-#define bpf_stream_printk(stream_id, fmt, args...)                             \
-({                                                                             \
-       static const char ___fmt[] = fmt;                                       \
-       unsigned long long ___param[___bpf_narg(args)];                         \
-                                                                               \
-       _Pragma("GCC diagnostic push")                                          \
-       _Pragma("GCC diagnostic ignored \"-Wint-conversion\"")                  \
-       ___bpf_fill(___param, args);                                            \
-       _Pragma("GCC diagnostic pop")                                           \
-                                                                               \
-       bpf_stream_vprintk(stream_id, ___fmt, ___param, sizeof(___param), NULL);\
+extern int bpf_stream_vprintk_impl(int stream_id, const char *fmt__str, const void *args,
+                                  __u32 len__sz, void *aux__prog) __weak __ksym;
+
+#define bpf_stream_printk(stream_id, fmt, args...)                                     \
+({                                                                                     \
+       static const char ___fmt[] = fmt;                                               \
+       unsigned long long ___param[___bpf_narg(args)];                                 \
+                                                                                       \
+       _Pragma("GCC diagnostic push")                                                  \
+       _Pragma("GCC diagnostic ignored \"-Wint-conversion\"")                          \
+       ___bpf_fill(___param, args);                                                    \
+       _Pragma("GCC diagnostic pop")                                                   \
+                                                                                       \
+       bpf_stream_vprintk_impl(stream_id, ___fmt, ___param, sizeof(___param), NULL);   \
 })
 
 /* Use __bpf_printk when bpf_printk call has 3 or fewer fmt args
index b4a0d0cc8ec8a9483b5967745cd35f8bd940460e..3662515f0107740c147f5a9296b4da06fa508364 100644 (file)
@@ -10,7 +10,7 @@ SEC("syscall")
 __failure __msg("Possibly NULL pointer passed")
 int stream_vprintk_null_arg(void *ctx)
 {
-       bpf_stream_vprintk(BPF_STDOUT, "", NULL, 0, NULL);
+       bpf_stream_vprintk_impl(BPF_STDOUT, "", NULL, 0, NULL);
        return 0;
 }
 
@@ -18,7 +18,7 @@ SEC("syscall")
 __failure __msg("R3 type=scalar expected=")
 int stream_vprintk_scalar_arg(void *ctx)
 {
-       bpf_stream_vprintk(BPF_STDOUT, "", (void *)46, 0, NULL);
+       bpf_stream_vprintk_impl(BPF_STDOUT, "", (void *)46, 0, NULL);
        return 0;
 }
 
@@ -26,7 +26,7 @@ SEC("syscall")
 __failure __msg("arg#1 doesn't point to a const string")
 int stream_vprintk_string_arg(void *ctx)
 {
-       bpf_stream_vprintk(BPF_STDOUT, ctx, NULL, 0, NULL);
+       bpf_stream_vprintk_impl(BPF_STDOUT, ctx, NULL, 0, NULL);
        return 0;
 }