[PATCH] Fix up 'make versioncheck' issues

Jesper Juhl posted 1 patch 3 months, 3 weeks ago
samples/bpf/spintest.bpf.c                                | 1 -
tools/lib/bpf/bpf_helpers.h                               | 2 ++
tools/testing/selftests/bpf/progs/dev_cgroup.c            | 1 -
tools/testing/selftests/bpf/progs/netcnt_prog.c           | 2 --
tools/testing/selftests/bpf/progs/test_map_lock.c         | 1 -
tools/testing/selftests/bpf/progs/test_send_signal_kern.c | 1 -
tools/testing/selftests/bpf/progs/test_spin_lock.c        | 1 -
tools/testing/selftests/bpf/progs/test_tcp_estats.c       | 1 -
tools/testing/selftests/wireguard/qemu/init.c             | 1 -
9 files changed, 2 insertions(+), 9 deletions(-)
[PATCH] Fix up 'make versioncheck' issues
Posted by Jesper Juhl 3 months, 3 weeks ago
From d2e411b4cd37b1936a30d130e2b21e37e62e0cfb Mon Sep 17 00:00:00 2001
From: Jesper Juhl <jesperjuhl76@gmail.com>
Date: Tue, 21 Oct 2025 03:51:21 +0200
Subject: [PATCH] [PATCH] Fix up 'make versioncheck' issues

'make versioncheck' currently flags a few files that don't need to
needs it but doesn't include it. This patch fixes that up.

Signed-Off-By: Jesper Juhl <jesperjuhl76@gmail.com>
---
samples/bpf/spintest.bpf.c                                | 1 -
tools/lib/bpf/bpf_helpers.h                               | 2 ++
tools/testing/selftests/bpf/progs/dev_cgroup.c            | 1 -
tools/testing/selftests/bpf/progs/netcnt_prog.c           | 2 --
tools/testing/selftests/bpf/progs/test_map_lock.c         | 1 -
tools/testing/selftests/bpf/progs/test_send_signal_kern.c | 1 -
tools/testing/selftests/bpf/progs/test_spin_lock.c        | 1 -
tools/testing/selftests/bpf/progs/test_tcp_estats.c       | 1 -
tools/testing/selftests/wireguard/qemu/init.c             | 1 -
9 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/samples/bpf/spintest.bpf.c b/samples/bpf/spintest.bpf.c
index cba5a9d507831..6278f6d0b731f 100644
--- a/samples/bpf/spintest.bpf.c
+++ b/samples/bpf/spintest.bpf.c
@@ -5,7 +5,6 @@
 * License as published by the Free Software Foundation.
 */
#include "vmlinux.h"
-#include <linux/version.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>

diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h
index 80c0285406561..393ce1063a977 100644
--- a/tools/lib/bpf/bpf_helpers.h
+++ b/tools/lib/bpf/bpf_helpers.h
@@ -2,6 +2,8 @@
#ifndef __BPF_HELPERS__
#define __BPF_HELPERS__

+#include <linux/version.h>
+
/*
 * Note that bpf programs need to include either
 * vmlinux.h (auto-generated from BTF) or linux/types.h
diff --git a/tools/testing/selftests/bpf/progs/dev_cgroup.c
b/tools/testing/selftests/bpf/progs/dev_cgroup.c
index c1dfbd2b56fc9..4c4e747bf827a 100644
--- a/tools/testing/selftests/bpf/progs/dev_cgroup.c
+++ b/tools/testing/selftests/bpf/progs/dev_cgroup.c
@@ -6,7 +6,6 @@
 */

#include <linux/bpf.h>
-#include <linux/version.h>
#include <bpf/bpf_helpers.h>

SEC("cgroup/dev")
diff --git a/tools/testing/selftests/bpf/progs/netcnt_prog.c
b/tools/testing/selftests/bpf/progs/netcnt_prog.c
index f9ef8aee56f16..3cf6b7a27a34a 100644
--- a/tools/testing/selftests/bpf/progs/netcnt_prog.c
+++ b/tools/testing/selftests/bpf/progs/netcnt_prog.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/bpf.h>
-#include <linux/version.h>
-
#include <bpf/bpf_helpers.h>
#include "netcnt_common.h"

diff --git a/tools/testing/selftests/bpf/progs/test_map_lock.c
b/tools/testing/selftests/bpf/progs/test_map_lock.c
index 1c02511b73cdb..982bdbf0dba6b 100644
--- a/tools/testing/selftests/bpf/progs/test_map_lock.c
+++ b/tools/testing/selftests/bpf/progs/test_map_lock.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2019 Facebook
#include <linux/bpf.h>
-#include <linux/version.h>
#include <bpf/bpf_helpers.h>

