From adf61181fc3f27bc0abcc86880cb00bd63be6ebe Mon Sep 17 00:00:00 2001 From: Thiago Marques Date: Mon, 19 Oct 2026 00:11:20 +0000 Subject: [PATCH 1/6] rhel10_disk: Add support for latest RHEL family disks --- .github/workflows/build.yml | 28 ++++++++++- .github/workflows/release.yml | 5 +- Dockerfile.glibc.centos10 | 47 +++++++++++++++++++ Dockerfile.musl.centos10 | 34 ++++++++++++++ Dockerfile.static.centos10 | 34 ++++++++++++++ Makefile | 2 +- gotests/main.go | 27 ++++++++++- gotests/main_test.go | 39 +++++++++++++++ kernel-patches/6.12.0-124.8.1.el10_1/.gitkeep | 0 kernel/Makefile | 12 ++++- kernel/rename_binaries.sh | 5 +- tests/tester_user.c | 33 +++++++++++-- 12 files changed, 254 insertions(+), 12 deletions(-) create mode 100644 Dockerfile.glibc.centos10 create mode 100644 Dockerfile.musl.centos10 create mode 100644 Dockerfile.static.centos10 create mode 100644 kernel-patches/6.12.0-124.8.1.el10_1/.gitkeep diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5dc3e371..6c583d5e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,7 @@ jobs: kernel_version: - '7.2.8' - '6.16.2' + - '6.12.0' - '6.8.2' - '5.16.18' - '5.17.15' @@ -48,7 +49,9 @@ jobs: fetch-depth: 0 - name: Run build.sh run: | - if [ ${{ matrix.kernel_version }} = "5.14.0" ]; then + if [ ${{ matrix.kernel_version }} = "6.12.0" ]; then + os=centos10 + elif [ ${{ matrix.kernel_version }} = "5.14.0" ]; then os=centos9 elif [ ${{ matrix.kernel_version }} = "5.4.17" ]; then os=oracle8 @@ -62,6 +65,29 @@ jobs: run: | ls -lah artifacts test -f artifacts/netdata_ebpf-*.tar + if [ "${{ matrix.kernel_version }}" = "6.12.0" ]; then + artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.12.rhf-*.tar' -print -quit) + test -n "$artifact" + tar -tf "$artifact" > artifact.list + base_apps=(btrfs cachestat dc disk ext4 fd fdatasync fsync dns hardirq mdflush mount msync network_viewer nfs oomkill process shm socket softirq sync syncfs sync_file_range swap vfs xfs zfs) + ringbuf_apps=(cachestat dc dns fd socket oomkill process shm swap vfs) + arena_apps=(cachestat dc dns fd socket oomkill process shm swap vfs) + for app in "${base_apps[@]}"; do + for prefix in p r; do + grep -Fxq "${prefix}netdata_ebpf_${app}.6.12.rhf.o" artifact.list + done + done + for app in "${ringbuf_apps[@]}"; do + for prefix in p r; do + grep -Fxq "${prefix}netdata_ebpf_${app}_buffer.6.12.rhf.o" artifact.list + done + done + for app in "${arena_apps[@]}"; do + for prefix in p r; do + grep -Fxq "${prefix}netdata_ebpf_${app}_arena.6.12.rhf.o" artifact.list + done + done + fi - name: Upload Artifacts uses: actions/upload-artifact@v6 if: success() diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 872d29b5..b6cd063b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,7 @@ jobs: kernel_version: - '7.2.8' - '6.16.2' + - '6.12.0' - '6.8.2' - '5.16.18' - '5.17.15' @@ -49,7 +50,9 @@ jobs: run: git lfs checkout - name: Run build.sh run: | - if [ ${{ matrix.kernel_version }} = "5.14.0" ]; then + if [ ${{ matrix.kernel_version }} = "6.12.0" ]; then + os=centos10 + elif [ ${{ matrix.kernel_version }} = "5.14.0" ]; then os=centos9 elif [ ${{ matrix.kernel_version }} = "5.4.17" ]; then os=oracle8 diff --git a/Dockerfile.glibc.centos10 b/Dockerfile.glibc.centos10 new file mode 100644 index 00000000..85d11d56 --- /dev/null +++ b/Dockerfile.glibc.centos10 @@ -0,0 +1,47 @@ +FROM almalinux:10 AS build + +ARG ARCH=x86 +ENV ARCH=$ARCH + +ENV KERNEL_VERSION=6.12.0-124.8.1.el10_1 + +ENV RHF=.rhf + +ENV _LIBC=glibc + +# We use "Development tools" to install: +# gcc c/c++ compiler, redhat-rpm-config, strace, rpm-build, make, pkgconfig, gettext, automake, strace64, gdb, bison, +# libtool, autoconf, gcc-c++ compiler, binutils and all dependencies + +# hadolint ignore=DL3040,DL3041 +RUN dnf update -y && \ + dnf install -y gcc make gcc-c++ libtool rpm-build-libs bison git && \ + dnf install -y asciidoc audit-libs-devel bash bc binutils binutils-devel \ + diffutils elfutils elfutils-devel \ + elfutils-libelf-devel findutils gawk \ + gzip hmaccalc hostname java-devel m4 \ + module-init-tools ncurses-devel net-tools newt-devel \ + numactl-devel openssl openssl-devel patch pciutils-devel \ + perl perl-ExtUtils-Embed pesign \ + rpm-build rsync tar xmlto xz zlib-devel clang llvm + +RUN mkdir -p /root/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} && \ + echo '%_topdir %(echo $HOME)/rpmbuild' > /root/.rpmmacros && \ + rpm -i https://repo.almalinux.org/vault/10.1/BaseOS/Source/Packages/kernel-${KERNEL_VERSION}.src.rpm 2>&1 + +RUN tar -xf /root/rpmbuild/SOURCES/linux-${KERNEL_VERSION}.tar.xz -C /root/rpmbuild/SOURCES && \ + mkdir -p /usr/src/kernels + +RUN ln -s /root/rpmbuild/SOURCES/linux-${KERNEL_VERSION} /usr/src/linux && \ + ln -s /usr/lib/gcc/x86_64-redhat-linux/14/include/stdarg.h /usr/src/linux/include/ + +COPY kernel-patches/${KERNEL_VERSION} /usr/src/linux-${KERNEL_VERSION}-patches +COPY .dockerfiles/patch_kernel.sh /patch_kernel.sh +RUN /patch_kernel.sh + +WORKDIR /kernel-collector + +COPY .dockerfiles/build.sh /build.sh +COPY . . + +CMD ["/build.sh"] diff --git a/Dockerfile.musl.centos10 b/Dockerfile.musl.centos10 new file mode 100644 index 00000000..4ddf6a0e --- /dev/null +++ b/Dockerfile.musl.centos10 @@ -0,0 +1,34 @@ +FROM alpine:3.24 AS build + +ARG ARCH=x86 +ENV ARCH=$ARCH + +ARG LOCAL_KERNEL_VERSION=6.12.0-124.8.1.el10_1 + +ENV RHF=.rhf + +ENV _LIBC=musl + +# hadolint ignore=DL3018 +RUN apk add --no-cache -U build-base autoconf automake coreutils pkgconfig \ + bc elfutils-dev openssl-dev clang clang-dev llvm \ + rsync bison flex tar xz bash git rpm ssl_client linux-headers + +# hadolint ignore=DL3003,SC3009 +RUN mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} && \ + echo "%_topdir %(echo $HOME)/rpmbuild" > ~/.rpmmacros && \ + wget -q https://repo.almalinux.org/vault/10.1/BaseOS/Source/Packages/kernel-${LOCAL_KERNEL_VERSION}.src.rpm && \ + rpm -i kernel-${LOCAL_KERNEL_VERSION}.src.rpm && \ + cd ~/rpmbuild/SOURCES && \ + tar -xf linux-${LOCAL_KERNEL_VERSION}.tar.xz && \ + mkdir -p /usr/src/kernels && \ + cd /usr/src && \ + ln -s ~/rpmbuild/SOURCES/linux-${LOCAL_KERNEL_VERSION} linux && \ + ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/15.2.0/include/stdarg.h /usr/src/linux/include/ + +WORKDIR /kernel-collector + +COPY .dockerfiles/build.sh /build.sh +COPY . . + +CMD ["/build.sh"] diff --git a/Dockerfile.static.centos10 b/Dockerfile.static.centos10 new file mode 100644 index 00000000..07d03a6a --- /dev/null +++ b/Dockerfile.static.centos10 @@ -0,0 +1,34 @@ +FROM alpine:3.24 AS build + +ARG ARCH=x86 +ENV ARCH=$ARCH + +ARG LOCAL_KERNEL_VERSION=6.12.0-124.8.1.el10_1 + +ENV RHF=.rhf + +ENV _LIBC=static + +# hadolint ignore=DL3018 +RUN apk add --no-cache -U build-base autoconf automake coreutils pkgconfig \ + bc elfutils-dev openssl-dev clang clang-dev llvm \ + rsync bison flex tar xz bash git rpm ssl_client linux-headers + +# hadolint ignore=DL3003,SC3009 +RUN mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} && \ + echo "%_topdir %(echo $HOME)/rpmbuild" > ~/.rpmmacros && \ + wget -q https://repo.almalinux.org/vault/10.1/BaseOS/Source/Packages/kernel-${LOCAL_KERNEL_VERSION}.src.rpm && \ + rpm -i kernel-${LOCAL_KERNEL_VERSION}.src.rpm && \ + cd ~/rpmbuild/SOURCES && \ + tar -xf linux-${LOCAL_KERNEL_VERSION}.tar.xz && \ + mkdir -p /usr/src/kernels && \ + cd /usr/src && \ + ln -s ~/rpmbuild/SOURCES/linux-${LOCAL_KERNEL_VERSION} linux && \ + ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/15.2.0/include/stdarg.h /usr/src/linux/include/ + +WORKDIR /kernel-collector + +COPY .dockerfiles/build.sh /build.sh +COPY . . + +CMD ["/build.sh"] diff --git a/Makefile b/Makefile index 2870ddb8..bbd8ec90 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ KERNEL_PROGRAM = $(KERNEL_DIR)process_kern.o KERNEL_VERSION="$(shell if [ -f /usr/src/linux/include/config/kernel.release ]; then cat /usr/src/linux/include/config/kernel.release; else cat /proc/sys/kernel/osrelease; fi)" FIRST_KERNEL_VERSION=$(shell tools/complement.sh "$(KERNEL_VERSION)") -RHF=$(shell if [ -f /etc/redhat-release ]; then printf ".rhf"; else printf ''; fi) +RHF ?= $(shell if [ -f /etc/redhat-release ]; then printf ".rhf"; else printf ''; fi) NETDATA_KERNEL_VERSION=$(shell echo $(KERNEL_VERSION) | tr -s "." "_") diff --git a/gotests/main.go b/gotests/main.go index cedd6fba..5a465126 100644 --- a/gotests/main.go +++ b/gotests/main.go @@ -462,7 +462,7 @@ func getRedHatRelease() int { return parseOSRelease(string(data)) } -// parseOSRelease detects RH-family distros by exact ID or ID_LIKE tokens, then +// parseOSRelease detects the explicitly supported RH-family IDs, then // parses VERSION_ID to return major*256+minor. Returns -1 on no match. func parseOSRelease(content string) int { major := 0 @@ -475,7 +475,7 @@ func parseOSRelease(content string) int { continue } switch key { - case "ID", "ID_LIKE": + case "ID": for _, id := range strings.Fields(strings.Trim(val, "\"'")) { if isRHELFamilyID(id) { isRHEL = true @@ -1209,7 +1209,14 @@ func runNetdataTests(w io.Writer, rhfVersion int, kernelVersion int, isReturn bo } else if bufferMode && mod.bufferKernels != 0 { kernels = mod.bufferKernels } + if isRHEL10Kernel612Stream(rhfVersion, kernelVersion) { + kernels |= netdataV612 + } maxIndex := selectModuleMaxIndex(mod.name, rhfVersion, kernelVersion) + if maxIndex == ^uint32(0) { + skippedModules = appendUnique(skippedModules, skippedModule{Module: mod.name, Reason: "legacy disk unsupported for this Red Hat kernel"}) + continue + } idx := selectIndexFromMax(kernels, rhfVersion, maxIndex) candidates := discoverCandidates(mod.name, isReturn, rhfVersion, kernels, maxIndex, opts.netdataPath, bufferMode, arenaMode) compatible, incompatible, unsupportedType := filterCompatibleCandidates(candidates, supportedMapTypes) @@ -1261,6 +1268,15 @@ func appendUnique(values []skippedModule, value skippedModule) []skippedModule { } func selectModuleMaxIndex(moduleName string, rhfVersion int, kernelVersion int) uint32 { + if moduleName == "disk" && rhfVersion > 0 && kernelVersion >= netdataEBPFKernel517 { + if isRHEL10Kernel612Stream(rhfVersion, kernelVersion) { + return 11 + } + return ^uint32(0) // No supported Red Hat legacy disk object in this kernel range. + } + if isRHEL10Kernel612Stream(rhfVersion, kernelVersion) { + return 11 + } if moduleName == "disk" && rhfVersion <= 0 { switch { case kernelVersion >= netdataEBPFKernel68: @@ -1277,9 +1293,16 @@ func selectModuleMaxIndex(moduleName string, rhfVersion int, kernelVersion int) return selectMaxIndex(rhfVersion, kernelVersion) } +func isRHEL10Kernel612Stream(rhfVersion int, kernelVersion int) bool { + return rhfVersion >= 10*256 && rhfVersion < 11*256 && + kernelVersion >= netdataEBPFKernel612 && kernelVersion < 6*65536+13*256 +} + func selectMaxIndex(rhfVersion int, kernelVersion int) uint32 { if rhfVersion > 0 { switch { + case isRHEL10Kernel612Stream(rhfVersion, kernelVersion): + return 11 case kernelVersion >= netdataEBPFKernel514: return 7 case kernelVersion >= netdataEBPFKernel54: diff --git a/gotests/main_test.go b/gotests/main_test.go index dab8ce58..abd66bcc 100644 --- a/gotests/main_test.go +++ b/gotests/main_test.go @@ -148,6 +148,14 @@ VERSION_ID="9.3" `, want: 9*256 + 3, }, + { + name: "amazon linux ancestry ignored", + content: `ID="amzn" +ID_LIKE="centos rhel fedora" +VERSION_ID="2" +`, + want: -1, + }, { name: "debian ignored", content: `NAME="Debian GNU/Linux" @@ -163,6 +171,37 @@ VERSION_ID="12" }, } + for _, module := range []string{"disk", "oomkill", "socket", "swap"} { + if got := selectModuleMaxIndex(module, 10*256, netdataEBPFKernel612); got != 11 { + t.Fatalf("RHEL 10 %s selector = %d, want 11 (6.12)", module, got) + } + } + if got := selectModuleMaxIndex("socket", 11*256, netdataEBPFKernel612); got == 11 { + t.Fatalf("RHEL 11 socket selector = %d, must not use the RHEL 10 6.12 rung", got) + } + diskSelectionCases := []struct { + name string + rhf int + kernel int + want uint32 + }{ + {name: "pre-5.17 legacy supported", rhf: 9 * 256, kernel: netdataEBPFKernel517 - 1, want: 7}, + {name: "RHEL 9 5.17 rejected", rhf: 9 * 256, kernel: netdataEBPFKernel517, want: ^uint32(0)}, + {name: "RHEL 10 6.11 rejected", rhf: 10 * 256, kernel: netdataEBPFKernel612 - 1, want: ^uint32(0)}, + {name: "RHEL 10 6.12 supported", rhf: 10 * 256, kernel: netdataEBPFKernel612, want: 11}, + {name: "RHEL 10 6.12 patch supported", rhf: 10 * 256, kernel: netdataEBPFKernel612 + 3, want: 11}, + {name: "RHEL 10 6.13 rejected", rhf: 10 * 256, kernel: netdataEBPFKernel612 + 256, want: ^uint32(0)}, + {name: "RHEL 10 6.15 rejected", rhf: 10 * 256, kernel: netdataEBPFKernel612 + 3*256, want: ^uint32(0)}, + {name: "RHEL 10 6.16 rejected", rhf: 10 * 256, kernel: netdataEBPFKernel616, want: ^uint32(0)}, + {name: "RHEL 11 6.12 rejected", rhf: 11 * 256, kernel: netdataEBPFKernel612, want: ^uint32(0)}, + } + for _, tc := range diskSelectionCases { + t.Run("disk selector "+tc.name, func(t *testing.T) { + if got := selectModuleMaxIndex("disk", tc.rhf, tc.kernel); got != tc.want { + t.Fatalf("disk selector = %d, want %d", got, tc.want) + } + }) + } for _, tc := range osReleaseCases { t.Run("os-release "+tc.name, func(t *testing.T) { if got := parseOSRelease(tc.content); got != tc.want { diff --git a/kernel-patches/6.12.0-124.8.1.el10_1/.gitkeep b/kernel-patches/6.12.0-124.8.1.el10_1/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/kernel/Makefile b/kernel/Makefile index ed1be3a8..90ccd1c6 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -107,6 +107,16 @@ NETDATA_APPS= swap \ process \ # +# The Red Hat 10 6.12 build supplies the complete legacy object family as well as +# the buffer and arena variants below; other 6.12 builds retain the smaller set. +else ifeq ($(VER_MAJOR).$(VER_MINOR),6.12) +ifneq ($(strip $(RHF)),) +NETDATA_APPS= ${NETDATA_ALL_APPS} +else +NETDATA_APPS= swap \ + disk \ + # +endif # Kernel newer than 6.8.0 ( 395264 = 6 * 65536 + 8 * 256) else ifeq ($(shell test $(CURRENT_KERNEL) -ge 395264 ; echo $$?),0) NETDATA_APPS= swap \ @@ -263,7 +273,7 @@ endif -include ../includes/netdata_asm_goto.h \ -O2 -g -emit-llvm $< -o $(<:.c=.ll) $(LLC) -march=bpf -filetype=obj -o p$@ $(<:.c=.ll) - /bin/bash rename_binaries.sh "$(VER_MAJOR)" "$(VER_MINOR)" "$@" + /bin/bash rename_binaries.sh "$(VER_MAJOR)" "$(VER_MINOR)" "$@" "$(RHF)" ifeq ($(VER_MAJOR).$(VER_MINOR),3.10) ifeq ($(LEGACY_LIBBPF_ACTIVE),1) diff --git a/kernel/rename_binaries.sh b/kernel/rename_binaries.sh index d97ee05c..bdf26bdf 100644 --- a/kernel/rename_binaries.sh +++ b/kernel/rename_binaries.sh @@ -14,6 +14,7 @@ parse_kernel_version() { } select_kernel_version() { + FORCE_RHF="${3:-}" VER6_12_0="006012" VER7_0_0="007000" VER6_8_0="006008" @@ -65,7 +66,7 @@ select_kernel_version() { exit 1 fi - if [ -f /etc/redhat-release ]; then + if [ -f /etc/redhat-release ] || [ "${FORCE_RHF}" = ".rhf" ]; then ISRH=".rhf" fi @@ -76,7 +77,7 @@ OBJECTNAME="$3" NAME=${OBJECTNAME%_*} KVER=$(parse_kernel_version "$1" "$2") -KNAME=$(select_kernel_version "${1}" "${2}") +KNAME=$(select_kernel_version "${1}" "${2}" "${RHF:-}") # Disk request layout changed in 5.17. Keep other objects on the existing # 5.16 suffix; the disk selector is updated independently in the agent. diff --git a/tests/tester_user.c b/tests/tester_user.c index 2595df9a..7a314e6b 100644 --- a/tests/tester_user.c +++ b/tests/tester_user.c @@ -1017,7 +1017,7 @@ static int ebpf_get_rh_from_os_release(void) int major = 0, minor = 0, is_rhel = 0; while (fgets(line, sizeof(line), fp)) { - if (strncmp(line, "ID=", 3) == 0 || strncmp(line, "ID_LIKE=", 8) == 0) { + if (strncmp(line, "ID=", 3) == 0) { const char *value = strchr(line, '=') + 1; if (ebpf_has_redhat_family_id(value)) is_rhel = 1; @@ -1129,6 +1129,12 @@ static char *ebpf_select_kernel_name(uint32_t selector) return ebpf_kernel_names[selector]; } +static int ebpf_is_rhel10_6_12_stream(int rhf_version, uint32_t kver) +{ + return rhf_version >= 10 * 256 && rhf_version < 11 * 256 && kver >= NETDATA_EBPF_KERNEL_6_12 && + kver < NETDATA_EBPF_KERNEL_6_12 + 256; +} + /** * Select Max Index * @@ -1142,6 +1148,8 @@ static char *ebpf_select_kernel_name(uint32_t selector) static int ebpf_select_max_index(int rhf_version, uint32_t kver) { if (rhf_version > 0) { // Red Hat family + if (ebpf_is_rhel10_6_12_stream(rhf_version, kver)) + return 12; if (kver >= NETDATA_EBPF_KERNEL_5_14) return 7; else if (kver >= NETDATA_EBPF_KERNEL_5_4) @@ -1201,6 +1209,16 @@ static uint32_t ebpf_select_index(uint32_t kernels, int rhf_version, uint32_t kv return idx; } +static uint32_t ebpf_select_disk_index(uint32_t kernels, int rhf_version, uint32_t kver) +{ + if (rhf_version > 0 && kver >= NETDATA_EBPF_KERNEL_5_17) { + if (ebpf_is_rhel10_6_12_stream(rhf_version, kver)) + return 12; + return UINT32_MAX; // No supported Red Hat legacy disk object in this kernel range. + } + return ebpf_select_index(kernels, rhf_version, kver); +} + /**************************************************************************************************** * * TESTS @@ -2367,8 +2385,10 @@ static void ebpf_run_netdata_tests(int rhf_version, uint32_t kver, int is_return ebpf_detect_map_support(&map_support, rhf_version, kver); while (ebpf_modules[i].name) { - if (!strcmp(ebpf_modules[i].name, "disk") && rhf_version <= 0 && - kver >= NETDATA_EBPF_KERNEL_6_16) { + if (!strcmp(ebpf_modules[i].name, "disk") && + ((rhf_version <= 0 && kver >= NETDATA_EBPF_KERNEL_6_16) || + (rhf_version > 0 && kver >= NETDATA_EBPF_KERNEL_5_17 && + !ebpf_is_rhel10_6_12_stream(rhf_version, kver)))) { i++; continue; } @@ -2411,8 +2431,13 @@ static void ebpf_run_netdata_tests(int rhf_version, uint32_t kver, int is_return ebpf_modules[i].arena_kernels : ((use_buffer_mode && ebpf_modules[i].buffer_kernels) ? ebpf_modules[i].buffer_kernels : ebpf_modules[i].kernels); + int rhel10 = ebpf_is_rhel10_6_12_stream(rhf_version, kver); + if (rhel10) + kernels_to_use |= NETDATA_V6_12; uint32_t max_idx = ebpf_select_max_index(rhf_version, kver); - uint32_t idx = ebpf_select_index(kernels_to_use, rhf_version, kver); + uint32_t idx = !strcmp(ebpf_modules[i].name, "disk") + ? ebpf_select_disk_index(kernels_to_use, rhf_version, kver) + : ebpf_select_index(kernels_to_use, rhf_version, kver); ebpf_discover_candidates(&candidates, ebpf_modules[i].name, is_return, kernels_to_use, max_idx, rhf_version, use_buffer_mode, use_arena_mode); From 453769d1c44da0a33e11eca4a224f6676696a2f3 Mon Sep 17 00:00:00 2001 From: Thiago Marques Date: Mon, 19 Oct 2026 00:52:50 +0000 Subject: [PATCH 2/6] rhel10_disk: Adjust github CI --- .github/workflows/build.yml | 20 +------------------- .github/workflows/release.yml | 5 +++++ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c583d5e..6cb524dd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,25 +68,7 @@ jobs: if [ "${{ matrix.kernel_version }}" = "6.12.0" ]; then artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.12.rhf-*.tar' -print -quit) test -n "$artifact" - tar -tf "$artifact" > artifact.list - base_apps=(btrfs cachestat dc disk ext4 fd fdatasync fsync dns hardirq mdflush mount msync network_viewer nfs oomkill process shm socket softirq sync syncfs sync_file_range swap vfs xfs zfs) - ringbuf_apps=(cachestat dc dns fd socket oomkill process shm swap vfs) - arena_apps=(cachestat dc dns fd socket oomkill process shm swap vfs) - for app in "${base_apps[@]}"; do - for prefix in p r; do - grep -Fxq "${prefix}netdata_ebpf_${app}.6.12.rhf.o" artifact.list - done - done - for app in "${ringbuf_apps[@]}"; do - for prefix in p r; do - grep -Fxq "${prefix}netdata_ebpf_${app}_buffer.6.12.rhf.o" artifact.list - done - done - for app in "${arena_apps[@]}"; do - for prefix in p r; do - grep -Fxq "${prefix}netdata_ebpf_${app}_arena.6.12.rhf.o" artifact.list - done - done + .github/scripts/verify-rhf-artifact.sh "$artifact" fi - name: Upload Artifacts uses: actions/upload-artifact@v6 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b6cd063b..09bb5ed4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -66,6 +66,11 @@ jobs: run: | ls -lah artifacts test -f artifacts/netdata_ebpf-*.tar + if [ "${{ matrix.kernel_version }}" = "6.12.0" ]; then + artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.12.rhf-*.tar' -print -quit) + test -n "$artifact" + .github/scripts/verify-rhf-artifact.sh "$artifact" + fi - name: Upload Artifacts uses: actions/upload-artifact@v6 if: success() From 856e2498aac0b6ef72c2a44490acd23e623d3db7 Mon Sep 17 00:00:00 2001 From: Thiago Marques Date: Mon, 19 Oct 2026 10:16:50 +0000 Subject: [PATCH 3/6] Add RHF artifact verification helper --- .github/scripts/verify-rhf-artifact.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 .github/scripts/verify-rhf-artifact.sh diff --git a/.github/scripts/verify-rhf-artifact.sh b/.github/scripts/verify-rhf-artifact.sh new file mode 100755 index 00000000..66122a6d --- /dev/null +++ b/.github/scripts/verify-rhf-artifact.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -euo pipefail + +repo_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd) +archive=${1:?usage: verify-rhf-artifact.sh <6.12.rhf archive>} +[[ -f "$archive" ]] || { printf 'artifact not found: %s\n' "$archive" >&2; exit 1; } + +inventory=$(make -s -C "$repo_root/kernel" \ + --eval='print-ebpf-inventory:;@printf "%s\\n%s\\n%s\\n" "$(NETDATA_APPS)" "$(NETDATA_RINGBUF_APPS)" "$(NETDATA_ARENA_APPS)"' \ + print-ebpf-inventory KERNEL_VERSION=6.12.0 RHF=.rhf) +mapfile -t app_families <<< "$inventory" +((${#app_families[@]} == 3)) || { printf 'could not read expected object families from kernel/Makefile\n' >&2; exit 1; } + +archive_list=$(tar -tf "$archive") +for family in "${app_families[@]}"; do + read -r -a apps <<< "$family" + for app in "${apps[@]}"; do + for prefix in p r; do + object="${prefix}netdata_ebpf_${app}.6.12.rhf.o" + grep -Fxq "$object" <<< "$archive_list" || { printf 'missing object: %s\n' "$object" >&2; exit 1; } + done + done +done From ca59bc02bc2dda50fc41b1112384e895c3977b39 Mon Sep 17 00:00:00 2001 From: Thiago Marques Date: Mon, 19 Oct 2026 23:45:51 +0000 Subject: [PATCH 4/6] rhel10_disk: Fix issues in RH family --- .github/scripts/verify-rhf-artifact.sh | 10 ++++- .github/workflows/build.yml | 28 ++++++++++++ .github/workflows/release.yml | 61 ++++++++++++++++++++++--- Dockerfile.glibc.generic | 7 +-- Dockerfile.musl.centos8 | 2 +- Dockerfile.musl.centos9 | 2 +- Dockerfile.musl.generic | 7 +-- Dockerfile.musl.oracle8 | 2 +- Dockerfile.static.generic | 7 +-- gotests/main.go | 53 +++++++++++++++++++--- gotests/main_test.go | 32 +++++++++++++ kernel-patches/6.12.0/.gitkeep | 0 kernel/Makefile | 21 +++++---- kernel/rename_binaries.sh | 13 +++--- tests/tester_user.c | 62 +++++++++++++++++++++++--- 15 files changed, 253 insertions(+), 54 deletions(-) create mode 100644 kernel-patches/6.12.0/.gitkeep diff --git a/.github/scripts/verify-rhf-artifact.sh b/.github/scripts/verify-rhf-artifact.sh index 66122a6d..4dbb1ca6 100755 --- a/.github/scripts/verify-rhf-artifact.sh +++ b/.github/scripts/verify-rhf-artifact.sh @@ -3,11 +3,17 @@ set -euo pipefail repo_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd) archive=${1:?usage: verify-rhf-artifact.sh <6.12.rhf archive>} +family=${2:-rhf} [[ -f "$archive" ]] || { printf 'artifact not found: %s\n' "$archive" >&2; exit 1; } +case "$family" in + rhf) rhf_suffix='.rhf'; make_rhf='.rhf' ;; + generic) rhf_suffix=''; make_rhf='' ;; + *) printf 'unknown artifact family: %s\n' "$family" >&2; exit 1 ;; +esac inventory=$(make -s -C "$repo_root/kernel" \ --eval='print-ebpf-inventory:;@printf "%s\\n%s\\n%s\\n" "$(NETDATA_APPS)" "$(NETDATA_RINGBUF_APPS)" "$(NETDATA_ARENA_APPS)"' \ - print-ebpf-inventory KERNEL_VERSION=6.12.0 RHF=.rhf) + print-ebpf-inventory KERNEL_VERSION=6.12.0 RHF="$make_rhf") mapfile -t app_families <<< "$inventory" ((${#app_families[@]} == 3)) || { printf 'could not read expected object families from kernel/Makefile\n' >&2; exit 1; } @@ -16,7 +22,7 @@ for family in "${app_families[@]}"; do read -r -a apps <<< "$family" for app in "${apps[@]}"; do for prefix in p r; do - object="${prefix}netdata_ebpf_${app}.6.12.rhf.o" + object="${prefix}netdata_ebpf_${app}.6.12${rhf_suffix}.o" grep -Fxq "$object" <<< "$archive_list" || { printf 'missing object: %s\n' "$object" >&2; exit 1; } done done diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6cb524dd..93b47225 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,3 +76,31 @@ jobs: with: name: artifacts-${{ matrix.kernel_version }}-${{ matrix.libc }} path: artifacts + + build-generic-612: + name: Build generic 6.12 artifacts + strategy: + fail-fast: false + matrix: + libc: [static, glibc, musl] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + submodules: true + fetch-depth: 0 + - name: Build generic 6.12 objects + run: ./build.sh 6.12.0 "${{ matrix.libc }}" generic + - name: Verify generic artifact + run: | + ls -lah artifacts + artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.12-*.tar' -print -quit) + test -n "$artifact" + .github/scripts/verify-rhf-artifact.sh "$artifact" generic + - name: Upload generic artifacts + uses: actions/upload-artifact@v6 + if: success() + with: + name: artifacts-6.12.0-generic-${{ matrix.libc }} + path: artifacts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 09bb5ed4..455ab670 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,6 +48,14 @@ jobs: lfs: true - name: Checkout LFS objects run: git lfs checkout + - name: Verify stored 3.10 BPF objects + run: | + for object in CentOS7/*.o; do + readelf -h "$object" | grep -Eq 'Machine:.*Linux BPF' || { + echo "invalid or missing BPF ELF payload: $object" >&2 + exit 1 + } + done - name: Run build.sh run: | if [ ${{ matrix.kernel_version }} = "6.12.0" ]; then @@ -78,9 +86,37 @@ jobs: name: artifacts-${{ matrix.kernel_version }}-${{ matrix.libc }} path: artifacts + build-generic-612: + name: Build generic 6.12 artifacts + strategy: + fail-fast: false + matrix: + libc: [static, glibc, musl] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + submodules: true + fetch-depth: 0 + - name: Build generic 6.12 objects + run: ./build.sh 6.12.0 "${{ matrix.libc }}" generic + - name: Verify generic artifact + run: | + ls -lah artifacts + artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.12-*.tar' -print -quit) + test -n "$artifact" + .github/scripts/verify-rhf-artifact.sh "$artifact" generic + - name: Upload generic artifacts + uses: actions/upload-artifact@v6 + if: success() + with: + name: artifacts-6.12.0-generic-${{ matrix.libc }} + path: artifacts + create-release: name: Create Release - needs: build-artifacts + needs: [build-artifacts, build-generic-612] runs-on: ubuntu-latest steps: - name: Checkout @@ -96,7 +132,6 @@ jobs: with: pattern: artifacts-* path: artifacts - merge-multiple: true - name: Set release_tag run: | echo "RELEASE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV @@ -104,11 +139,23 @@ jobs: run: | mkdir -p final-artifacts for libc in static glibc musl; do - for pkg in artifacts/netdata_ebpf-*_*-${libc}.tar; do - mkdir -p "packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}" - tar -C "packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}" -xvf "${pkg}" - done - if [ "${libc}" == "glibc" ]; then cp -R CentOS7/* "packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}"; fi + package="packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}" + mkdir -p "${package}" + while IFS= read -r pkg; do + case "${pkg}" in + artifacts/artifacts-6.12.0-generic-*) continue ;; + esac + tar -C "${package}" -xvf "${pkg}" + done < <(find artifacts -mindepth 2 -maxdepth 2 -type f -name "netdata_ebpf-*_*-${libc}.tar" -print | sort) + # Generic 6.12 objects own the .6.12 suffix; unpack them last so the + # 6.16 build cannot replace the 6.12 ABI in the published package. + generic_archive=$(find "artifacts/artifacts-6.12.0-generic-${libc}" -maxdepth 1 -type f -name "netdata_ebpf-*_*-${libc}.tar" -print -quit) + test -n "${generic_archive}" + tar -C "${package}" -xvf "${generic_archive}" + while IFS= read -r object; do + cmp <(tar -xOf "${generic_archive}" "${object}") "${package}/${object}" + done < <(tar -tf "${generic_archive}" | grep -E '^[pr]netdata_ebpf_.*\.6\.12\.o$') + if [ "${libc}" == "static" ] || [ "${libc}" == "glibc" ]; then cp -R CentOS7/* "packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}"; fi tar -C "packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}" -Jcvf "final-artifacts/netdata-kernel-collector-${libc}-${RELEASE_TAG}.tar.xz" ./ done cd final-artifacts && sha256sum ./*.tar.xz > sha256sums.txt diff --git a/Dockerfile.glibc.generic b/Dockerfile.glibc.generic index ab4a4cfb..7eaf59a7 100644 --- a/Dockerfile.glibc.generic +++ b/Dockerfile.glibc.generic @@ -18,9 +18,10 @@ RUN apt-get update && \ RUN mkdir -p /usr/src && \ cd /usr/src && \ - wget -q https://cdn.kernel.org/pub/linux/kernel/v$(echo "$KERNEL_VERSION" | cut -f 1 -d '.').x/linux-${KERNEL_VERSION}.tar.xz && \ - tar -xf linux-${KERNEL_VERSION}.tar.xz && \ - ln -s linux-${KERNEL_VERSION} linux + SOURCE_KERNEL_VERSION=$(echo "$KERNEL_VERSION" | sed -E 's/\.0$//') && \ + wget -q https://cdn.kernel.org/pub/linux/kernel/v$(echo "$SOURCE_KERNEL_VERSION" | cut -f 1 -d '.').x/linux-${SOURCE_KERNEL_VERSION}.tar.xz && \ + tar -xf linux-${SOURCE_KERNEL_VERSION}.tar.xz && \ + ln -s linux-${SOURCE_KERNEL_VERSION} linux COPY kernel-patches/${KERNEL_VERSION} /usr/src/linux-${KERNEL_VERSION}-patches COPY .dockerfiles/patch_kernel.sh /patch_kernel.sh diff --git a/Dockerfile.musl.centos8 b/Dockerfile.musl.centos8 index 319c47e7..60a893f9 100644 --- a/Dockerfile.musl.centos8 +++ b/Dockerfile.musl.centos8 @@ -5,7 +5,7 @@ ENV ARCH=$ARCH ARG LOCAL_KERNEL_VERSION=4.18.0-372.16.1.el8_6 -ENV _LIBC=static +ENV _LIBC=musl # hadolint ignore=DL3018 RUN apk add --no-cache -U build-base autoconf automake coreutils pkgconfig \ diff --git a/Dockerfile.musl.centos9 b/Dockerfile.musl.centos9 index 27d2ba4a..60e87485 100644 --- a/Dockerfile.musl.centos9 +++ b/Dockerfile.musl.centos9 @@ -5,7 +5,7 @@ ENV ARCH=$ARCH ARG LOCAL_KERNEL_VERSION=5.14.0-70.17.1.el9_0 -ENV _LIBC=static +ENV _LIBC=musl # hadolint ignore=DL3018 RUN apk add --no-cache -U build-base autoconf automake coreutils pkgconfig \ diff --git a/Dockerfile.musl.generic b/Dockerfile.musl.generic index 18bd4018..67499d6c 100644 --- a/Dockerfile.musl.generic +++ b/Dockerfile.musl.generic @@ -18,9 +18,10 @@ RUN apk add --no-cache -U build-base autoconf automake coreutils pkgconfig \ # hadolint ignore=DL3003,SC3009 RUN mkdir -p /usr/src && \ cd /usr/src && \ - wget -q https://cdn.kernel.org/pub/linux/kernel/v$(echo "$KERNEL_VERSION" | cut -f 1 -d '.').x/linux-${KERNEL_VERSION}.tar.xz && \ - tar -xf linux-${KERNEL_VERSION}.tar.xz && \ - ln -s linux-${KERNEL_VERSION} linux && \ + SOURCE_KERNEL_VERSION=$(echo "$KERNEL_VERSION" | sed -E 's/\.0$//') && \ + wget -q https://cdn.kernel.org/pub/linux/kernel/v$(echo "$SOURCE_KERNEL_VERSION" | cut -f 1 -d '.').x/linux-${SOURCE_KERNEL_VERSION}.tar.xz && \ + tar -xf linux-${SOURCE_KERNEL_VERSION}.tar.xz && \ + ln -s linux-${SOURCE_KERNEL_VERSION} linux && \ ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/15.2.0/include/stdarg.h /usr/src/linux/include/ WORKDIR /kernel-collector diff --git a/Dockerfile.musl.oracle8 b/Dockerfile.musl.oracle8 index 8010ca36..e36ae51c 100644 --- a/Dockerfile.musl.oracle8 +++ b/Dockerfile.musl.oracle8 @@ -5,7 +5,7 @@ ENV ARCH=$ARCH ARG LOCAL_KERNEL_VERSION=5.4.17 -ENV _LIBC=static +ENV _LIBC=musl # hadolint ignore=DL3018 RUN apk add --no-cache -U build-base autoconf automake coreutils pkgconfig \ diff --git a/Dockerfile.static.generic b/Dockerfile.static.generic index d5a69e87..14c4123d 100644 --- a/Dockerfile.static.generic +++ b/Dockerfile.static.generic @@ -18,9 +18,10 @@ RUN apk add --no-cache -U build-base autoconf automake coreutils pkgconfig \ # hadolint ignore=DL3003,SC3009 RUN mkdir -p /usr/src && \ cd /usr/src && \ - wget -q https://cdn.kernel.org/pub/linux/kernel/v$(echo "$KERNEL_VERSION" | cut -f 1 -d '.').x/linux-${KERNEL_VERSION}.tar.xz && \ - tar -xf linux-${KERNEL_VERSION}.tar.xz && \ - ln -s linux-${KERNEL_VERSION} linux && \ + SOURCE_KERNEL_VERSION=$(echo "$KERNEL_VERSION" | sed -E 's/\.0$//') && \ + wget -q https://cdn.kernel.org/pub/linux/kernel/v$(echo "$SOURCE_KERNEL_VERSION" | cut -f 1 -d '.').x/linux-${SOURCE_KERNEL_VERSION}.tar.xz && \ + tar -xf linux-${SOURCE_KERNEL_VERSION}.tar.xz && \ + ln -s linux-${SOURCE_KERNEL_VERSION} linux && \ ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/15.2.0/include/stdarg.h /usr/src/linux/include/ WORKDIR /kernel-collector diff --git a/gotests/main.go b/gotests/main.go index 5a465126..670eec0d 100644 --- a/gotests/main.go +++ b/gotests/main.go @@ -286,18 +286,18 @@ var ( ebpfModules = []module{ {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV510 | netdataV514, flags: flagBtrfs, name: "btrfs", ctrlTable: "btrfs_ctrl"}, - {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV515 | netdataV514 | netdataV516, bufferKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, arenaKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, flags: flagCachestat, name: "cachestat", ctrlTable: "cstat_ctrl"}, - {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514, bufferKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, arenaKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, flags: flagDC, name: "dc", updateNames: &dcOptionalNames, ctrlTable: "dcstat_ctrl"}, + {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV515 | netdataV514 | netdataV70 | netdataV516, bufferKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, arenaKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, flags: flagCachestat, name: "cachestat", ctrlTable: "cstat_ctrl"}, + {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514 | netdataV70, bufferKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, arenaKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, flags: flagDC, name: "dc", updateNames: &dcOptionalNames, ctrlTable: "dcstat_ctrl"}, {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV511 | netdataV514 | netdataV516 | netdataV517 | netdataV68, flags: flagDisk, name: "disk", ctrlTable: "disk_ctrl"}, {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514, flags: flagExt4, name: "ext4", ctrlTable: "ext4_ctrl"}, - {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV511 | netdataV514, bufferKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, arenaKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, flags: flagFD, name: "fd", updateNames: &fdOptionalNames, ctrlTable: "fd_ctrl"}, + {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV511 | netdataV514 | netdataV70, bufferKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, arenaKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, flags: flagFD, name: "fd", updateNames: &fdOptionalNames, ctrlTable: "fd_ctrl"}, {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514, flags: flagSync, name: "fdatasync"}, {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514, flags: flagSync, name: "fsync"}, {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514, flags: flagHardIRQ, name: "hardirq"}, {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514, flags: flagMDFlush, name: "mdflush"}, {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514, flags: flagMount, name: "mount"}, {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514, flags: flagSync, name: "msync"}, - {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514, bufferKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, arenaKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, flags: flagSocket, name: "socket", ctrlTable: "socket_ctrl"}, + {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514 | netdataV70, bufferKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, arenaKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, flags: flagSocket, name: "socket", ctrlTable: "socket_ctrl"}, {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514, bufferKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, arenaKernels: netdataV510 | netdataV511 | netdataV514 | netdataV515 | netdataV516 | netdataV68 | netdataV612 | netdataV70, flags: flagDNS, name: "dns"}, {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514, flags: flagNFS, name: "nfs", ctrlTable: "nfs_ctrl"}, {kernels: netdataV310 | netdataV414 | netdataV416 | netdataV418 | netdataV54 | netdataV514, flags: flagNetworkViewer, name: "network_viewer", ctrlTable: "nv_ctrl"}, @@ -500,7 +500,7 @@ func parseOSRelease(content string) int { func isRHELFamilyID(id string) bool { switch strings.ToLower(id) { - case "rhel", "centos", "almalinux", "rocky": + case "rhel", "centos", "almalinux", "rocky", "cloudlinux": return true default: return false @@ -533,7 +533,8 @@ func parseRedHatRelease(release string) int { } vendor := strings.ToLower(strings.TrimSpace(release[:version])) if !strings.HasPrefix(vendor, "red hat") && !strings.HasPrefix(vendor, "centos") && - !strings.HasPrefix(vendor, "almalinux") && !strings.HasPrefix(vendor, "rocky linux") { + !strings.HasPrefix(vendor, "almalinux") && !strings.HasPrefix(vendor, "rocky linux") && + !strings.HasPrefix(vendor, "cloudlinux") { return -1 } @@ -1177,6 +1178,16 @@ func moduleHasArena(name string) bool { return arenaModules[name] } +func legacyArtifactFlavorAvailable(module string, rhfVersion, kernelVersion int, bufferMode, arenaMode, isDebian bool) bool { + if arenaMode { + return moduleHasArena(module) && kernelVersion >= netdataEBPFKernel69 && !isDebian + } + if bufferMode { + return moduleHasBuffer(module) && kernelVersion >= netdataEBPFKernel58 + } + return legacyArtifactFamilyAvailable(module, rhfVersion, kernelVersion) +} + func runNetdataTests(w io.Writer, rhfVersion int, kernelVersion int, isReturn bool, opts options, nprocesses int) { supportedMapTypes := detectSupportedMapTypes(rhfVersion, kernelVersion) isDebian := IsDebianFlavor() @@ -1202,6 +1213,10 @@ func runNetdataTests(w io.Writer, rhfVersion int, kernelVersion int, isReturn bo skippedModules = appendUnique(skippedModules, skippedModule{Module: mod.name, Reason: "buffer flavor unavailable"}) continue } + if !legacyArtifactFlavorAvailable(mod.name, rhfVersion, kernelVersion, bufferMode, arenaMode, isDebian) { + skippedModules = appendUnique(skippedModules, skippedModule{Module: mod.name, Reason: "no compatible object family for the selected flavor"}) + continue + } kernels := mod.kernels if arenaMode && mod.arenaKernels != 0 { @@ -1209,7 +1224,7 @@ func runNetdataTests(w io.Writer, rhfVersion int, kernelVersion int, isReturn bo } else if bufferMode && mod.bufferKernels != 0 { kernels = mod.bufferKernels } - if isRHEL10Kernel612Stream(rhfVersion, kernelVersion) { + if isRHEL10Kernel612Stream(rhfVersion, kernelVersion) || (rhfVersion <= 0 && kernelVersion >= 6<<16+12<<8 && kernelVersion < 6<<16+13<<8) { kernels |= netdataV612 } maxIndex := selectModuleMaxIndex(mod.name, rhfVersion, kernelVersion) @@ -1219,6 +1234,9 @@ func runNetdataTests(w io.Writer, rhfVersion int, kernelVersion int, isReturn bo } idx := selectIndexFromMax(kernels, rhfVersion, maxIndex) candidates := discoverCandidates(mod.name, isReturn, rhfVersion, kernels, maxIndex, opts.netdataPath, bufferMode, arenaMode) + if len(candidates) == 0 && rhfVersion > 0 && !isRHEL10Kernel612Stream(rhfVersion, kernelVersion) { + candidates = discoverCandidates(mod.name, isReturn, -1, kernels, maxIndex, opts.netdataPath, bufferMode, arenaMode) + } compatible, incompatible, unsupportedType := filterCompatibleCandidates(candidates, supportedMapTypes) if len(compatible) == 0 { @@ -1298,6 +1316,27 @@ func isRHEL10Kernel612Stream(rhfVersion int, kernelVersion int) bool { kernelVersion >= netdataEBPFKernel612 && kernelVersion < 6*65536+13*256 } +func legacyArtifactFamilyAvailable(module string, rhfVersion int, kernelVersion int) bool { + if kernelVersion < netdataEBPFKernel414 { + return module != "dns" + } + if isRHEL10Kernel612Stream(rhfVersion, kernelVersion) || + (rhfVersion <= 0 && kernelVersion >= netdataEBPFKernel612 && kernelVersion < 6*65536+13*256) { + return true + } + if rhfVersion > 0 { + return kernelVersion < netdataEBPFKernel517 + } + if kernelVersion >= netdataEBPFKernel70 { + return module == "cachestat" || module == "dc" || module == "fd" || + module == "socket" || module == "process" || module == "swap" + } + if kernelVersion >= 6*65536+13*256 { + return false + } + return true +} + func selectMaxIndex(rhfVersion int, kernelVersion int) uint32 { if rhfVersion > 0 { switch { diff --git a/gotests/main_test.go b/gotests/main_test.go index abd66bcc..0e8611d3 100644 --- a/gotests/main_test.go +++ b/gotests/main_test.go @@ -30,6 +30,38 @@ func TestJSONMemberFramingWithFailureAfterMapTypes(t *testing.T) { } } +func TestLegacyArtifactFamilyAvailability(t *testing.T) { + tests := []struct { + name string + module string + rhf int + kver int + want bool + }{ + {name: "3.10 keeps available collectors", module: "swap", rhf: 7 * 256, kver: 3<<16 + 10<<8, want: true}, + {name: "3.10 skips missing DNS", module: "dns", rhf: 7 * 256, kver: 3<<16 + 10<<8}, + {name: "generic 6.10 disk exists", module: "disk", rhf: -1, kver: 6<<16 + 10<<8, want: true}, + {name: "generic 6.10 legacy family exists", module: "process", rhf: -1, kver: 6<<16 + 10<<8, want: true}, + {name: "generic 6.12 full family exists", module: "dns", rhf: -1, kver: 6<<16 + 12<<8, want: true}, + {name: "generic 6.16 family is absent", module: "swap", rhf: -1, kver: 6<<16 + 16<<8}, + {name: "generic 7.0 process exists", module: "process", rhf: -1, kver: netdataEBPFKernel70, want: true}, + {name: "generic 7.0 cachestat exists", module: "cachestat", rhf: -1, kver: netdataEBPFKernel70, want: true}, + {name: "generic 7.0 dc exists", module: "dc", rhf: -1, kver: netdataEBPFKernel70, want: true}, + {name: "generic 7.0 fd exists", module: "fd", rhf: -1, kver: netdataEBPFKernel70, want: true}, + {name: "generic 7.0 socket exists", module: "socket", rhf: -1, kver: netdataEBPFKernel70, want: true}, + {name: "generic 7.0 DNS is absent", module: "dns", rhf: -1, kver: netdataEBPFKernel70}, + {name: "RHEL 10 6.12 family exists", module: "dns", rhf: 10 * 256, kver: netdataEBPFKernel612, want: true}, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + if got := legacyArtifactFamilyAvailable(tc.module, tc.rhf, tc.kver); got != tc.want { + t.Fatalf("legacyArtifactFamilyAvailable() = %v, want %v", got, tc.want) + } + }) + } +} + func TestParseDNSPortList(t *testing.T) { t.Run("returns default when no valid ports exist", func(t *testing.T) { var out bytes.Buffer diff --git a/kernel-patches/6.12.0/.gitkeep b/kernel-patches/6.12.0/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/kernel/Makefile b/kernel/Makefile index 90ccd1c6..70359904 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -101,22 +101,21 @@ NETDATA_ALL_APPS= btrfs \ zfs \ # -# Kernel newer than 6.16.0 ( 397312 = 6 * 65536 + 16 * 256) -ifeq ($(shell test $(CURRENT_KERNEL) -ge 397312 ; echo $$?),0) -NETDATA_APPS= swap \ +# Kernel 7.0 or newer (458752 = 7 * 65536) +ifeq ($(shell test $(CURRENT_KERNEL) -ge 458752 ; echo $$?),0) +NETDATA_APPS= cachestat \ + dc \ + fd \ process \ + socket \ + swap \ # # The Red Hat 10 6.12 build supplies the complete legacy object family as well as -# the buffer and arena variants below; other 6.12 builds retain the smaller set. +# the buffer and arena variants below. Generic 6.12 builds also ship the full +# legacy family so hosts without vmlinux BTF can use kernel-matched objects. else ifeq ($(VER_MAJOR).$(VER_MINOR),6.12) -ifneq ($(strip $(RHF)),) NETDATA_APPS= ${NETDATA_ALL_APPS} -else -NETDATA_APPS= swap \ - disk \ - # -endif # Kernel newer than 6.8.0 ( 395264 = 6 * 65536 + 8 * 256) else ifeq ($(shell test $(CURRENT_KERNEL) -ge 395264 ; echo $$?),0) NETDATA_APPS= swap \ @@ -273,7 +272,7 @@ endif -include ../includes/netdata_asm_goto.h \ -O2 -g -emit-llvm $< -o $(<:.c=.ll) $(LLC) -march=bpf -filetype=obj -o p$@ $(<:.c=.ll) - /bin/bash rename_binaries.sh "$(VER_MAJOR)" "$(VER_MINOR)" "$@" "$(RHF)" + /bin/bash rename_binaries.sh "$(VER_MAJOR)" "$(VER_MINOR)" "$@" "$(RHF)" "$(KERNEL_VERSION)" ifeq ($(VER_MAJOR).$(VER_MINOR),3.10) ifeq ($(LEGACY_LIBBPF_ACTIVE),1) diff --git a/kernel/rename_binaries.sh b/kernel/rename_binaries.sh index bdf26bdf..5d40f978 100644 --- a/kernel/rename_binaries.sh +++ b/kernel/rename_binaries.sh @@ -15,6 +15,7 @@ parse_kernel_version() { select_kernel_version() { FORCE_RHF="${3:-}" + FULL_KERNEL_VERSION="${4:-${1}.${2}}" VER6_12_0="006012" VER7_0_0="007000" VER6_8_0="006008" @@ -31,7 +32,9 @@ select_kernel_version() { VER3_10_0="003010" ISRH="" - if [ "${KVER}" -eq "${VER3_10_0}" ]; then + if [ "${FULL_KERNEL_VERSION}" = "6.16.2" ]; then + KSELECTED="6.16.2"; + elif [ "${KVER}" -eq "${VER3_10_0}" ]; then KSELECTED="3.10"; elif [ "${KVER}" -ge "${VER7_0_0}" ]; then KSELECTED="7.0"; @@ -77,13 +80,7 @@ OBJECTNAME="$3" NAME=${OBJECTNAME%_*} KVER=$(parse_kernel_version "$1" "$2") -KNAME=$(select_kernel_version "${1}" "${2}" "${RHF:-}") - -# Disk request layout changed in 5.17. Keep other objects on the existing -# 5.16 suffix; the disk selector is updated independently in the agent. -if [ "${NAME}" != "disk" ] && [ "${KVER}" -ge "005017" ] && [ "${KVER}" -lt "006008" ]; then - KNAME="5.16" -fi +KNAME=$(select_kernel_version "${1}" "${2}" "${4:-}" "${5:-}") cp "r${NAME}_kern.o" "../rnetdata_ebpf_${NAME}.${KNAME}.o" cp "p${NAME}_kern.o" "../pnetdata_ebpf_${NAME}.${KNAME}.o" diff --git a/tests/tester_user.c b/tests/tester_user.c index 7a314e6b..d3e8f986 100644 --- a/tests/tester_user.c +++ b/tests/tester_user.c @@ -79,11 +79,11 @@ static ebpf_specify_name_t fd_optional_name[] = { {.program_name = "netdata_clos ebpf_module_t ebpf_modules[] = { { .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_10 | NETDATA_V5_14, .flags = NETDATA_FLAG_BTRFS, .name = "btrfs", .update_names = NULL, .ctrl_table = "btrfs_ctrl" }, - { .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_15 | NETDATA_V5_14 | NETDATA_V5_16, + { .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_15 | NETDATA_V5_14 | NETDATA_V7_0 | NETDATA_V5_16, .buffer_kernels = NETDATA_V5_10 | NETDATA_V5_11 | NETDATA_V5_14 | NETDATA_V5_15 | NETDATA_V5_16 | NETDATA_V6_8 | NETDATA_V6_12 | NETDATA_V7_0, .arena_kernels = NETDATA_V5_10 | NETDATA_V5_11 | NETDATA_V5_14 | NETDATA_V5_15 | NETDATA_V5_16 | NETDATA_V6_8 | NETDATA_V6_12 | NETDATA_V7_0, .flags = NETDATA_FLAG_CACHESTAT, .name = "cachestat", .update_names = NULL, .ctrl_table = "cstat_ctrl" }, - { .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14, + { .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14 | NETDATA_V7_0, .buffer_kernels = NETDATA_V5_10 | NETDATA_V5_11 | NETDATA_V5_14 | NETDATA_V5_15 | NETDATA_V5_16 | NETDATA_V6_8 | NETDATA_V6_12 | NETDATA_V7_0, .arena_kernels = NETDATA_V5_10 | NETDATA_V5_11 | NETDATA_V5_14 | NETDATA_V5_15 | NETDATA_V5_16 | NETDATA_V6_8 | NETDATA_V6_12 | NETDATA_V7_0, .flags = NETDATA_FLAG_DC, .name = "dc", .update_names = dc_optional_name, .ctrl_table = "dcstat_ctrl" }, @@ -91,7 +91,7 @@ ebpf_module_t ebpf_modules[] = { .flags = NETDATA_FLAG_DISK, .name = "disk", .update_names = NULL, .ctrl_table = "disk_ctrl" }, { .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14, .flags = NETDATA_FLAG_EXT4, .name = "ext4", .update_names = NULL, .ctrl_table = "ext4_ctrl" }, - { .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_11 | NETDATA_V5_14, + { .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_11 | NETDATA_V5_14 | NETDATA_V7_0, .buffer_kernels = NETDATA_V5_10 | NETDATA_V5_11 | NETDATA_V5_14 | NETDATA_V5_15 | NETDATA_V5_16 | NETDATA_V6_8 | NETDATA_V6_12 | NETDATA_V7_0, .arena_kernels = NETDATA_V5_10 | NETDATA_V5_11 | NETDATA_V5_14 | NETDATA_V5_15 | NETDATA_V5_16 | NETDATA_V6_8 | NETDATA_V6_12 | NETDATA_V7_0, .flags = NETDATA_FLAG_FD, .name = "fd", .update_names = fd_optional_name, .ctrl_table = "fd_ctrl" }, @@ -107,7 +107,7 @@ ebpf_module_t ebpf_modules[] = { .flags = NETDATA_FLAG_MOUNT, .name = "mount", .update_names = NULL, .ctrl_table = NULL }, { .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14, .flags = NETDATA_FLAG_SYNC, .name = "msync", .update_names = NULL, .ctrl_table = NULL }, - { .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14, + { .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14 | NETDATA_V7_0, .buffer_kernels = NETDATA_V5_10 | NETDATA_V5_11 | NETDATA_V5_14 | NETDATA_V5_15 | NETDATA_V5_16 | NETDATA_V6_8 | NETDATA_V6_12 | NETDATA_V7_0, .arena_kernels = NETDATA_V5_10 | NETDATA_V5_11 | NETDATA_V5_14 | NETDATA_V5_15 | NETDATA_V5_16 | NETDATA_V6_8 | NETDATA_V6_12 | NETDATA_V7_0, .flags = NETDATA_FLAG_SOCKET, .name = "socket", .update_names = NULL, .ctrl_table = "socket_ctrl" }, @@ -985,7 +985,8 @@ static int ebpf_is_redhat_family_id(const char *value, size_t length) return (length == 4 && !strncmp(value, "rhel", length)) || (length == 6 && !strncmp(value, "centos", length)) || (length == 9 && !strncmp(value, "almalinux", length)) || - (length == 5 && !strncmp(value, "rocky", length)); + (length == 5 && !strncmp(value, "rocky", length)) || + (length == 10 && !strncmp(value, "cloudlinux", length)); } static int ebpf_has_redhat_family_id(const char *value) @@ -1076,7 +1077,8 @@ static int ebpf_parse_redhat_release_version(const char *release) (vendor_len >= 7 && !strncmp(release, "Red Hat", 7)) || (vendor_len >= 6 && !strncmp(release, "CentOS", 6)) || (vendor_len >= 9 && !strncmp(release, "AlmaLinux", 9)) || - (vendor_len >= 11 && !strncmp(release, "Rocky Linux", 11)); + (vendor_len >= 11 && !strncmp(release, "Rocky Linux", 11)) || + (vendor_len >= 10 && !strncmp(release, "CloudLinux", 10)); if (!is_supported_vendor) return -1; @@ -1135,6 +1137,31 @@ static int ebpf_is_rhel10_6_12_stream(int rhf_version, uint32_t kver) kver < NETDATA_EBPF_KERNEL_6_12 + 256; } +static int ebpf_legacy_artifact_family_supported(const char *name, int rhf_version, uint32_t kver) +{ + if (kver < NETDATA_EBPF_KERNEL_4_14) + return strcmp(name, "dns") != 0; + + if (ebpf_is_rhel10_6_12_stream(rhf_version, kver) || + (rhf_version <= 0 && kver >= NETDATA_EBPF_KERNEL_6_12 && kver < NETDATA_EBPF_KERNEL_6_12 + 256)) + return 1; + + if (rhf_version > 0) + return kver < NETDATA_EBPF_KERNEL_5_17; + + if (kver >= NETDATA_EBPF_KERNEL_7_0) + return !strcmp(name, "cachestat") || !strcmp(name, "dc") || !strcmp(name, "fd") || + !strcmp(name, "socket") || !strcmp(name, "process") || !strcmp(name, "swap"); + + if (kver >= NETDATA_EBPF_KERNEL_6_12 + 256) + return 0; + + if (kver >= NETDATA_EBPF_KERNEL_6_8) + return 1; + + return 1; +} + /** * Select Max Index * @@ -2377,6 +2404,16 @@ static int ebpf_module_has_arena(const char *name) return 0; } +static int ebpf_legacy_artifact_flavor_supported(const char *name, int rhf_version, uint32_t kver, + int use_buffer_mode, int use_arena_mode) +{ + if (use_arena_mode) + return ebpf_module_has_arena(name) && kver >= NETDATA_EBPF_KERNEL_6_9; + if (use_buffer_mode) + return ebpf_module_has_buffer(name) && kver >= NETDATA_EBPF_KERNEL_5_8; + return ebpf_legacy_artifact_family_supported(name, rhf_version, kver); +} + static void ebpf_run_netdata_tests(int rhf_version, uint32_t kver, int is_return, uint64_t flags) { ebpf_map_support_t map_support; @@ -2421,6 +2458,12 @@ static void ebpf_run_netdata_tests(int rhf_version, uint32_t kver, int is_return continue; } + if (!ebpf_legacy_artifact_flavor_supported(ebpf_modules[i].name, rhf_version, kver, + use_buffer_mode, use_arena_mode)) { + i++; + continue; + } + if (flags & ebpf_modules[i].flags) { ebpf_candidate_list_t candidates; ebpf_candidate_list_t compatible = { 0 }; @@ -2432,7 +2475,9 @@ static void ebpf_run_netdata_tests(int rhf_version, uint32_t kver, int is_return ((use_buffer_mode && ebpf_modules[i].buffer_kernels) ? ebpf_modules[i].buffer_kernels : ebpf_modules[i].kernels); int rhel10 = ebpf_is_rhel10_6_12_stream(rhf_version, kver); - if (rhel10) + int generic612 = rhf_version <= 0 && kver >= NETDATA_EBPF_KERNEL_6_12 && + kver < NETDATA_EBPF_KERNEL_6_12 + 256; + if (rhel10 || generic612) kernels_to_use |= NETDATA_V6_12; uint32_t max_idx = ebpf_select_max_index(rhf_version, kver); uint32_t idx = !strcmp(ebpf_modules[i].name, "disk") @@ -2441,6 +2486,9 @@ static void ebpf_run_netdata_tests(int rhf_version, uint32_t kver, int is_return ebpf_discover_candidates(&candidates, ebpf_modules[i].name, is_return, kernels_to_use, max_idx, rhf_version, use_buffer_mode, use_arena_mode); + if (!candidates.size && rhf_version > 0 && !rhel10) + ebpf_discover_candidates(&candidates, ebpf_modules[i].name, is_return, + kernels_to_use, max_idx, -1, use_buffer_mode, use_arena_mode); for (j = 0; j < candidates.size; j++) { struct bpf_object *obj = bpf_object__open_file(candidates.files[j], NULL); if (libbpf_get_error(obj)) { From dd2fa13a5101c3e4f7298db5d1536da9ed01d098 Mon Sep 17 00:00:00 2001 From: Thiago Marques Date: Tue, 20 Oct 2026 02:20:45 +0000 Subject: [PATCH 5/6] rhel10_disk: Fix local issues --- .github/scripts/verify-rhf-artifact.sh | 12 +++-- .github/workflows/build.yml | 4 ++ .github/workflows/release.yml | 10 ++++ gotests/main.go | 75 +++++++++++++++++--------- gotests/main_test.go | 28 ++++++++++ 5 files changed, 101 insertions(+), 28 deletions(-) diff --git a/.github/scripts/verify-rhf-artifact.sh b/.github/scripts/verify-rhf-artifact.sh index 4dbb1ca6..15ca90cc 100755 --- a/.github/scripts/verify-rhf-artifact.sh +++ b/.github/scripts/verify-rhf-artifact.sh @@ -2,8 +2,14 @@ set -euo pipefail repo_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd) -archive=${1:?usage: verify-rhf-artifact.sh <6.12.rhf archive>} +archive=${1:?usage: verify-rhf-artifact.sh [rhf|generic] [6.12.0|6.16.2]} family=${2:-rhf} +kernel_version=${3:-6.12.0} +case "$kernel_version" in + 6.12.0) object_version=6.12 ;; + 6.16.2) object_version=6.16.2 ;; + *) printf 'unsupported artifact kernel version: %s\n' "$kernel_version" >&2; exit 1 ;; +esac [[ -f "$archive" ]] || { printf 'artifact not found: %s\n' "$archive" >&2; exit 1; } case "$family" in rhf) rhf_suffix='.rhf'; make_rhf='.rhf' ;; @@ -13,7 +19,7 @@ esac inventory=$(make -s -C "$repo_root/kernel" \ --eval='print-ebpf-inventory:;@printf "%s\\n%s\\n%s\\n" "$(NETDATA_APPS)" "$(NETDATA_RINGBUF_APPS)" "$(NETDATA_ARENA_APPS)"' \ - print-ebpf-inventory KERNEL_VERSION=6.12.0 RHF="$make_rhf") + print-ebpf-inventory KERNEL_VERSION="$kernel_version" RHF="$make_rhf") mapfile -t app_families <<< "$inventory" ((${#app_families[@]} == 3)) || { printf 'could not read expected object families from kernel/Makefile\n' >&2; exit 1; } @@ -22,7 +28,7 @@ for family in "${app_families[@]}"; do read -r -a apps <<< "$family" for app in "${apps[@]}"; do for prefix in p r; do - object="${prefix}netdata_ebpf_${app}.6.12${rhf_suffix}.o" + object="${prefix}netdata_ebpf_${app}.${object_version}${rhf_suffix}.o" grep -Fxq "$object" <<< "$archive_list" || { printf 'missing object: %s\n' "$object" >&2; exit 1; } done done diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 93b47225..85ea7ce4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,6 +69,10 @@ jobs: artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.12.rhf-*.tar' -print -quit) test -n "$artifact" .github/scripts/verify-rhf-artifact.sh "$artifact" + elif [ "${{ matrix.kernel_version }}" = "6.16.2" ]; then + artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.16-*.tar' -print -quit) + test -n "$artifact" + .github/scripts/verify-rhf-artifact.sh "$artifact" generic 6.16.2 fi - name: Upload Artifacts uses: actions/upload-artifact@v6 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 455ab670..fe0ac970 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -78,6 +78,10 @@ jobs: artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.12.rhf-*.tar' -print -quit) test -n "$artifact" .github/scripts/verify-rhf-artifact.sh "$artifact" + elif [ "${{ matrix.kernel_version }}" = "6.16.2" ]; then + artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.16-*.tar' -print -quit) + test -n "$artifact" + .github/scripts/verify-rhf-artifact.sh "$artifact" generic 6.16.2 fi - name: Upload Artifacts uses: actions/upload-artifact@v6 @@ -155,6 +159,12 @@ jobs: while IFS= read -r object; do cmp <(tar -xOf "${generic_archive}" "${object}") "${package}/${object}" done < <(tar -tf "${generic_archive}" | grep -E '^[pr]netdata_ebpf_.*\.6\.12\.o$') + exact_archive=$(find "artifacts/artifacts-6.16.2-${libc}" -maxdepth 1 -type f -name "netdata_ebpf-*_*-${libc}.tar" -print -quit) + test -n "${exact_archive}" + .github/scripts/verify-rhf-artifact.sh "${exact_archive}" generic 6.16.2 + while IFS= read -r object; do + cmp <(tar -xOf "${exact_archive}" "${object}") "${package}/${object}" + done < <(tar -tf "${exact_archive}" | grep -E '^[pr]netdata_ebpf_.*\.6\.16\.2\.o$') if [ "${libc}" == "static" ] || [ "${libc}" == "glibc" ]; then cp -R CentOS7/* "packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}"; fi tar -C "packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}" -Jcvf "final-artifacts/netdata-kernel-collector-${libc}-${RELEASE_TAG}.tar.xz" ./ done diff --git a/gotests/main.go b/gotests/main.go index 670eec0d..12c22777 100644 --- a/gotests/main.go +++ b/gotests/main.go @@ -45,22 +45,24 @@ const ( netdataEBPFKernel69 = 395520 netdataEBPFKernel612 = 396288 netdataEBPFKernel616 = 397312 + netdataEBPFKernel6162 = 397314 netdataEBPFKernel70 = 458752 - netdataV310 = 1 << 0 - netdataV414 = 1 << 1 - netdataV416 = 1 << 2 - netdataV418 = 1 << 3 - netdataV54 = 1 << 4 - netdataV510 = 1 << 5 - netdataV511 = 1 << 6 - netdataV514 = 1 << 7 - netdataV515 = 1 << 8 - netdataV516 = 1 << 9 - netdataV68 = 1 << 10 - netdataV612 = 1 << 11 - netdataV70 = 1 << 12 - netdataV517 = 1 << 13 + netdataV310 = 1 << 0 + netdataV414 = 1 << 1 + netdataV416 = 1 << 2 + netdataV418 = 1 << 3 + netdataV54 = 1 << 4 + netdataV510 = 1 << 5 + netdataV511 = 1 << 6 + netdataV514 = 1 << 7 + netdataV515 = 1 << 8 + netdataV516 = 1 << 9 + netdataV68 = 1 << 10 + netdataV612 = 1 << 11 + netdataV70 = 1 << 12 + netdataV517 = 1 << 13 + netdataV6162 = 1 << 14 flagBtrfs uint64 = 1 << 0 flagCachestat uint64 = 1 << 1 @@ -1197,7 +1199,7 @@ func runNetdataTests(w io.Writer, rhfVersion int, kernelVersion int, isReturn bo skippedModules = appendUnique(skippedModules, skippedModule{Module: mod.name, Reason: "not selected by flags"}) continue } - if mod.name == "disk" && rhfVersion <= 0 && kernelVersion >= netdataEBPFKernel616 { + if mod.name == "disk" && rhfVersion <= 0 && kernelVersion >= netdataEBPFKernel616 && kernelVersion != netdataEBPFKernel6162 { skippedModules = appendUnique(skippedModules, skippedModule{Module: mod.name, Reason: "disabled on generic kernels >= 6.16"}) continue } @@ -1218,15 +1220,7 @@ func runNetdataTests(w io.Writer, rhfVersion int, kernelVersion int, isReturn bo continue } - kernels := mod.kernels - if arenaMode && mod.arenaKernels != 0 { - kernels = mod.arenaKernels - } else if bufferMode && mod.bufferKernels != 0 { - kernels = mod.bufferKernels - } - if isRHEL10Kernel612Stream(rhfVersion, kernelVersion) || (rhfVersion <= 0 && kernelVersion >= 6<<16+12<<8 && kernelVersion < 6<<16+13<<8) { - kernels |= netdataV612 - } + kernels := moduleArtifactKernels(mod, rhfVersion, kernelVersion, bufferMode, arenaMode) maxIndex := selectModuleMaxIndex(mod.name, rhfVersion, kernelVersion) if maxIndex == ^uint32(0) { skippedModules = appendUnique(skippedModules, skippedModule{Module: mod.name, Reason: "legacy disk unsupported for this Red Hat kernel"}) @@ -1268,8 +1262,28 @@ func runNetdataTests(w io.Writer, rhfVersion int, kernelVersion int, isReturn bo } } +func moduleArtifactKernels(mod module, rhfVersion int, kernelVersion int, bufferMode bool, arenaMode bool) uint32 { + kernels := mod.kernels + if arenaMode && mod.arenaKernels != 0 { + kernels = mod.arenaKernels + } else if bufferMode && mod.bufferKernels != 0 { + kernels = mod.bufferKernels + } + if isRHEL10Kernel612Stream(rhfVersion, kernelVersion) || + (rhfVersion <= 0 && kernelVersion >= 6<<16+12<<8 && kernelVersion < 6<<16+13<<8) { + kernels |= netdataV612 + } + if rhfVersion <= 0 && kernelVersion == netdataEBPFKernel6162 { + if bufferMode || arenaMode || mod.name == "disk" || mod.name == "swap" { + kernels |= netdataV6162 + } + kernels &^= netdataV70 + } + return kernels +} + func selectKernelName(selector uint32) string { - kernelNames := []string{"3.10", "4.14", "4.16", "4.18", "5.4", "5.10", "5.11", "5.14", "5.15", "5.16", "6.8", "6.12", "7.0", "5.17"} + kernelNames := []string{"3.10", "4.14", "4.16", "4.18", "5.4", "5.10", "5.11", "5.14", "5.15", "5.16", "6.8", "6.12", "7.0", "5.17", "6.16.2"} if int(selector) >= len(kernelNames) { return "unknown" } @@ -1286,6 +1300,9 @@ func appendUnique(values []skippedModule, value skippedModule) []skippedModule { } func selectModuleMaxIndex(moduleName string, rhfVersion int, kernelVersion int) uint32 { + if rhfVersion <= 0 && kernelVersion == netdataEBPFKernel6162 { + return 14 + } if moduleName == "disk" && rhfVersion > 0 && kernelVersion >= netdataEBPFKernel517 { if isRHEL10Kernel612Stream(rhfVersion, kernelVersion) { return 11 @@ -1317,6 +1334,9 @@ func isRHEL10Kernel612Stream(rhfVersion int, kernelVersion int) bool { } func legacyArtifactFamilyAvailable(module string, rhfVersion int, kernelVersion int) bool { + if rhfVersion <= 0 && kernelVersion == netdataEBPFKernel6162 { + return module == "disk" || module == "swap" + } if kernelVersion < netdataEBPFKernel414 { return module != "dns" } @@ -1351,6 +1371,8 @@ func selectMaxIndex(rhfVersion int, kernelVersion int) uint32 { } } else { switch { + case kernelVersion == netdataEBPFKernel6162: + return 14 case kernelVersion >= netdataEBPFKernel70: return 12 case kernelVersion >= netdataEBPFKernel612: @@ -1378,6 +1400,9 @@ func selectMaxIndex(rhfVersion int, kernelVersion int) uint32 { } func selectIndex(kernels uint32, rhfVersion int, kernelVersion int) uint32 { + if rhfVersion <= 0 && kernelVersion == netdataEBPFKernel6162 { + kernels &^= netdataV70 + } return selectIndexFromMax(kernels, rhfVersion, selectMaxIndex(rhfVersion, kernelVersion)) } diff --git a/gotests/main_test.go b/gotests/main_test.go index 0e8611d3..368406a8 100644 --- a/gotests/main_test.go +++ b/gotests/main_test.go @@ -43,6 +43,9 @@ func TestLegacyArtifactFamilyAvailability(t *testing.T) { {name: "generic 6.10 disk exists", module: "disk", rhf: -1, kver: 6<<16 + 10<<8, want: true}, {name: "generic 6.10 legacy family exists", module: "process", rhf: -1, kver: 6<<16 + 10<<8, want: true}, {name: "generic 6.12 full family exists", module: "dns", rhf: -1, kver: 6<<16 + 12<<8, want: true}, + {name: "generic exact 6.16.2 disk base exists", module: "disk", rhf: -1, kver: netdataEBPFKernel6162, want: true}, + {name: "generic exact 6.16.2 swap base exists", module: "swap", rhf: -1, kver: netdataEBPFKernel6162, want: true}, + {name: "generic exact 6.16.2 cachestat base absent", module: "cachestat", rhf: -1, kver: netdataEBPFKernel6162}, {name: "generic 6.16 family is absent", module: "swap", rhf: -1, kver: 6<<16 + 16<<8}, {name: "generic 7.0 process exists", module: "process", rhf: -1, kver: netdataEBPFKernel70, want: true}, {name: "generic 7.0 cachestat exists", module: "cachestat", rhf: -1, kver: netdataEBPFKernel70, want: true}, @@ -225,6 +228,7 @@ VERSION_ID="12" {name: "RHEL 10 6.13 rejected", rhf: 10 * 256, kernel: netdataEBPFKernel612 + 256, want: ^uint32(0)}, {name: "RHEL 10 6.15 rejected", rhf: 10 * 256, kernel: netdataEBPFKernel612 + 3*256, want: ^uint32(0)}, {name: "RHEL 10 6.16 rejected", rhf: 10 * 256, kernel: netdataEBPFKernel616, want: ^uint32(0)}, + {name: "generic exact 6.16.2 disk supported", rhf: -1, kernel: netdataEBPFKernel6162, want: 14}, {name: "RHEL 11 6.12 rejected", rhf: 11 * 256, kernel: netdataEBPFKernel612, want: ^uint32(0)}, } for _, tc := range diskSelectionCases { @@ -270,6 +274,7 @@ VERSION_ID="12" {name: "rhf 5.4", rhfVersion: 1, kernelVersion: netdataEBPFKernel54, want: 4}, {name: "generic 6.8", rhfVersion: 0, kernelVersion: netdataEBPFKernel68, want: 10}, {name: "generic 7.0", rhfVersion: 0, kernelVersion: netdataEBPFKernel70, want: 12}, + {name: "generic exact 6.16.2", rhfVersion: 0, kernelVersion: netdataEBPFKernel6162, want: 14}, {name: "generic 4.15", rhfVersion: 0, kernelVersion: netdataEBPFKernel415, want: 2}, {name: "too old", rhfVersion: 0, kernelVersion: netdataMinimumEBPFKernel - 1, want: 0}, } @@ -288,6 +293,29 @@ VERSION_ID="12" if got := selectKernelName(12); got != "7.0" { t.Fatalf("unexpected kernel name: %q", got) } + if got := selectKernelName(14); got != "6.16.2" { + t.Fatalf("unexpected exact kernel name: %q", got) + } + for _, tc := range []struct { + name string + kernel int + want uint32 + }{ + {name: "6.16.1 stays at 6.12", kernel: netdataEBPFKernel6162 - 1, want: 11}, + {name: "6.16.2 uses its exact rung", kernel: netdataEBPFKernel6162, want: 14}, + {name: "6.16.3 stays at 6.12", kernel: netdataEBPFKernel6162 + 1, want: 11}, + {name: "7.0 does not select 6.16.2", kernel: netdataEBPFKernel70, want: 12}, + } { + t.Run(tc.name, func(t *testing.T) { + kernels := uint32(netdataV6162 | netdataV70 | netdataV612) + if got := selectIndex(kernels, -1, tc.kernel); got != tc.want { + t.Fatalf("selectIndex() = %d, want %d", got, tc.want) + } + }) + } + if got := selectIndex(uint32(netdataV70|netdataV612), -1, netdataEBPFKernel6162); got != 11 { + t.Fatalf("6.16.2 without exact artifacts selected %d, want 6.12 selector 11", got) + } if got := selectIndex(netdataV514, -1, netdataEBPFKernel514); got != 0 { t.Fatalf("expected 5.14-only selector to be masked for non-RHF, got %d", got) From 1a9a3eb0ec776f324106834a981d70dcd5d35f16 Mon Sep 17 00:00:00 2001 From: Thiago Marques Date: Wed, 21 Oct 2026 01:18:42 +0000 Subject: [PATCH 6/6] rhel10_disk: Adjust tests --- .github/scripts/verify-rhf-artifact.sh | 3 ++ gotests/main.go | 20 +++--------- gotests/main_test.go | 33 ++++++++++++++++++-- tests/tester_user.c | 43 ++++++++++---------------- tests/tester_user.h | 7 +++-- 5 files changed, 59 insertions(+), 47 deletions(-) diff --git a/.github/scripts/verify-rhf-artifact.sh b/.github/scripts/verify-rhf-artifact.sh index 15ca90cc..0fd37f49 100755 --- a/.github/scripts/verify-rhf-artifact.sh +++ b/.github/scripts/verify-rhf-artifact.sh @@ -24,8 +24,10 @@ mapfile -t app_families <<< "$inventory" ((${#app_families[@]} == 3)) || { printf 'could not read expected object families from kernel/Makefile\n' >&2; exit 1; } archive_list=$(tar -tf "$archive") +expected_object_count=0 for family in "${app_families[@]}"; do read -r -a apps <<< "$family" + expected_object_count=$((expected_object_count + ${#apps[@]})) for app in "${apps[@]}"; do for prefix in p r; do object="${prefix}netdata_ebpf_${app}.${object_version}${rhf_suffix}.o" @@ -33,3 +35,4 @@ for family in "${app_families[@]}"; do done done done +((expected_object_count > 0)) || { printf 'expected object inventory is empty for kernel %s\n' "$kernel_version" >&2; exit 1; } diff --git a/gotests/main.go b/gotests/main.go index 12c22777..e4e3c138 100644 --- a/gotests/main.go +++ b/gotests/main.go @@ -1199,10 +1199,6 @@ func runNetdataTests(w io.Writer, rhfVersion int, kernelVersion int, isReturn bo skippedModules = appendUnique(skippedModules, skippedModule{Module: mod.name, Reason: "not selected by flags"}) continue } - if mod.name == "disk" && rhfVersion <= 0 && kernelVersion >= netdataEBPFKernel616 && kernelVersion != netdataEBPFKernel6162 { - skippedModules = appendUnique(skippedModules, skippedModule{Module: mod.name, Reason: "disabled on generic kernels >= 6.16"}) - continue - } bufferMode, arenaMode := effectiveModeFlags(mod.name, kernelVersion, isDebian, opts.bufferMode, opts.arenaMode) @@ -1270,7 +1266,7 @@ func moduleArtifactKernels(mod module, rhfVersion int, kernelVersion int, buffer kernels = mod.bufferKernels } if isRHEL10Kernel612Stream(rhfVersion, kernelVersion) || - (rhfVersion <= 0 && kernelVersion >= 6<<16+12<<8 && kernelVersion < 6<<16+13<<8) { + (rhfVersion <= 0 && kernelVersion >= netdataEBPFKernel612) { kernels |= netdataV612 } if rhfVersion <= 0 && kernelVersion == netdataEBPFKernel6162 { @@ -1314,6 +1310,8 @@ func selectModuleMaxIndex(moduleName string, rhfVersion int, kernelVersion int) } if moduleName == "disk" && rhfVersion <= 0 { switch { + case kernelVersion >= netdataEBPFKernel612: + return 11 case kernelVersion >= netdataEBPFKernel68: return 10 case kernelVersion >= netdataEBPFKernel517: @@ -1334,26 +1332,16 @@ func isRHEL10Kernel612Stream(rhfVersion int, kernelVersion int) bool { } func legacyArtifactFamilyAvailable(module string, rhfVersion int, kernelVersion int) bool { - if rhfVersion <= 0 && kernelVersion == netdataEBPFKernel6162 { - return module == "disk" || module == "swap" - } if kernelVersion < netdataEBPFKernel414 { return module != "dns" } if isRHEL10Kernel612Stream(rhfVersion, kernelVersion) || - (rhfVersion <= 0 && kernelVersion >= netdataEBPFKernel612 && kernelVersion < 6*65536+13*256) { + (rhfVersion <= 0 && kernelVersion >= netdataEBPFKernel612) { return true } if rhfVersion > 0 { return kernelVersion < netdataEBPFKernel517 } - if kernelVersion >= netdataEBPFKernel70 { - return module == "cachestat" || module == "dc" || module == "fd" || - module == "socket" || module == "process" || module == "swap" - } - if kernelVersion >= 6*65536+13*256 { - return false - } return true } diff --git a/gotests/main_test.go b/gotests/main_test.go index 368406a8..32b8fbec 100644 --- a/gotests/main_test.go +++ b/gotests/main_test.go @@ -30,6 +30,30 @@ func TestJSONMemberFramingWithFailureAfterMapTypes(t *testing.T) { } } +func TestGenericBaseObjectWalkdown(t *testing.T) { + for _, tc := range []struct { + module module + kernel int + }{ + {module: module{name: "cachestat", kernels: netdataV54}, kernel: netdataEBPFKernel6162}, + {module: module{name: "disk", kernels: netdataV68}, kernel: netdataEBPFKernel70}, + } { + t.Run(tc.module.name, func(t *testing.T) { + dir := t.TempDir() + name := "pnetdata_ebpf_" + tc.module.name + ".6.12.o" + if err := os.WriteFile(filepath.Join(dir, name), []byte("x"), 0o644); err != nil { + t.Fatal(err) + } + kernels := moduleArtifactKernels(tc.module, -1, tc.kernel, false, false) + maxIndex := selectModuleMaxIndex(tc.module.name, -1, tc.kernel) + got := discoverCandidates(tc.module.name, false, -1, kernels, maxIndex, dir, false, false) + if len(got) != 1 || filepath.Base(got[0]) != name { + t.Fatalf("walk-down candidates = %v, want %s", got, name) + } + }) + } +} + func TestLegacyArtifactFamilyAvailability(t *testing.T) { tests := []struct { name string @@ -45,14 +69,15 @@ func TestLegacyArtifactFamilyAvailability(t *testing.T) { {name: "generic 6.12 full family exists", module: "dns", rhf: -1, kver: 6<<16 + 12<<8, want: true}, {name: "generic exact 6.16.2 disk base exists", module: "disk", rhf: -1, kver: netdataEBPFKernel6162, want: true}, {name: "generic exact 6.16.2 swap base exists", module: "swap", rhf: -1, kver: netdataEBPFKernel6162, want: true}, - {name: "generic exact 6.16.2 cachestat base absent", module: "cachestat", rhf: -1, kver: netdataEBPFKernel6162}, - {name: "generic 6.16 family is absent", module: "swap", rhf: -1, kver: 6<<16 + 16<<8}, + {name: "generic exact 6.16.2 cachestat walks down", module: "cachestat", rhf: -1, kver: netdataEBPFKernel6162, want: true}, + {name: "generic 6.16 swap walks down", module: "swap", rhf: -1, kver: 6<<16 + 16<<8, want: true}, {name: "generic 7.0 process exists", module: "process", rhf: -1, kver: netdataEBPFKernel70, want: true}, {name: "generic 7.0 cachestat exists", module: "cachestat", rhf: -1, kver: netdataEBPFKernel70, want: true}, {name: "generic 7.0 dc exists", module: "dc", rhf: -1, kver: netdataEBPFKernel70, want: true}, {name: "generic 7.0 fd exists", module: "fd", rhf: -1, kver: netdataEBPFKernel70, want: true}, {name: "generic 7.0 socket exists", module: "socket", rhf: -1, kver: netdataEBPFKernel70, want: true}, - {name: "generic 7.0 DNS is absent", module: "dns", rhf: -1, kver: netdataEBPFKernel70}, + {name: "generic 7.0 DNS walks down", module: "dns", rhf: -1, kver: netdataEBPFKernel70, want: true}, + {name: "generic 7.0 disk walks down", module: "disk", rhf: -1, kver: netdataEBPFKernel70, want: true}, {name: "RHEL 10 6.12 family exists", module: "dns", rhf: 10 * 256, kver: netdataEBPFKernel612, want: true}, } @@ -229,6 +254,8 @@ VERSION_ID="12" {name: "RHEL 10 6.15 rejected", rhf: 10 * 256, kernel: netdataEBPFKernel612 + 3*256, want: ^uint32(0)}, {name: "RHEL 10 6.16 rejected", rhf: 10 * 256, kernel: netdataEBPFKernel616, want: ^uint32(0)}, {name: "generic exact 6.16.2 disk supported", rhf: -1, kernel: netdataEBPFKernel6162, want: 14}, + {name: "generic 6.16.3 disk uses 6.12", rhf: -1, kernel: netdataEBPFKernel6162 + 1, want: 11}, + {name: "generic 7.0 disk uses 6.12", rhf: -1, kernel: netdataEBPFKernel70, want: 11}, {name: "RHEL 11 6.12 rejected", rhf: 11 * 256, kernel: netdataEBPFKernel612, want: ^uint32(0)}, } for _, tc := range diskSelectionCases { diff --git a/tests/tester_user.c b/tests/tester_user.c index d3e8f986..fc15f8fa 100644 --- a/tests/tester_user.c +++ b/tests/tester_user.c @@ -172,7 +172,7 @@ static size_t dns_port_count = 1; static int dns_ports_overridden = 0; static size_t tests_started = 0; static int json_first_member; -static char *ebpf_kernel_names[] = { "3.10", "4.14", "4.16", "4.18", "5.4", "5.10", "5.11", "5.14", "5.15", "5.16", "5.17", "6.8", "6.12", "7.0" }; +static char *ebpf_kernel_names[] = { "3.10", "4.14", "4.16", "4.18", "5.4", "5.10", "5.11", "5.14", "5.15", "5.16", "5.17", "6.8", "6.12", "7.0", "6.16.2" }; pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -618,7 +618,7 @@ static int ebpf_json_kernel_index(int index) { static const char *json_kernel_names[] = { "3.10", "4.14", "4.16", "4.18", "5.4", "5.10", "5.11", "5.14", "5.15", "5.16", - "6.8", "6.12", "7.0", "5.17" + "6.8", "6.12", "7.0", "5.17", "6.16.2" }; const char *version; size_t i; @@ -1142,22 +1142,8 @@ static int ebpf_legacy_artifact_family_supported(const char *name, int rhf_versi if (kver < NETDATA_EBPF_KERNEL_4_14) return strcmp(name, "dns") != 0; - if (ebpf_is_rhel10_6_12_stream(rhf_version, kver) || - (rhf_version <= 0 && kver >= NETDATA_EBPF_KERNEL_6_12 && kver < NETDATA_EBPF_KERNEL_6_12 + 256)) - return 1; - if (rhf_version > 0) - return kver < NETDATA_EBPF_KERNEL_5_17; - - if (kver >= NETDATA_EBPF_KERNEL_7_0) - return !strcmp(name, "cachestat") || !strcmp(name, "dc") || !strcmp(name, "fd") || - !strcmp(name, "socket") || !strcmp(name, "process") || !strcmp(name, "swap"); - - if (kver >= NETDATA_EBPF_KERNEL_6_12 + 256) - return 0; - - if (kver >= NETDATA_EBPF_KERNEL_6_8) - return 1; + return ebpf_is_rhel10_6_12_stream(rhf_version, kver) || kver < NETDATA_EBPF_KERNEL_5_17; return 1; } @@ -1184,7 +1170,9 @@ static int ebpf_select_max_index(int rhf_version, uint32_t kver) else if (kver >= NETDATA_EBPF_KERNEL_4_11) return 3; } else { // Kernels from kernel.org - if (kver >= NETDATA_EBPF_KERNEL_7_0) + if (kver == NETDATA_EBPF_KERNEL_6_16_2) + return 14; + else if (kver >= NETDATA_EBPF_KERNEL_7_0) return 13; else if (kver >= NETDATA_EBPF_KERNEL_6_12) return 12; @@ -1227,6 +1215,8 @@ static uint32_t ebpf_select_index(uint32_t kernels, int rhf_version, uint32_t kv if (rhf_version == -1) kernels &= ~NETDATA_V5_14; + if (rhf_version <= 0 && kver == NETDATA_EBPF_KERNEL_6_16_2) + kernels &= ~NETDATA_V7_0; for (idx = start; idx; idx--) { if (kernels & 1 << idx) @@ -2423,9 +2413,8 @@ static void ebpf_run_netdata_tests(int rhf_version, uint32_t kver, int is_return ebpf_detect_map_support(&map_support, rhf_version, kver); while (ebpf_modules[i].name) { if (!strcmp(ebpf_modules[i].name, "disk") && - ((rhf_version <= 0 && kver >= NETDATA_EBPF_KERNEL_6_16) || - (rhf_version > 0 && kver >= NETDATA_EBPF_KERNEL_5_17 && - !ebpf_is_rhel10_6_12_stream(rhf_version, kver)))) { + (rhf_version > 0 && kver >= NETDATA_EBPF_KERNEL_5_17 && + !ebpf_is_rhel10_6_12_stream(rhf_version, kver))) { i++; continue; } @@ -2475,10 +2464,15 @@ static void ebpf_run_netdata_tests(int rhf_version, uint32_t kver, int is_return ((use_buffer_mode && ebpf_modules[i].buffer_kernels) ? ebpf_modules[i].buffer_kernels : ebpf_modules[i].kernels); int rhel10 = ebpf_is_rhel10_6_12_stream(rhf_version, kver); - int generic612 = rhf_version <= 0 && kver >= NETDATA_EBPF_KERNEL_6_12 && - kver < NETDATA_EBPF_KERNEL_6_12 + 256; + int generic612 = rhf_version <= 0 && kver >= NETDATA_EBPF_KERNEL_6_12; if (rhel10 || generic612) kernels_to_use |= NETDATA_V6_12; + if (rhf_version <= 0 && kver == NETDATA_EBPF_KERNEL_6_16_2) { + if (use_buffer_mode || use_arena_mode || !strcmp(ebpf_modules[i].name, "disk") || + !strcmp(ebpf_modules[i].name, "swap")) + kernels_to_use |= NETDATA_V6_16_2; + kernels_to_use &= ~NETDATA_V7_0; + } uint32_t max_idx = ebpf_select_max_index(rhf_version, kver); uint32_t idx = !strcmp(ebpf_modules[i].name, "disk") ? ebpf_select_disk_index(kernels_to_use, rhf_version, kver) @@ -3054,9 +3048,6 @@ int main(int argc, char **argv) const char *reason = NULL; if (!(flags & ebpf_modules[i].flags)) reason = "not selected by flags"; - else if (!strcmp(ebpf_modules[i].name, "disk") && rhf_version <= 0 && - my_kernel >= NETDATA_EBPF_KERNEL_6_16) - reason = "disabled on generic kernels >= 6.16"; else if (arena_mode && !ebpf_module_has_arena(ebpf_modules[i].name)) reason = "arena flavor unavailable"; else if (buffer_mode && !ebpf_module_has_buffer(ebpf_modules[i].name)) diff --git a/tests/tester_user.h b/tests/tester_user.h index b59bc86d..3991e719 100644 --- a/tests/tester_user.h +++ b/tests/tester_user.h @@ -57,7 +57,8 @@ enum netdata_ebpf_kernel_versions { NETDATA_EBPF_KERNEL_6_9 = 395520, // 395520 = 6 * 65536 + 9 * 256 NETDATA_EBPF_KERNEL_6_12 = 396288, // 396288 = 6 * 65536 + 12 * 256 NETDATA_EBPF_KERNEL_6_16 = 397312, // 397312 = 6 * 65536 + 16 * 256 - NETDATA_EBPF_KERNEL_7_0 = 458752 // 458752 = 7 * 65536 + NETDATA_EBPF_KERNEL_7_0 = 458752, // 458752 = 7 * 65536 + NETDATA_EBPF_KERNEL_6_16_2 = 397314 // 397314 = 6 * 65536 + 16 * 256 + 2 }; /** @@ -80,7 +81,8 @@ enum netdata_kernel_flag { NETDATA_V5_17 = 1 << 10, NETDATA_V6_8 = 1 << 11, NETDATA_V6_12 = 1 << 12, - NETDATA_V7_0 = 1 << 13 + NETDATA_V7_0 = 1 << 13, + NETDATA_V6_16_2 = 1 << 14 }; enum netdata_kernel_counter { @@ -98,6 +100,7 @@ enum netdata_kernel_counter { NETDATA_6_8, NETDATA_6_12, NETDATA_7_0, + NETDATA_6_16_2, NETDATA_VERSION_END };