diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 84ca6c2bea9141cbec21a0456c3aa970e494a50f..47969aa0faf80733ab2f05fb9ef5ea9b09b1681e 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -54,22 +54,16 @@
 
 #define __printf(a, b)	__attribute__((format(printf, a, b)))
 
-__printf(2, 3)
-static int __base_pr(enum libbpf_print_level level, const char *format, ...)
+static int __base_pr(enum libbpf_print_level level, const char *format,
+		     va_list args)
 {
-	va_list args;
-	int err;
-
 	if (level == LIBBPF_DEBUG)
 		return 0;
 
-	va_start(args, format);
-	err = vfprintf(stderr, format, args);
-	va_end(args);
-	return err;
+	return vfprintf(stderr, format, args);
 }
 
-static __printf(2, 3) libbpf_print_fn_t __libbpf_pr = __base_pr;
+static libbpf_print_fn_t __libbpf_pr = __base_pr;
 
 void libbpf_set_print(libbpf_print_fn_t fn)
 {
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index 19dbc1bed96077ddd7e618486b606a5d009ce868..69a7c25eacccf27c1af7ea3bc138a906a1f459d1 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -54,8 +54,7 @@ enum libbpf_print_level {
 };
 
 typedef int (*libbpf_print_fn_t)(enum libbpf_print_level level,
-				 const char *, ...)
-	__attribute__((format(printf, 2, 3)));
+				 const char *, va_list ap);
 
 LIBBPF_API void libbpf_set_print(libbpf_print_fn_t fn);
 
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 38afdbe6a9e0361f079c55257c847031569725cb..037d8ff6a634c4462ba57032b09da582775c93fc 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -25,15 +25,9 @@
 #include "c++/clang-c.h"
 
 static int libbpf_perf_print(enum libbpf_print_level level __attribute__((unused)),
-			      const char *fmt, ...)
+			      const char *fmt, va_list args)
 {
-	va_list args;
-	int ret;
-
-	va_start(args, fmt);
-	ret = veprintf(1, verbose, pr_fmt(fmt), args);
-	va_end(args);
-	return ret;
+	return veprintf(1, verbose, pr_fmt(fmt), args);
 }
 
 struct bpf_prog_priv {
diff --git a/tools/testing/selftests/bpf/test_btf.c b/tools/testing/selftests/bpf/test_btf.c
index aebaeff5a5a0209eb8db2a724ef061c420c9b015..5afab823ffbe1760ec297f3a5640fe0bb359ad37 100644
--- a/tools/testing/selftests/bpf/test_btf.c
+++ b/tools/testing/selftests/bpf/test_btf.c
@@ -52,19 +52,10 @@ static int count_result(int err)
 	return err;
 }
 
-#define __printf(a, b)	__attribute__((format(printf, a, b)))
-
-__printf(2, 3)
 static int __base_pr(enum libbpf_print_level level __attribute__((unused)),
-		     const char *format, ...)
+		     const char *format, va_list args)
 {
-	va_list args;
-	int err;
-
-	va_start(args, format);
-	err = vfprintf(stderr, format, args);
-	va_end(args);
-	return err;
+	return vfprintf(stderr, format, args);
 }
 
 #define BTF_INFO_ENC(kind, kind_flag, vlen)			\
diff --git a/tools/testing/selftests/bpf/test_libbpf_open.c b/tools/testing/selftests/bpf/test_libbpf_open.c
index b9ff3bf76544b03b278de37bd0c6f2d07a408ee9..1909ecf4d99911af80da8edb90210300b6e45846 100644
--- a/tools/testing/selftests/bpf/test_libbpf_open.c
+++ b/tools/testing/selftests/bpf/test_libbpf_open.c
@@ -36,19 +36,13 @@ static void usage(char *argv[])
 
 static bool debug = 0;
 static int libbpf_debug_print(enum libbpf_print_level level,
-			      const char *fmt, ...)
+			      const char *fmt, va_list args)
 {
-	va_list args;
-	int ret;
-
 	if (level == LIBBPF_DEBUG && !debug)
 		return 0;
 
-	va_start(args, fmt);
 	fprintf(stderr, "[%d] ", level);
-	ret = vfprintf(stderr, fmt, args);
-	va_end(args);
-	return ret;
+	return vfprintf(stderr, fmt, args);
 }
 
 #define EXIT_FAIL_LIBBPF EXIT_FAILURE
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 55d05102e7bfb15d10d2153078cf74938c17bd54..c52bd90fbb344b0e573effe0cf73936551e2f8e5 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -1785,18 +1785,12 @@ static void test_task_fd_query_tp(void)
 }
 
 static int libbpf_debug_print(enum libbpf_print_level level,
-			      const char *format, ...)
+			      const char *format, va_list args)
 {
-	va_list args;
-	int ret;
-
 	if (level == LIBBPF_DEBUG)
 		return 0;
 
-	va_start(args, format);
-	ret = vfprintf(stderr, format, args);
-	va_end(args);
-	return ret;
+	return vfprintf(stderr, format, args);
 }
 
 static void test_reference_tracking()