#define VAR_NUM 16
diff --git a/tools/testing/selftests/bpf/progs/test_send_signal_kern.c
b/tools/testing/selftests/bpf/progs/test_send_signal_kern.c
index 176a355e30624..e70b191162359 100644
--- a/tools/testing/selftests/bpf/progs/test_send_signal_kern.c
+++ b/tools/testing/selftests/bpf/progs/test_send_signal_kern.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2019 Facebook
#include <vmlinux.h>
-#include <linux/version.h>
#include <bpf/bpf_helpers.h>

struct task_struct *bpf_task_from_pid(int pid) __ksym;
diff --git a/tools/testing/selftests/bpf/progs/test_spin_lock.c
b/tools/testing/selftests/bpf/progs/test_spin_lock.c
index d8d77bdffd3d2..9bcee268f828b 100644
--- a/tools/testing/selftests/bpf/progs/test_spin_lock.c
+++ b/tools/testing/selftests/bpf/progs/test_spin_lock.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2019 Facebook
#include <linux/bpf.h>
-#include <linux/version.h>
#include <bpf/bpf_helpers.h>
#include "bpf_misc.h"

diff --git a/tools/testing/selftests/bpf/progs/test_tcp_estats.c
b/tools/testing/selftests/bpf/progs/test_tcp_estats.c
index e2ae049c2f850..eb0e55ba3f284 100644
--- a/tools/testing/selftests/bpf/progs/test_tcp_estats.c
+++ b/tools/testing/selftests/bpf/progs/test_tcp_estats.c
@@ -34,7 +34,6 @@
#include <string.h>
#include <linux/bpf.h>
#include <linux/ipv6.h>
-#include <linux/version.h>
#include <sys/socket.h>
#include <bpf/bpf_helpers.h>

diff --git a/tools/testing/selftests/wireguard/qemu/init.c
b/tools/testing/selftests/wireguard/qemu/init.c
index 3e49924dd77e8..20d8d3192f75c 100644
--- a/tools/testing/selftests/wireguard/qemu/init.c
+++ b/tools/testing/selftests/wireguard/qemu/init.c
@@ -24,7 +24,6 @@
#include <sys/sysmacros.h>
#include <sys/random.h>
#include <linux/random.h>
-#include <linux/version.h>

__attribute__((noreturn)) static void poweroff(void)
{
--
2.51.1
Re: [PATCH] Fix up 'make versioncheck' issues
Posted by Andrii Nakryiko 3 months, 3 weeks ago
On Mon, Oct 20, 2025 at 7:09 PM Jesper Juhl <jesperjuhl76@gmail.com> wrote:
>
> From d2e411b4cd37b1936a30d130e2b21e37e62e0cfb Mon Sep 17 00:00:00 2001
> From: Jesper Juhl <jesperjuhl76@gmail.com>
> Date: Tue, 21 Oct 2025 03:51:21 +0200
> Subject: [PATCH] [PATCH] Fix up 'make versioncheck' issues
>
> 'make versioncheck' currently flags a few files that don't need to
> needs it but doesn't include it. This patch fixes that up.
>
> Signed-Off-By: Jesper Juhl <jesperjuhl76@gmail.com>
> ---
> samples/bpf/spintest.bpf.c                                | 1 -
> tools/lib/bpf/bpf_helpers.h                               | 2 ++
> tools/testing/selftests/bpf/progs/dev_cgroup.c            | 1 -
> tools/testing/selftests/bpf/progs/netcnt_prog.c           | 2 --
> tools/testing/selftests/bpf/progs/test_map_lock.c         | 1 -
> tools/testing/selftests/bpf/progs/test_send_signal_kern.c | 1 -
> tools/testing/selftests/bpf/progs/test_spin_lock.c        | 1 -
> tools/testing/selftests/bpf/progs/test_tcp_estats.c       | 1 -
> tools/testing/selftests/wireguard/qemu/init.c             | 1 -
> 9 files changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/samples/bpf/spintest.bpf.c b/samples/bpf/spintest.bpf.c
> index cba5a9d507831..6278f6d0b731f 100644
> --- a/samples/bpf/spintest.bpf.c
> +++ b/samples/bpf/spintest.bpf.c
> @@ -5,7 +5,6 @@
>  * License as published by the Free Software Foundation.
>  */
> #include "vmlinux.h"
> -#include <linux/version.h>
> #include <bpf/bpf_helpers.h>
> #include <bpf/bpf_tracing.h>
>
> diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h
> index 80c0285406561..393ce1063a977 100644
> --- a/tools/lib/bpf/bpf_helpers.h
> +++ b/tools/lib/bpf/bpf_helpers.h
> @@ -2,6 +2,8 @@
> #ifndef __BPF_HELPERS__
> #define __BPF_HELPERS__
>
> +#include <linux/version.h>
> +

this is libbpf's public API header, we are not adding linux/version.h
here. Linux version on which something was built has nothing to do
with the version of Linux on which the BPF program is actually
running. And BPF programs are most of the time intentionally Linux
version-agnostic.

[...]