From 935e9742a506e9d85c5b1aacc74852068e314ea2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 7 Feb 2018 20:17:54 +0000 Subject: [PATCH 01/77] - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 5598469..86d904a 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 25 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Linux kernel module management utilities Group: System Environment/Kernel @@ -109,6 +109,9 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Wed Feb 07 2018 Fedora Release Engineering - 25-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + * Tue Jan 09 2018 Josh Boyer - 25-1 - Update to version 25 (rhbz 1532597) From b589e5d5fd9c7ef67dafbeacbf355fae70431b77 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 13 Feb 2018 23:36:41 +0100 Subject: [PATCH 02/77] Remove BuildRoot definition None of currently supported distributions need that. It was needed last for EL5 which is EOL now Signed-off-by: Igor Gnatenko --- kmod.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 86d904a..69fae1e 100644 --- a/kmod.spec +++ b/kmod.spec @@ -10,7 +10,6 @@ Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.t Source1: weak-modules Exclusiveos: Linux -BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRequires: chrpath BuildRequires: zlib-devel BuildRequires: xz-devel From f85d022c8bf3711bd9145e87be78e84003a904ab Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Thu, 21 Jun 2018 20:07:54 +0530 Subject: [PATCH 03/77] CI: Add libkmod to tests. 1. Fix sanity tests. 2. Add libkmod to test ``` gcc -o test-libkmod test-libkmod.c -lkmod -lcmocka ./runtest.sh :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: TEST PROTOCOL :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Package : kmod-devel Installed : kmod-devel-25-2.fc28.x86_64 beakerlib RPM : beakerlib-1.17-13.fc28.noarch Test version : 1.0 Test started : 2018-06-21 20:07:27 IST Test finished : Test duration : Test name : /CoreOS/libkmod Distro : Fedora release 28 (Twenty Eight) Hostname : Zeus Architecture : x86_64 CPUs : 8 x Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz RAM size : 31542 MB HDD size : 452.94 GB :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Setup :: Setup :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ 20:07:27 ] :: [ PASS ] :: File /usr/lib/modules/4.16.15-300.fc28.x86_64/kernel/net/ipv4/ipip.ko.xz should exist :: [ 20:07:27 ] :: [ BEGIN ] :: Running 'cp test-libkmod /usr/bin/' :: [ 20:07:27 ] :: [ PASS ] :: Command 'cp test-libkmod /usr/bin/' (Expected 0, got 0) :: [ 20:07:27 ] :: [ PASS ] :: Command 'cp test-libkmod /usr/bin/' (Expected 0, got 0) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Duration: 0s :: Duration: 0s :: Assertions: 3 good, 0 bad :: Assertions: 3 good, 0 bad :: RESULT: PASS :: RESULT: PASS :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Test :: Test :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ 20:07:27 ] :: [ LOG ] :: Starting libkmod tests ... :: [ 20:07:27 ] :: [ LOG ] :: Starting libkmod tests ... :: [ 20:07:27 ] :: [ BEGIN ] :: Running '/usr/bin/test-libkmod' [==========] Running 2 test(s). [ RUN ] test_load_module [ OK ] test_load_module [ RUN ] test_remove_module [ OK ] test_remove_module [==========] 2 test(s) run. [ PASSED ] 2 test(s). :: [ 20:07:27 ] :: [ PASS ] :: Command '/usr/bin/test-libkmod' (Expected 0, got 0) :: [ 20:07:27 ] :: [ PASS ] :: Command '/usr/bin/test-libkmod' (Expected 0, got 0) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Duration: 0s :: Duration: 0s :: Assertions: 1 good, 0 bad ``` SANITY: ``` ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: kmod_load_insmod :: kmod_load_insmod :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'insmod /usr/lib/modules/4.16.15-300.fc28.x86_64///kernel/net/ipv4/udp_tunnel.ko.xz' :: [ 20:07:26 ] :: [ PASS ] :: Command 'insmod /usr/lib/modules/4.16.15-300.fc28.x86_64///kernel/net/ipv4/udp_tunnel.ko.xz' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'insmod /usr/lib/modules/4.16.15-300.fc28.x86_64///kernel/net/ipv4/udp_tunnel.ko.xz' (Expected 0, got 0) :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'lsmod | grep udp_tunnel' udp_tunnel 16384 0 :: [ 20:07:26 ] :: [ PASS ] :: Command 'lsmod | grep udp_tunnel' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'lsmod | grep udp_tunnel' (Expected 0, got 0) :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'rmmod udp_tunnel' :: [ 20:07:26 ] :: [ PASS ] :: Command 'rmmod udp_tunnel' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'rmmod udp_tunnel' (Expected 0, got 0) :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'lsmod | grep udp_tunnel' :: [ 20:07:26 ] :: [ PASS ] :: Command 'lsmod | grep udp_tunnel' (Expected 1-255, got 1) :: [ 20:07:26 ] :: [ PASS ] :: Command 'lsmod | grep udp_tunnel' (Expected 1-255, got 1) :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'insmod /usr/lib/modules/4.16.15-300.fc28.x86_64///kernel/net/wireless/lib80211.ko.xz' :: [ 20:07:26 ] :: [ PASS ] :: Command 'insmod /usr/lib/modules/4.16.15-300.fc28.x86_64///kernel/net/wireless/lib80211.ko.xz' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'insmod /usr/lib/modules/4.16.15-300.fc28.x86_64///kernel/net/wireless/lib80211.ko.xz' (Expected 0, got 0) :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'lsmod | grep lib80211' lib80211 16384 0 :: [ 20:07:26 ] :: [ PASS ] :: Command 'lsmod | grep lib80211' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'lsmod | grep lib80211' (Expected 0, got 0) :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'rmmod lib80211' :: [ 20:07:26 ] :: [ PASS ] :: Command 'rmmod lib80211' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'rmmod lib80211' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'rmmod lib80211' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'rmmod lib80211' (Expected 0, got 0) :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'lsmod | grep lib80211' :: [ 20:07:26 ] :: [ PASS ] :: Command 'lsmod | grep lib80211' (Expected 1-255, got 1) :: [ 20:07:26 ] :: [ PASS ] :: Command 'lsmod | grep lib80211' (Expected 1-255, got 1) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Duration: 0s :: Duration: 0s :: Assertions: 8 good, 0 bad :: Assertions: 8 good, 0 bad :: RESULT: PASS :: RESULT: PASS :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: kmod_load_modprobe :: kmod_load_modprobe :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'modprobe tun' :: [ 20:07:26 ] :: [ PASS ] :: Command 'modprobe tun' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'modprobe tun' (Expected 0, got 0) :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'modprobe -r tun' :: [ 20:07:26 ] :: [ PASS ] :: Command 'modprobe -r tun' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'modprobe -r tun' (Expected 0, got 0) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Duration: 0s :: Duration: 0s :: Assertions: 2 good, 0 bad :: Assertions: 2 good, 0 bad :: RESULT: PASS :: RESULT: PASS :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: kmod_modinfo :: kmod_modinfo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'modinfo -l udp_tunnel' GPL :: [ 20:07:26 ] :: [ PASS ] :: Command 'modinfo -l udp_tunnel' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'modinfo -l udp_tunnel' (Expected 0, got 0) :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'modinfo -l lib80211' GPL :: [ 20:07:26 ] :: [ PASS ] :: Command 'modinfo -l lib80211' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'modinfo -l lib80211' (Expected 0, got 0) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Duration: 0s :: Duration: 0s :: Assertions: 2 good, 0 bad :: Assertions: 2 good, 0 bad :: RESULT: PASS :: RESULT: PASS :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Duration: 0s :: Duration: 0s :: Assertions: 12 good, 0 bad :: Assertions: 12 good, 0 bad :: RESULT: PASS :: RESULT: PASS gre 16384 0 uwb 90112 0 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Modprobe with wrong parameter :: Modprobe with wrong parameter :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'modprobe atm BADPARAM=this_should_fail' :: [ 20:07:26 ] :: [ LOG ] :: Output of 'modprobe atm BADPARAM=this_should_fail': :: [ 20:07:26 ] :: [ LOG ] :: Output of 'modprobe atm BADPARAM=this_should_fail': :: [ 20:07:26 ] :: [ LOG ] :: --------------- OUTPUT START --------------- :: [ 20:07:26 ] :: [ LOG ] :: --------------- OUTPUT START --------------- :: [ 20:07:26 ] :: [ LOG ] :: --------------- OUTPUT END --------------- :: [ 20:07:26 ] :: [ LOG ] :: --------------- OUTPUT END --------------- :: [ 20:07:26 ] :: [ PASS ] :: Command 'modprobe atm BADPARAM=this_should_fail' (Expected 0-1, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'modprobe atm BADPARAM=this_should_fail' (Expected 0-1, got 0) :: [ 20:07:26 ] :: [ BEGIN ] :: Running 'dmesg | grep -i 'Unknown parameter' | grep 'BADPARAM' | grep 'atm'' [17881.492103] atm: unknown parameter 'BADPARAM' ignored :: [ 20:07:26 ] :: [ LOG ] :: Output of 'dmesg | grep -i 'Unknown parameter' | grep 'BADPARAM' | grep 'atm'': :: [ 20:07:26 ] :: [ LOG ] :: Output of 'dmesg | grep -i 'Unknown parameter' | grep 'BADPARAM' | grep 'atm'': :: [ 20:07:26 ] :: [ LOG ] :: --------------- OUTPUT START --------------- :: [ 20:07:26 ] :: [ LOG ] :: --------------- OUTPUT START --------------- :: [ 20:07:26 ] :: [ LOG ] :: [17881.492103] atm: unknown parameter 'BADPARAM' ignored :: [ 20:07:26 ] :: [ LOG ] :: [17881.492103] atm: unknown parameter 'BADPARAM' ignored :: [ 20:07:26 ] :: [ LOG ] :: --------------- OUTPUT END --------------- :: [ 20:07:26 ] :: [ LOG ] :: --------------- OUTPUT END --------------- :: [ 20:07:26 ] :: [ PASS ] :: Command 'dmesg | grep -i 'Unknown parameter' | grep 'BADPARAM' | grep 'atm'' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'dmesg | grep -i 'Unknown parameter' | grep 'BADPARAM' | grep 'atm'' (Expected 0, got 0) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Duration: 0s :: Duration: 0s :: Assertions: 2 good, 0 bad :: Assertions: 2 good, 0 bad :: RESULT: PASS :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Test :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: kmod_load_insmod :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ 20:07:26 ] :: [ PASS ] :: Command 'insmod /usr/lib/modules/4.16.15-300.fc28.x86_64///kernel/net/ipv4/udp_tunnel.ko.xz' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'lsmod | grep udp_tunnel' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'rmmod udp_tunnel' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'lsmod | grep udp_tunnel' (Expected 1-255, got 1) :: [ 20:07:26 ] :: [ PASS ] :: Command 'insmod /usr/lib/modules/4.16.15-300.fc28.x86_64///kernel/net/wireless/lib80211.ko.xz' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'lsmod | grep lib80211' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'rmmod lib80211' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'lsmod | grep lib80211' (Expected 1-255, got 1) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Duration: 0s :: Assertions: 8 good, 0 bad :: RESULT: PASS :: [ 20:07:26 ] :: [ PASS ] :: Command 'modprobe tun' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'modprobe -r tun' (Expected 0, got 0) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Duration: 0s :: Assertions: 2 good, 0 bad :: RESULT: PASS :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: kmod_modinfo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ 20:07:26 ] :: [ PASS ] :: Command 'modinfo -l udp_tunnel' (Expected 0, got 0) :: [ 20:07:26 ] :: [ PASS ] :: Command 'modinfo -l lib80211' (Expected 0, got 0) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Duration: 0s :: Assertions: 2 good, 0 bad :: RESULT: PASS :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Duration: 0s :: Assertions: 12 good, 0 bad :: RESULT: PASS :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Modprobe with wrong parameter :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ 20:07:26 ] :: [ LOG ] :: Output of 'modprobe atm BADPARAM=this_should_fail': :: [ 20:07:26 ] :: [ LOG ] :: --------------- OUTPUT START --------------- :: [ 20:07:26 ] :: [ LOG ] :: --------------- OUTPUT END --------------- :: [ 20:07:26 ] :: [ PASS ] :: Command 'modprobe atm BADPARAM=this_should_fail' (Expected 0-1, got 0) :: [ 20:07:26 ] :: [ LOG ] :: Output of 'dmesg | grep -i 'Unknown parameter' | grep 'BADPARAM' | grep 'atm'': :: [ 20:07:26 ] :: [ LOG ] :: --------------- OUTPUT START --------------- :: [ 20:07:26 ] :: [ LOG ] :: [17881.492103] atm: unknown parameter 'BADPARAM' ignored :: [ 20:07:26 ] :: [ LOG ] :: --------------- OUTPUT END --------------- :: [ 20:07:26 ] :: [ PASS ] :: Command 'dmesg | grep -i 'Unknown parameter' | grep 'BADPARAM' | grep 'atm'' (Expected 0, got 0) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ``` --- tests/libkmod/Makefile | 46 +++++++++++++++++++++ tests/libkmod/runtest.sh | 36 ++++++++++++++++ tests/libkmod/test-libkmod.c | 79 ++++++++++++++++++++++++++++++++++++ tests/sanity/Makefile | 2 - tests/sanity/runtest.sh | 2 - tests/tests.yml | 7 +++- 6 files changed, 167 insertions(+), 5 deletions(-) create mode 100644 tests/libkmod/Makefile create mode 100755 tests/libkmod/runtest.sh create mode 100644 tests/libkmod/test-libkmod.c diff --git a/tests/libkmod/Makefile b/tests/libkmod/Makefile new file mode 100644 index 0000000..cc53a81 --- /dev/null +++ b/tests/libkmod/Makefile @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: LGPL-2.1+ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/libkmod +# Description: Test if libkmod working ok +# Author: Susant Sahani +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +export TEST=/CoreOS/libkmod +export TESTVERSION=1.0 + +OBJS = test-libkmod.c +CFLAG = -Wall -g3 +CC = gcc +LIBS = -lkmod -lcmocka + +test-libkmod:${OBJ} + ${CC} ${CFLAGS} ${INCLUDES} -o $@ ${OBJS} ${LIBS} + +run: test-libkmod + ./runtest.sh +clean: + -rm -f test-libkmod + +.c.o: + ${CC} ${CFLAGS} ${INCLUDES} -c $< + +CC = gcc + +include /usr/share/rhts/lib/rhts-make.include +$(METADATA): Makefile + @echo "Owner: Susant Sahani" > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test libkmod works ok" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: libkmod" >> $(METADATA) + @echo "Requires: libkmod libkmod-devel" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -Fedora 29" >> $(METADATA) + rhts-lint $(METADATA) diff --git a/tests/libkmod/runtest.sh b/tests/libkmod/runtest.sh new file mode 100755 index 0000000..1ef013c --- /dev/null +++ b/tests/libkmod/runtest.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# SPDX-License-Identifier: LGPL-2.1+ +# ~~~ +# runtest.sh of libkmod +# Description: Tests for libkmod. +# +# Author: Susant Sahani +# Copyright (c) 2018 Red Hat, Inc. +# ~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="kmod-devel" +IPIP="/usr/lib/modules/$(uname -r)/kernel/net/ipv4/ipip.ko.xz" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlAssertExists "$IPIP" + rlRun "cp test-libkmod /usr/bin/" + rlPhaseEnd + + rlPhaseStartTest + rlLog "Starting libkmod tests ..." + rlRun "/usr/bin/test-libkmod" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "rm /usr/bin/test-libkmod" + rlLog "libkmod tests done" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd + +rlGetTestState diff --git a/tests/libkmod/test-libkmod.c b/tests/libkmod/test-libkmod.c new file mode 100644 index 0000000..507e581 --- /dev/null +++ b/tests/libkmod/test-libkmod.c @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: LGPL-2.1+ +# ~~~ +# Description: Tests libkmod +# +# Author: Susant Sahani +# Copyright (c) 2018 Red Hat, Inc. +# ~~~ +*/ + +#include +#include +#include +#include +#include +#include +#include + +static int load_module(void **state) { + struct kmod_list *list = NULL; + struct kmod_ctx *ctx = NULL; + struct kmod_list *l; + int r; + + assert_non_null((ctx = kmod_new(NULL, NULL))); + assert_return_code(kmod_module_new_from_lookup(ctx, "ipip", &list), 0); + + kmod_list_foreach(l, list) { + struct kmod_module *mod = NULL; + + mod = kmod_module_get_module(l); + assert_non_null(mod); + + assert_return_code(kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, NULL), 0); + } + + free(ctx); + + return 0; +} + +static int remove_module(void **state) { + struct kmod_list *list = NULL; + struct kmod_ctx *ctx = NULL; + struct kmod_list *l; + int r; + + assert_non_null((ctx = kmod_new(NULL, NULL))); + assert_return_code(kmod_module_new_from_lookup(ctx, "ipip", &list), 0); + + kmod_list_foreach(l, list) { + struct kmod_module *mod = NULL; + + mod = kmod_module_get_module(l); + assert_non_null(mod); + + assert_return_code(kmod_module_remove_module(mod, 0), 0); + } + + free(ctx); + + return 0; +} + +void test_load_module(void **state) { + load_module(NULL); +} + +void test_remove_module(void **state) { + remove_module(NULL); +} + +int main(int argc, char *argv[]) { + const struct CMUnitTest libmod_tests[] = { + cmocka_unit_test_teardown(test_load_module, remove_module), + cmocka_unit_test_setup(test_remove_module, load_module), + }; + + return cmocka_run_group_tests(libmod_tests, NULL, NULL); +} diff --git a/tests/sanity/Makefile b/tests/sanity/Makefile index 9ea4f00..e422f7f 100644 --- a/tests/sanity/Makefile +++ b/tests/sanity/Makefile @@ -76,6 +76,4 @@ $(METADATA): Makefile @echo "License: GPLv2" >> $(METADATA) @echo "Confidential: no" >> $(METADATA) @echo "Destructive: no" >> $(METADATA) - @echo "RhtsRequires: kernel-kernel-general-include" >> $(METADATA) rhts-lint $(METADATA) - diff --git a/tests/sanity/runtest.sh b/tests/sanity/runtest.sh index a0888d4..815972f 100755 --- a/tests/sanity/runtest.sh +++ b/tests/sanity/runtest.sh @@ -28,7 +28,6 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Include Beaker environment -. /usr/bin/rhts-environment.sh || exit 1 . /usr/share/beakerlib/beakerlib.sh || exit 1 . lib.sh @@ -133,4 +132,3 @@ rlJournalStart rlJournalPrintText rlJournalEnd - diff --git a/tests/tests.yml b/tests/tests.yml index d362e9f..828a27a 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -5,9 +5,14 @@ - role: standard-test-beakerlib tests: - sanity + - libkmod required_packages: - kernel - perf - sysstat - trace-cmd - + - kmod + - kmod-devel + - gcc + - libcmocka + - libcmocka-devel From 93869890fd5bdb30a278ed1305816e0bfaaeaf42 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 9 Jul 2018 19:06:47 +0200 Subject: [PATCH 04/77] add BuildRequires: gcc Reference: https://fedoraproject.org/wiki/Changes/Remove_GCC_from_BuildRoot --- kmod.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/kmod.spec b/kmod.spec index 69fae1e..8cd2dad 100644 --- a/kmod.spec +++ b/kmod.spec @@ -10,6 +10,7 @@ Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.t Source1: weak-modules Exclusiveos: Linux +BuildRequires: gcc BuildRequires: chrpath BuildRequires: zlib-devel BuildRequires: xz-devel From d107c9fe8f097b48d6f6f9833f41f6d2b6559fe3 Mon Sep 17 00:00:00 2001 From: Jason Tibbitts Date: Tue, 10 Jul 2018 01:31:55 -0500 Subject: [PATCH 05/77] Remove needless use of %defattr --- kmod.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 8cd2dad..9cde5e8 100644 --- a/kmod.spec +++ b/kmod.spec @@ -81,7 +81,6 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %postun libs -p /sbin/ldconfig %files -%defattr(-,root,root,-) %dir %{_sysconfdir}/depmod.d %dir %{_sysconfdir}/modprobe.d %dir %{_prefix}/lib/modprobe.d From 19d0c2fbaa2a62467e4b922ce16dfc3fb8dd35d4 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 13 Jul 2018 07:18:34 +0000 Subject: [PATCH 06/77] - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 9cde5e8..b2e4e6f 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 25 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Linux kernel module management utilities Group: System Environment/Kernel @@ -108,6 +108,9 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Fri Jul 13 2018 Fedora Release Engineering - 25-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + * Wed Feb 07 2018 Fedora Release Engineering - 25-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild From 2c9e5ae971c3149a0985e450bd8a332ae996513d Mon Sep 17 00:00:00 2001 From: James Antill Date: Tue, 30 Oct 2018 06:42:21 -0400 Subject: [PATCH 07/77] Remove ldconfig scriptlet, now done via. transfiletrigger in glibc. --- kmod.spec | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kmod.spec b/kmod.spec index b2e4e6f..59f255b 100644 --- a/kmod.spec +++ b/kmod.spec @@ -76,10 +76,6 @@ mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d mkdir -p $RPM_BUILD_ROOT/sbin install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules -%post libs -p /sbin/ldconfig - -%postun libs -p /sbin/ldconfig - %files %dir %{_sysconfdir}/depmod.d %dir %{_sysconfdir}/modprobe.d @@ -108,6 +104,9 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Mon Oct 29 2018 James Antill +- Remove ldconfig scriptlet, now done via. transfiletrigger in glibc. + * Fri Jul 13 2018 Fedora Release Engineering - 25-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild From 43bb7bcca23dd6a2e463e19f67d054064e0d50d1 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Tue, 30 Oct 2018 06:44:08 -0400 Subject: [PATCH 08/77] Bump for build --- kmod.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kmod.spec b/kmod.spec index 59f255b..e3fc442 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 25 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Linux kernel module management utilities Group: System Environment/Kernel @@ -104,8 +104,8 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog -* Mon Oct 29 2018 James Antill -- Remove ldconfig scriptlet, now done via. transfiletrigger in glibc. +* Mon Oct 29 2018 James Antill - 25-4 +- Remove ldconfig scriptlet, now done via. transfiletrigger in glibc (rhbz 1644063) * Fri Jul 13 2018 Fedora Release Engineering - 25-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild From 32fd52f37c411cc062dd8521ddabe10da5d13377 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 28 Jan 2019 20:17:50 +0100 Subject: [PATCH 09/77] Remove obsolete Group tag References: https://fedoraproject.org/wiki/Changes/Remove_Group_Tag --- kmod.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/kmod.spec b/kmod.spec index e3fc442..0fd7aeb 100644 --- a/kmod.spec +++ b/kmod.spec @@ -3,7 +3,6 @@ Version: 25 Release: 4%{?dist} Summary: Linux kernel module management utilities -Group: System Environment/Kernel License: GPLv2+ URL: http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.tar.xz @@ -29,7 +28,6 @@ examples of loaded and unloaded modules. %package libs Summary: Libraries to handle kernel module loading and unloading License: LGPLv2+ -Group: System Environment/Libraries %description libs The kmod-libs package provides runtime libraries for any application that @@ -37,7 +35,6 @@ wishes to load or unload Linux kernel modules from the running system. %package devel Summary: Header files for kmod development -Group: Development/Libraries Requires: %{name}-libs%{?_isa} = %{version}-%{release} %description devel From 9f7b1db5d38bda474314794c3bbb483197f2ccd1 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 1 Feb 2019 05:52:28 +0000 Subject: [PATCH 10/77] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 0fd7aeb..d79a0ce 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 25 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -101,6 +101,9 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Fri Feb 01 2019 Fedora Release Engineering - 25-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Mon Oct 29 2018 James Antill - 25-4 - Remove ldconfig scriptlet, now done via. transfiletrigger in glibc (rhbz 1644063) From b159b7c148626ed20b106589040af0d72de97c7b Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Sun, 24 Feb 2019 19:11:20 +0200 Subject: [PATCH 11/77] Update to version 26 (rhbz 1673749) Signed-off-by: Yauheni Kaliuta --- .gitignore | 1 + kmod.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index febc0e0..9e55472 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ /kmod-23.tar.xz /kmod-24.tar.xz /kmod-25.tar.xz +/kmod-26.tar.xz diff --git a/kmod.spec b/kmod.spec index d79a0ce..ec3d436 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod -Version: 25 -Release: 5%{?dist} +Version: 26 +Release: 1%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -101,6 +101,9 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Sun Feb 24 2019 Yauheni Kaliuta - 26-1 +- Update to version 26 (rhbz 1673749) + * Fri Feb 01 2019 Fedora Release Engineering - 25-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild diff --git a/sources b/sources index 994a620..1681452 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (kmod-25.tar.xz) = d579cd0cea24a06362a74927b7a3c777e9e01c990306e1032e4781cd441ffe435c70f2c2c4f6ae39eb1d857e622746411d5824d0c0d8bb79f91dc9fa51956252 +SHA512 (kmod-26.tar.xz) = 3ca276c6fc13c2dd2220ec528b8dc4ab4edee5d2b22e16b6f945c552e51f74342c01c33a53740e6af8c893d42bd4d6f629cd8fa6e15ef8bd8da30cb003ef0865 From 434a6d5d65bc6f70a6557fa9e4b131c91ee37fa0 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Sun, 24 Feb 2019 19:48:49 +0200 Subject: [PATCH 12/77] add PKCS7/openssl support (rhbz 1320921) Signed-off-by: Yauheni Kaliuta --- kmod.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index ec3d436..5c6d4de 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 26 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -14,6 +14,7 @@ BuildRequires: chrpath BuildRequires: zlib-devel BuildRequires: xz-devel BuildRequires: libxslt +BuildRequires: openssl-devel Provides: module-init-tools = 4.0-1 Obsoletes: module-init-tools < 4.0-1 @@ -47,6 +48,7 @@ applications that wish to load or unload Linux kernel modules. %build export V=1 %configure \ + --with-openssl \ --with-zlib \ --with-xz make %{?_smp_mflags} @@ -101,6 +103,9 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Sun Feb 24 2019 Yauheni Kaliuta - 26-2 +- add PKCS7/openssl support (rhbz 1320921) + * Sun Feb 24 2019 Yauheni Kaliuta - 26-1 - Update to version 26 (rhbz 1673749) From 559b043f513e17ca89cd062f6f56f48209ccb390 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Mon, 25 Feb 2019 15:10:47 +0200 Subject: [PATCH 13/77] weak-modules: sync with RHEL Signed-off-by: Yauheni Kaliuta --- weak-modules | 1095 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 871 insertions(+), 224 deletions(-) diff --git a/weak-modules b/weak-modules index 4b621e9..db1839c 100644 --- a/weak-modules +++ b/weak-modules @@ -3,10 +3,14 @@ # weak-modules - determine which modules are kABI compatible with installed # kernels and set up the symlinks in /lib/*/weak-updates. # -# Changelog: -# -# 2010/01/10 - Further updates for dracut use on Fedora/RHEL (jcm). -# 2009/09/16 - Rebase and add a bunch of updates for dracut (jcm). +# This is an updated version of the script which doesn't support +# multiple installation of the same out-of-tree module (stored in the +# 'extra' subdirectory) for multiple kernels. This assumption is +# supposed to be verified at the rpm level of the packages delivering +# these modules. There are some checks for this assumption, however we +# really don't solve this situation. This limitation allows for a much +# simpler version of the script. Previous version tried to work in this +# case but was incorrect in some cases. unset LANG LC_ALL LC_COLLATE @@ -14,14 +18,19 @@ tmpdir=$(mktemp -td ${0##*/}.XXXXXX) trap "rm -rf $tmpdir" EXIT unset ${!changed_modules_*} ${!changed_initramfs_*} -initramfs_prefix="/boot" # can customize here +unset BASEDIR +unset CHECK_INITRAMFS +weak_updates_dir_override="" +default_initramfs_prefix="/boot" # will be combined with BASEDIR dracut="/usr/bin/dracut" +depmod="/sbin/depmod" +depmod_orig="$depmod" +declare -a modules +declare -A module_krels +declare -A weak_modules_before -if [ ! -x "$dracut" ] -then - echo "weak-modules: this tool requires a dracut-enabled kernel" - exit 1 -fi +declare -A groups +declare -A grouped_modules # doit: # A wrapper used whenever we're going to perform a real operation. @@ -30,29 +39,82 @@ doit() { [ -n "$dry_run" ] || "$@" } +# pr_verbose: +# print verbose -- wrapper used to print extra messages if required +pr_verbose() { + [ -n "$verbose" ] && echo "$@" +} + +# pr_warning: +# print warning +pr_warning() { + echo "WARNING: $*" +} + # rpmsort: The sort in coreutils can't sort the RPM list how we want it so we # instead transform the list into a form it will sort correctly, then sort. rpmsort() { - local IFS=$' ' - REVERSE="" - rpmlist=($(cat)) + local IFS=$' ' + REVERSE="" + rpmlist=($(cat)) - if [ "-r" == "$1" ]; - then - REVERSE="-r" - fi + if [ "-r" == "$1" ]; + then + REVERSE="-r" + fi - echo ${rpmlist[@]} | \ - sed -e 's/-/../g' | \ - sort ${REVERSE} -n -t"." -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 -k6,6 -k7,7 \ - -k8,8 -k9,9 -k10,10 | \ - sed -e 's/\.\./-/g' + echo ${rpmlist[@]} | \ + sed -e 's/-/../g' | \ + sort ${REVERSE} -n -t"." -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 -k6,6 -k7,7 \ + -k8,8 -k9,9 -k10,10 | \ + sed -e 's/\.\./-/g' +} + +# krel_of_module: +# Compute the kernel release of a module. +krel_of_module() { + local module="$1" + + if [ x"${module_krels[$module]+set}" = x"set" ]; then + # version cached in the array already + echo "${module_krels[$module]}" + elif [ -f "$module" ]; then + krel_of_module_modinfo "$module" + else + # Try to extract the kernel release from the path + # delete case, the .ko already deleted + set -- "${module#*/lib/modules/}" + echo "${1%%/*}" + fi +} + +# krel_of_module_modinfo: +# Fetches module version from internal module info +krel_of_module_modinfo() { + local module="$1" + /sbin/modinfo -F vermagic "$module" | awk '{print $1}' +} + +# weak_updates_dir: +# gives the root directory for the weak-updates +# We need some flexibility here because of dry-run. +weak_updates_dir() { + local krel="$1" + + if [[ -z "$weak_updates_dir_override" ]]; then + echo "$BASEDIR/lib/modules/$krel/weak-updates" + else + echo "$weak_updates_dir_override" + fi } # read_modules_list: # Read in a list of modules from standard input. Convert the filenames into # absolute paths and compute the kernel release for each module (either using # the modinfo section or through the absolute path. +# If used with input redirect, should be used as read_module_list < input, +# not input | read_modules_list, the latter spawns a subshell +# and the arrays are not seen in the caller read_modules_list() { local IFS=$'\n' modules=($(cat)) @@ -61,16 +123,52 @@ read_modules_list() { if [ ${modules[n]:0:1} != '/' ]; then modules[n]="$PWD/${modules[n]}" fi - if [ -f "${modules[n]}" ]; then - module_krels[n]=$(krel_of_module ${modules[n]}) - else - # Try to extract the kernel release from the path - set -- "${modules[n]#/lib/modules/}" - module_krels[n]=${1%%/*} - fi + module_krels["${modules[n]}"]=$(krel_of_module ${modules[n]}) done } +decompress_initramfs() { + local input=$1 + local output=$2 + + # First, check if this is compressed at all + if cpio -i -t < "$input" > /dev/null 2>/dev/null; then + # If this archive contains a file early_cpio, it's a trick. Strip off + # the early cpio archive and try again. + if cpio -i -t < "$input" 2>/dev/null | grep -q '^early_cpio$' ; then + /usr/lib/dracut/skipcpio "$input" > "${tmpdir}/post_early_cpio.img" + decompress_initramfs "${tmpdir}/post_early_cpio.img" "$output" + retval="$?" + rm -f "${tmpdir}/post_early_cpio.img" + return $retval + fi + + cp "$input" "$output" + return 0 + fi + + # Try gzip + if gzip -cd < "$input" > "$output" 2>/dev/null ; then + return 0 + fi + + # Next try xz + if xz -cd < "$input" > "$output" 2>/dev/null ; then + return 0 + fi + + echo "Unable to decompress $input: Unknown format" >&2 + return 1 +} + +# List all module files and modprobe configuration that could require a new +# initramfs. The current directory must be the root of the uncompressed +# initramfs. The unsorted list of files is output to stdout. +list_module_files() { + find . -iname \*.ko -o -iname '*.ko.xz' -o -iname '*.ko.gz' 2>/dev/null + find etc/modprobe.d usr/lib/modprobe.d -name \*.conf 2>/dev/null +} + # read_old_initramfs: compare_initramfs_modules() { local old_initramfs=$1 @@ -81,28 +179,35 @@ compare_initramfs_modules() { mkdir "$tmpdir/old_initramfs" mkdir "$tmpdir/new_initramfs" + decompress_initramfs "$old_initramfs" "$tmpdir/old_initramfs.img" pushd "$tmpdir/old_initramfs" >/dev/null - zcat "$old_initramfs" | cpio -i 2>/dev/null - n=0; for i in `find . -iname \*.ko|sort`; do + cpio -i < "$tmpdir/old_initramfs.img" 2>/dev/null + rm "$tmpdir/old_initramfs.img" + n=0; for i in `list_module_files|sort`; do old_initramfs_modules[n]="$i" n=$((n+1)) done popd >/dev/null + decompress_initramfs "$new_initramfs" "$tmpdir/new_initramfs.img" pushd "$tmpdir/new_initramfs" >/dev/null - zcat "$new_initramfs" | cpio -i 2>/dev/null - n=0; for i in `find . -iname \*.ko|sort`; do + cpio -i < "$tmpdir/new_initramfs.img" 2>/dev/null + rm "$tmpdir/new_initramfs.img" + n=0; for i in `list_module_files|sort`; do new_initramfs_modules[n]="$i" n=$((n+1)) done popd >/dev/null - if [ "${#old_initramfs_modules[@]}" == "${#new_initramfs_modules[@]}" ]; + # Compare the length and contents of the arrays + if [ "${#old_initramfs_modules[@]}" == "${#new_initramfs_modules[@]}" -a \ + "${old_initramfs_modules[*]}" == "${new_initramfs_modules[*]}" ]; then + # If the file lists are the same, compare each file to find any that changed for ((n = 0; n < ${#old_initramfs_modules[@]}; n++)); do - old_md5=`md5sum $tmpdir/old_initramfs/${old_initramfs_modules[n]}|sed -nre 's:(^\ )* .*:\1:p'` - new_md5=`md5sum $tmpdir/new_initramfs/${new_initramfs_modules[n]}|sed -nre 's:(^\ )* .*:\1:p'` - if [ ! "$old_md5" == "$new_md5" ]; + if ! cmp "$tmpdir/old_initramfs/${old_initramfs_modules[n]}" \ + "$tmpdir/new_initramfs/${new_initramfs_modules[n]}" \ + >/dev/null 2>&1 then return 1 fi @@ -128,7 +233,7 @@ check_initramfs() { $dracut -f "$tmp_initramfs" "$kernel" - if ! $(compare_initramfs_modules "$old_initramfs" "$tmp_initramfs"); + if ! compare_initramfs_modules "$old_initramfs" "$tmp_initramfs"; then doit mv "$tmp_initramfs" "$new_initramfs" else @@ -137,71 +242,6 @@ check_initramfs() { fi } -# krel_of_module: -# Compute the kernel release of a module. -krel_of_module() { - declare module=$1 - /sbin/modinfo -F vermagic "$module" | awk '{print $1}' -} - -# module_is_compatible: -# Determine if a module is compatible with a particular kernel release. Also -# include any symbol deps that might be introduced by other external kmods. -module_is_compatible() { - declare module=$1 krel=$2 module_krel=$(krel_of_module "$module") - - if [ ! -e "$tmpdir/all-symvers-$krel-$module_krel" ]; then - # Symbols exported by the "new" kernel - if [ ! -e $tmpdir/symvers-$krel ]; then - if [ -e /boot/symvers-$krel.gz ]; then - zcat /boot/symvers-$krel.gz \ - | sed -r -ne 's:^(0x[0]*[0-9a-f]{8}\t[0-9a-zA-Z_]+)\t.*:\1:p' - fi > $tmpdir/symvers-$krel - fi - - # Symbols that other add-on modules of the "old" kernel export - # (and that this module may require) - if [ ! -e "$tmpdir/extra-symvers-$module_krel" ]; then - if [ -e /lib/modules/$module_krel/extra ] && \ - [ -n "`find /lib/modules/$module_krel/extra -type f`" ]; then - find /lib/modules/$module_krel/extra -name '*.ko' \ - | xargs nm \ - | sed -nre 's:^[0]*([0-9a-f]{8}) A __crc_(.*):0x\1 \2:p' - fi > $tmpdir/extra-symvers-$module_krel - fi - - sort -u $tmpdir/symvers-$krel $tmpdir/extra-symvers-$module_krel \ - > "$tmpdir/all-symvers-$krel-$module_krel" - fi - - # If the module does not have modversions enabled, $tmpdir/modvers - # will be empty. - /sbin/modprobe --dump-modversions "$module" \ - | sed -r -e 's:^(0x[0]*[0-9a-f]{8}\t.*):\1:' \ - | sort -u \ - > $tmpdir/modvers - - # Only include lines of the second file in the output that don't - # match lines in the first file. (The default separator is - # , so we are matching the whole line.) - join -j 1 -v 2 $tmpdir/all-symvers-$krel-$module_krel \ - $tmpdir/modvers > $tmpdir/join - - if [ ! -s $tmpdir/modvers ]; then - echo "Warning: Module ${module##*/} from kernel $module_krel has no" \ - "modversions, so it cannot be reused for kernel $krel" >&2 - elif [ -s $tmpdir/join ]; then - [ -n "$verbose" ] && - echo "Module ${module##*/} from kernel $module_krel is not compatible" \ "with kernel $krel in symbols:" $(sed -e 's:.* ::' $tmpdir/join) - else - [ -n "$verbose" ] && - echo "Module ${module##*/} from kernel $module_krel is compatible" \ - "with kernel $krel" - return 0 - fi - return 1 -} - usage() { echo "Usage: ${0##*/} [options] {--add-modules|--remove-modules}" echo "${0##*/} [options] {--add-kernel|--remove-kernel} {kernel-release}" @@ -214,8 +254,7 @@ usage() { --remove-modules Remove compatibility symlinks from weak-updates/ directories for a list of modules. The list of modules is read from - standard input. Optionally specify --delete-modules to - prevent weak-modules from attempting to locate any + standard input. Note: it doesn't attempt to locate any compatible modules to replace those being removed. --add-kernel @@ -227,7 +266,7 @@ usage() { kernel. --no-initramfs - Do not generate an initramfs. + Do not generate an initramfs. --verbose Print the commands executed. @@ -244,8 +283,11 @@ EOF module_has_changed() { declare module=$1 krel=$2 + declare orig_module=$module module=${module%.ko} + [[ $module == $orig_module ]] && module=${module%.ko.xz} + [[ $module == $orig_module ]] && module=${module%.ko.gz} module=${module##*/} eval "changed_modules_${krel//[^a-zA-Z0-9]/_}=$krel" @@ -253,134 +295,713 @@ module_has_changed() { } -# add_modules: -# Read in a list of modules from stdinput and process them for compatibility -# with installed kernels under /lib/modules. -add_modules() { - read_modules_list || exit 1 - if [ ${#modules[@]} -gt 0 ]; then - for krel in $(ls /lib/modules/); do - [ -e "/boot/symvers-$krel.gz" ] || continue - for ((n = 0; n < ${#modules[@]}; n++)); do - module="${modules[n]}" - module_krel="${module_krels[n]}" - case "$module" in - /lib/modules/$krel/*) - # Module was built against this kernel, update initramfs. - module_has_changed $module $krel - continue ;; - esac +# module_weak_link: +# Generate a weak link path for the module. +# Takes module file name and the target kernel release as arguments +# The way of generation intentionally left from the initial version +module_weak_link() { + local module="$1" + local krel="$2" + local module_krel + local subpath + local module_krel_escaped - # Module my also serve as a weak-update built against another - # kernel. We need to create symlinks for compatible kernels - # under /lib/modules and rerun depmod/dracut for those. + module_krel="$(krel_of_module "$module")" + module_krel_escaped=$(echo "$module_krel" | \ + sed 's/\([.+?^$\/\\|()\[]\|\]\)/\\\0/g') + subpath=$(echo $module | sed -nre "s:$BASEDIR(/usr)?/lib/modules/$module_krel_escaped/([^/]*)/(.*):\3:p") - subpath=`echo $module | sed -nre "s:/lib/modules/$module_krel/([^/]*)/(.*):\2:p"` - weak_module="/lib/modules/$krel/weak-updates/${subpath#/}" - if [ -r "$weak_module" ]; then - weak_krel=$(krel_of_module "$weak_module") - if [ "$weak_krel" != "$module_krel" ] && - [ "$(printf "%s\n" "$weak_krel" "$module_krel" \ - | rpmsort | (read input; echo "$input"; \ - while read input; do true; done))" = \ - "$module_krel" ]; then - # Keep modules from more recent kernels. - [ -n "$verbose" ] && echo \ -"Keeping module ${module##*/} from kernel $weak_krel for kernel $krel" - continue - fi - fi - if module_is_compatible $module $krel; then - doit mkdir -p $(dirname $weak_module) - doit ln -sf $module $weak_module - # Module was built against another kernel, update initramfs. - module_has_changed $module $krel - fi - done - done + if [[ -z $subpath ]]; then + # module is not in /lib/modules/$krel? + # It's possible for example for Oracle ACFS compatibility check + # Install it with its full path as a /lib/modules subpath + subpath="$module" fi + + echo "$(weak_updates_dir $krel)/${subpath#/}" +} + +# module_short_name: +# 'basename' version purely in bash, cuts off path from the filename +module_short_name() { + echo "${1##*/}" +} + +#### Helper predicates + +# is_weak_for_module_valid: +# Takes real module filename and target kernel as arguments. +# Calculates weak symlink filename for the corresponding module +# for the target kernel, +# returns 'true' if the symlink filename is a symlink +# and the symlink points to a readable file +# EVEN if it points to a different filename +is_weak_for_module_valid() { + local module="$1" + local krel="$2" + local weak_link + + weak_link="$(module_weak_link $module $krel)" + [[ -L "$weak_link" ]] && [[ -r "$weak_link" ]] +} + +# is_weak_link: +# Takes a filename and a kernel release. +# 'true' if the filename is symlink under weak-updates/ for the kernel. +# It doesn't matter, if it's a valid symlink (points to a real file) or not. +is_weak_link() { + local link="$1" + local krel="$2" + + echo $link | grep -q "$(weak_updates_dir $krel)" || return 1 + [[ -L $link ]] +} + +# is_extra_exists: +# Takes a module filename, the module's kernel release and target kernel release. +# The module filename should be a real, not a symlink, filename (i.e. in extra/). +# Returns 'true' if the same module exists for the target kernel. +is_extra_exists() { + local module="$1" + local module_krel="$2" + local krel="$3" + local subpath="${module#*/lib/modules/$module_krel/extra/}" + + [[ -f $BASEDIR/lib/modules/$krel/extra/$subpath ]] +} + +is_kernel_installed() { + local krel="$1" + + find_symvers_file "$krel" > /dev/null && + find_systemmap_file "$krel" > /dev/null +} + +is_empty_file() { + local file="$1" + + [[ "$(wc -l "$file" | cut -f 1 -d ' ')" == 0 ]] +} + +#### Helpers + +# find_modules: +# Takes kernel release and a list of subdirectories. +# Produces list of module files in the subdirectories for the kernel +find_modules() { + local krel="$1" + shift + local dirs="$*" + + for dir in $dirs; do + find $BASEDIR/lib/modules/$krel/$dir \ + -name '*.ko' -o -name '*.ko.xz' -o -name '*.ko.gz' \ + 2>/dev/null + done +} + +# find_modules_dirs: +# Takes a list of directories. +# Produces list of module files in the subdirectories +find_modules_dirs() { + local dirs="$*" + + for dir in $dirs; do + find $dir -name '*.ko' -o -name '*.ko.xz' -o -name '*.ko.gz' \ + 2>/dev/null + done +} + +# find_installed_kernels: +# Produces list of kernels, which modules are still installed +find_installed_kernels() { + ls $BASEDIR/lib/modules/ +} + +# find_kernels_with_extra: +# Produces list of kernels, where exists extra/ directory +find_kernels_with_extra() { + local krel + local extra_dir + + for krel in $(find_installed_kernels); do + extra_dir="$BASEDIR/lib/modules/$krel/extra" + [[ -d "$extra_dir" ]] || continue + echo "$krel" + done +} + +# remove_weak_link_quiet: +# Takes symlink filename and target kernel release. +# Removes the symlink and the directory tree +# if it was the last file in the tree +remove_weak_link_quiet() { + local link="$1" + local krel="$2" + local subpath="${link#*$(weak_updates_dir $krel)}" + + rm -f $link + ( cd "$(weak_updates_dir $krel)" && \ + rmdir --parents --ignore-fail-on-non-empty "$(dirname "${subpath#/}")" 2>/dev/null ) +} + +# prepare_sandbox: +# Takes kernel release, creates temporary weak-modules directory for it +# and depmod config to operate on it. +# Sets the global state accordingly + +prepare_sandbox() { + local krel="$1" + local orig_dir + local dir + local conf="$tmpdir/depmod.conf" + + #directory + orig_dir=$(weak_updates_dir $krel) + dir="$tmpdir/$krel/weak-updates" + + mkdir -p "$dir" + # the orig_dir can be empty + cp -R "$orig_dir"/* "$dir" 2>/dev/null + + weak_updates_dir_override="$dir" + + #config + echo "search external extra built-in weak-updates" >"$conf" + echo "external $krel $dir" >>"$conf" + + depmod="$depmod_orig -C $conf" +} + + +# finish_sandbox: +# restore global state after sandboxing +# copy configuration to the kernel directory if not dry run +finish_sandbox() { + local krel="$1" + local override="$weak_updates_dir_override" + local wa_dir + + weak_updates_dir_override="" + depmod="$depmod_orig" + + [[ -n "$dry_run" ]] && return + + wa_dir="$(weak_updates_dir $krel)" + + rm -rf "$wa_dir" + mkdir -p "$wa_dir" + + cp -R "${override}"/* "$wa_dir" 2>/dev/null +} + +# Auxiliary functions to find symvers file +make_kernel_file_names() { + local krel="$1" + local file="$2" + local suffix="$3" + + echo "${BASEDIR}/boot/${file}-${krel}${suffix}" + echo "${BASEDIR}/lib/modules/${krel}/${file}${suffix}" +} + +find_kernel_file() { + local krel="$1" + local file="$2" + local suffix="$3" + local print="$4" + local i + + if [[ "$print" != "" ]]; then + make_kernel_file_names "$krel" "$file" "$suffix" + return 0 + fi + + for i in $(make_kernel_file_names "$krel" "$file" "$suffix"); do + if [[ -r "$i" ]]; then + echo "$i" + return 0 + fi + done + + return 1 +} + +# find_symvers_file: +# Since /boot/ files population process is now controlled by systemd's +# kernel-install bash script and its plug-ins, it might be the case +# that, while present, symvers file is not populated in /boot. +# Let's also check for /lib/modules/$kver/symvers.gz, since that's where +# it is populated from. +# +# $1 - krel +# return - 0 if symvers file is found, 1 otherwise. +# Prints symvers path if found, empty string otherwise. +find_symvers_file() { + local krel="$1" + local print="$2" + + find_kernel_file "$krel" symvers .gz "$print" +} + +# find_systemmap_file: +# Same as above but for System.map +find_systemmap_file() { + local krel="$1" + local print="$2" + local no_suffix="" + + find_kernel_file "$krel" System.map "$no_suffix" "$print" +} + +#### Main logic + +# update_modules_for_krel: +# Takes kernel release and "action" function name. +# Skips kernel without symvers, +# otherwise triggers the main logic of modules installing/removing +# for the given kernel, which is: +# - save current state of weak modules symlinks +# - install/remove the symlinks for the given (via stdin) list of modules +# - validate the state and remove invalid symlinks +# (for the modules, which are not compatible (became incompatible) for +# the given kernel) +# - check the state after validation to produce needed messages +# and trigger initrd regeneration if the list changed. +update_modules_for_krel() { + local krel="$1" + local func="$2" + local force_update="$3" + + is_kernel_installed "$krel" || return + + prepare_sandbox $krel + + global_link_state_save $krel + + $func $krel + + if ! validate_weak_links $krel && [[ -z "$force_update" ]]; then + global_link_state_restore $krel + fi + + global_link_state_announce_changes $krel + + finish_sandbox $krel +} + +# update_modules: +# Common entry point for add/remove modules command +# Takes the "action" function, the module list is supplied via stdin. +# Reads the module list and triggers modules update for all installed +# kernels. +# Triggers initrd rebuild for the kernels, which modules are installed. +update_modules() { + local func="$1" + local force_update="$2" + local module_krel + + read_modules_list || exit 1 + [[ ${#modules[@]} -gt 0 ]] || return + + for krel in $(find_installed_kernels); do + update_modules_for_krel $krel $func $force_update + done + + for module in "${modules[@]}"; do + # Module was built against this kernel, update initramfs. + module_krel="${module_krels[$module]}" + module_has_changed $module $module_krel + done +} + +# add_weak_links: +# Action function for the "add-modules" command +# Takes the kernel release, where the modules are added +# and the modules[] and module_krels[] global arrays. +# Install symlinks for the kernel with minimal checks +# (just filename checks, no symbol checks) +add_weak_links() { + local krel="$1" + local module_krel + local weak_link + + for module in "${modules[@]}"; do + module_krel="$(krel_of_module $module)" + + case "$module" in + /lib/modules/$krel/*) + # Module already installed to the current kernel + continue ;; + esac + + if is_extra_exists $module $module_krel $krel; then + pr_verbose "found $(module_short_name $module) for $krel while installing for $module_krel, update case?" + fi + + if is_weak_for_module_valid $module $krel; then + pr_verbose "weak module for $(module_short_name $module) already exists for kernel $krel, update case?" + # we should update initrd in update case, + # the change is not seen by the symlink detector + # (global_link_state_announce_changes()) + module_has_changed $module $krel + fi + + weak_link="$(module_weak_link $module $krel)" + + mkdir -p "$(dirname $weak_link)" + ln -sf $module $weak_link + + done +} + +# remove_weak_links: +# Action function for the "remove-modules" command +# Takes the kernel release, where the modules are removed +# and the modules[] and module_krels[] global arrays. +# Removes symlinks from the given kernel if they are installed +# for the modules in the list. +remove_weak_links() { + local krel="$1" + local weak_link + local target + local module_krel + + for module in "${modules[@]}"; do + module_krel="$(krel_of_module $module)" + + weak_link="$(module_weak_link $module $krel)" + target="$(readlink $weak_link)" + + if [[ "$module" != "$target" ]]; then + pr_verbose "Skipping symlink $weak_link" + continue + fi + # In update case the --remove-modules call is performed + # after --add-modules (from postuninstall). + # So, we shouldn't really remove the symlink in this case. + # But in the remove case the actual target already removed. + if ! is_weak_for_module_valid "$module" "$krel"; then + remove_weak_link_quiet "$weak_link" "$krel" + fi + done +} + +# validate_weak_links: +# Takes kernel release. +# Checks if all the weak symlinks are suitable for the given kernel. +# Uses depmod to perform the actual symbol checks and parses the output. +# Since depmod internally creates the module list in the beginning of its work +# accroding to the priority list in its configuration, but without symbol +# check and doesn't amend the list during the check, the function runs it +# in a loop in which it removes discovered incompatible symlinks +# +# Returns 0 (success) if proposal is fine or +# 1 (false) if some incompatible symlinks were removed +validate_weak_links() { + local krel="$1" + local basedir=${BASEDIR:+-b $BASEDIR} + local tmp + declare -A symbols + local is_updates_changed=1 + local module + local module_krel + local target + local modpath + local symbol + local weak_link + # to return to caller that original proposal is not valid + # here 0 is true, 1 is false, since it will be the return code + local is_configuration_valid=0 + + tmp=$(mktemp -p $tmpdir) + + if ! [[ -e $tmpdir/symvers-$krel ]]; then + local symvers_path=$(find_symvers_file "$krel") + + [[ -n "$symvers_path" ]] || return + zcat "$symvers_path" > $tmpdir/symvers-$krel + fi + + while ((is_updates_changed)); do + is_updates_changed=0 + + # again $tmp because of subshell, see read_modules_list() comment + # create incompatibility report by depmod + # Shorcut if depmod finds a lot of incompatible modules elsewhere, + # we care only about weak-updates + $depmod $basedir -naeE $tmpdir/symvers-$krel $krel 2>&1 1>/dev/null | \ + grep "$(weak_updates_dir $krel)" 2>/dev/null >$tmp + # parse it into symbols[] associative array in form a-la + # symbols["/path/to/the/module"]="list of bad symbols" + while read line; do + set -- $(echo $line | awk '/needs unknown symbol/{print $3 " " $NF}') + modpath=$1 + symbol=$2 + if [[ -n "$modpath" ]]; then + symbols[$modpath]="${symbols[$modpath]} $symbol" + continue + fi + + set -- $(echo $line | awk '/disagrees about version of symbol/{print $3 " " $NF}') + modpath=$1 + symbol=$2 + if [[ -n "$modpath" ]]; then + symbols[$modpath]="${symbols[$modpath]} $symbol" + continue + fi + done < $tmp + + # loop through all the weak links from the list of incompatible + # modules and remove them. Skips non-weak incompatibilities + for modpath in "${!symbols[@]}"; do + is_weak_link $modpath $krel || continue + + target=$(readlink $modpath) + module_krel=$(krel_of_module $target) + + remove_weak_link_quiet "$modpath" "$krel" + + pr_verbose "Module $(module_short_name $modpath) from kernel $module_krel is not compatible with kernel $krel in symbols: ${symbols[$modpath]}" + is_updates_changed=1 + is_configuration_valid=1 # inversed value + done + done + rm -f $tmp + + # this loop is just to produce verbose compatibility messages + # for the compatible modules + for module in "${modules[@]}"; do + is_weak_for_module_valid $module $krel || continue + + weak_link="$(module_weak_link $module $krel)" + target="$(readlink $weak_link)" + module_krel=$(krel_of_module $target) + + if [[ "$module" == "$target" ]]; then + pr_verbose "Module ${module##*/} from kernel $module_krel is compatible with kernel $krel" + fi + done + return $is_configuration_valid +} + +# global_link_state_save: +# Takes kernel release +# Saves the given kernel's weak symlinks state into the global array +# weak_modules_before[] for later processing +global_link_state_save() { + local krel="$1" + local link + local target + + weak_modules_before=() + for link in $(find_modules_dirs $(weak_updates_dir $krel) | xargs); do + target=$(readlink $link) + weak_modules_before[$link]=$target + done +} + +# global_link_state_restore: +# Takes kernel release +# Restores the previous weak links state +# (for example, if incompatible modules were installed) +global_link_state_restore() { + local krel="$1" + local link + local target + + pr_verbose "Falling back weak-modules state for kernel $krel" + + ( cd "$(weak_updates_dir $krel)" 2>/dev/null && rm -rf * ) + + for link in "${!weak_modules_before[@]}"; do + target=${weak_modules_before[$link]} + + mkdir -p "$(dirname $link)" + ln -sf $target $link + done +} + +# global_link_state_announce_changes: +# Takes kernel release +# Reads the given kernel's weak symlinks state, compares to the saved, +# triggers initrd rebuild if there were changes +# and produces message on symlink removal +global_link_state_announce_changes() { + local krel="$1" + local link + local target + local new_target + declare -A weak_modules_after + + for link in $(find_modules_dirs $(weak_updates_dir $krel) | xargs); do + target=${weak_modules_before[$link]} + new_target=$(readlink $link) + weak_modules_after[$link]=$new_target + + # report change of existing link and appearing of a new link + [[ "$target" == "$new_target" ]] || module_has_changed $new_target $krel + done + + for link in "${!weak_modules_before[@]}"; do + target=${weak_modules_before[$link]} + new_target=${weak_modules_after[$link]} + + # report change of existing link and disappearing of an old link + [[ "$target" == "$new_target" ]] && continue + module_has_changed $target $krel + [[ -n "$new_target" ]] || + pr_verbose "Removing compatible module $(module_short_name $target) from kernel $krel" + done } # remove_modules: # Read in a list of modules from stdinput and process them for removal. -# Parameter is noreplace to delete modules, otherwise link compat. +# Parameter (noreplace) is deprecated, acts always as "noreplace". +# There is no sense in the "replace" functionality since according +# to the current requirements RPM will track existing of only one version +# of extra/ module (no same extra/ modules for different kernels). remove_modules() { - delete_modules=${1:-replace} + update_modules remove_weak_links force_update +} - read_modules_list || exit 1 - if [ ${#modules[@]} -gt 0 ]; then +# add_modules: +# Read in a list of modules from stdinput and process them for compatibility +# with installed kernels under /lib/modules. +add_modules() { + no_force_update="" - # Hunt for all known users of this module in /lib/modules, remove them - # and create symlinks to other compatible modules (downgrade) if - # possible, update initramfs for each modified kernel too. + update_modules add_weak_links $no_force_update +} - krels=($(ls /lib/modules/ | rpmsort -r)) - for krel in "${krels[@]}"; do - [ -e "/boot/symvers-$krel.gz" ] || continue - for ((n = 0; n < ${#modules[@]}; n++)); do - module="${modules[n]}" - module_krel="${module_krels[n]}" +# do_make_groups: +# Takes tmp file which contains preprocessed modules.dep +# output (or modules.dep) +# reads modules.dep format information from stdin +# produces groups associative array +# the group is a maximum subset of modules having at least a link +do_make_groups() +{ + local tmp="$1" + local group_name + local mod + declare -a mods - # Module is going to be removed, update initramfs. - module_has_changed $module $krel + while read i; do + mods=($i) - subpath="${module#/lib/modules/$module_krel/extra}" - weak_module="/lib/modules/$krel/weak-updates/${subpath#/}" - if [ "$module" == "`readlink $weak_module`" ]; then - [ -n "$verbose" ] && echo \ -"Removing compatible module ${module##*/} from kernel $krel" - doit rm -f "$weak_module" - if [ "replace" == "$delete_modules" ]; then - for krel2 in "${krels[@]}"; do - if [ $krel2 != $krel ]; then - module="/lib/modules/$krel2/extra/${subpath#/}" - [ -e "$module" ] || continue - if module_is_compatible "$module" "$krel"; then - [ -n "$verbose" ] && echo \ -"Adding compatible module ${module##*/} from kernel $krel2 instead" - doit ln -s "$module" "$weak_module" - module_has_changed $module $krel - break - fi - fi - done - fi - doit rmdir --parents --ignore-fail-on-non-empty \ - "$(dirname "$weak_module")" - fi - done + # if the module already met, then its dependencies already counted + module_group="${grouped_modules[${mods[0]}]}" + [[ -n $module_group ]] && continue + + # new group + group_name="${mods[0]}" + + for mod in "${mods[@]}"; do + # if there is already such group, + # it is a subset of the one being created + # due to depmod output + unset groups[$mod] + + # extra space doesn't matter, since later (in add_kernel()) + # it is expanded without quotes + groups[$group_name]+=" $mod" + grouped_modules[$mod]=$group_name done - fi + done < $tmp # avoid subshell +} + +# filter_depmod_deps: +# preprocess output for make_groups +# depmod -n produces also aliases, so it cuts them off +# also it removes colon after the first module +filter_depmod_deps() +{ + awk 'BEGIN { pr = 1 } /^#/{ pr = 0 } pr == 1 {sub(":",""); print $0}' +} + +# make_abs_path: +# Takes kernel version +# makes full path from the relative module path +# (produced by depmod for in-kernel-dir modules) +make_abs_path() +{ + local kver="$1" + local mod + declare -a mods + + while read i; do + mods=($i) + for j in "${!mods[@]}"; do + mod="${mods[$j]}" + [[ ${mod:0:1} == "/" ]] || mod="/lib/modules/$kver/$mod" + mods[$j]="$mod" + done + echo "${mods[@]}" + done +} + +# make_groups: +# takes krel and a file with the list of modules, +# prepares and feeds to do_make_groups +# to create the module groups (global) +make_groups() +{ + local krel="$1" + local tmp1="$2" + local tmp2=$(mktemp -p $tmpdir) + + groups=() + grouped_modules=() + + $depmod -n $krel $(cat $tmp1) 2>/dev/null | + filter_depmod_deps | make_abs_path $krel > $tmp2 + + do_make_groups $tmp2 + + rm -f $tmp2 } add_kernel() { - add_krel=${1:-$(uname -r)} - if [ ! -e "/boot/symvers-$add_krel.gz" ]; then - echo "Symvers dump file /boot/symvers-$add_krel.gz" \ - "not found" >&2 + local krel=${1:-$(uname -r)} + local tmp + local no_force_update="" + + tmp=$(mktemp -p $tmpdir) + + if ! find_symvers_file "$krel" > /dev/null; then + echo "Symvers dump file is not found in" \ + $(find_symvers_file "$krel" print) >&2 exit 1 fi - for krel in $(ls /lib/modules/ | rpmsort -r); do - [ "$add_krel" = "$krel" ] && continue - [ -d /lib/modules/$krel/extra ] || continue - for module in $(find /lib/modules/$krel/extra -name '*.ko'); do - subpath="${module#/lib/modules/$krel/extra}" - weak_module="/lib/modules/$add_krel/weak-updates/${subpath#/}" - [ -e "$weak_module" ] && continue - if module_is_compatible $module $add_krel; then - module_has_changed $module $add_krel - doit mkdir -p $(dirname $weak_module) - doit ln -sf $module $weak_module - fi + + for k in $(find_kernels_with_extra | rpmsort); do + [[ "$krel" == "$k" ]] && continue + find_modules $k extra > $tmp + + is_empty_file "$tmp" || make_groups $krel $tmp + + # reuse tmp + + for g in "${groups[@]}"; do + printf '%s\n' $g > $tmp + # to avoid subshell, see the read_modules_list comment + read_modules_list < $tmp + update_modules_for_krel $krel add_weak_links $no_force_update done done + + rm -f $tmp + } remove_kernel() { remove_krel=${1:-$(uname -r)} - weak_modules="/lib/modules/$remove_krel/weak-updates" + weak_modules="$(weak_updates_dir $remove_krel)" module_has_changed $weak_modules $remove_krel - doit rm -rf "$weak_modules" + + # Remove everything beneath the weak-updates directory + ( cd "$weak_modules" && doit rm -rf * ) } ################################################################################ @@ -389,7 +1010,8 @@ remove_kernel() { options=`getopt -o h --long help,add-modules,remove-modules \ --long add-kernel,remove-kernel \ - --long dry-run,no-initramfs,verbose,delete-modules -- "$@"` + --long dry-run,no-initramfs,verbose,delete-modules \ + --long basedir:,dracut:,check-initramfs-prog: -- "$@"` [ $? -eq 0 ] || usage 1 @@ -411,6 +1033,10 @@ while :; do ;; --dry-run) dry_run=1 + # --dry-run option is not pure dry run anymore, + # because of depmod used internally. + # For add/remove modules we have to add/remove the symlinks + # and just restore the original configuration afterwards. ;; --no-initramfs) no_initramfs=1 @@ -419,7 +1045,19 @@ while :; do verbose=1 ;; --delete-modules) - do_delete_modules=1 + pr_warning "--delete-modules is deprecated, no effect" + ;; + --basedir) + BASEDIR="$2" + shift + ;; + --dracut) + dracut="$2" + shift + ;; + --check-initramfs-prog) + CHECK_INITRAMFS="$2" + shift ;; -h|--help) usage 0 @@ -432,27 +1070,31 @@ while :; do shift done +if [ ! -x "$dracut" ] +then + echo "weak-modules: could not find dracut at $dracut" + exit 1 +fi + +initramfs_prefix="$BASEDIR/${default_initramfs_prefix#/}" + if [ -n "$do_add_modules" ]; then - add_modules + add_modules elif [ -n "$do_remove_modules" ]; then - if [ -n "$do_delete_modules" ]; then - remove_modules "noreplace" - else - remove_modules - fi + remove_modules elif [ -n "$do_add_kernel" ]; then - kernel=${1:-$(uname -r)} - add_kernel $kernel + kernel=${1:-$(uname -r)} + add_kernel $kernel elif [ -n "$do_remove_kernel" ]; then - kernel=${1:-$(uname -r)} - remove_kernel $kernel + kernel=${1:-$(uname -r)} + remove_kernel $kernel - exit 0 + exit 0 else - usage 1 + usage 1 fi ################################################################################ @@ -462,14 +1104,19 @@ fi # run depmod and dracut as needed for krel in ${!changed_modules_*}; do krel=${!krel} + basedir=${BASEDIR:+-b $BASEDIR} - doit /sbin/depmod -ae -F /boot/System.map-$krel $krel + if is_kernel_installed $krel; then + doit $depmod $basedir -ae -F $(find_systemmap_file $krel) $krel + else + pr_verbose "Skipping depmod for non-installed kernel $krel" + fi done for krel in ${!changed_initramfs_*}; do krel=${!krel} if [ ! -n "$no_initramfs" ]; then - check_initramfs $krel + ${CHECK_INITRAMFS:-check_initramfs} $krel fi done From df015fd4dc52468401ecf79f32c12c5f3afe363d Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Mon, 25 Feb 2019 18:48:22 +0200 Subject: [PATCH 14/77] packaging: bump up version, 26-3 - weak-modules: sync with RHEL Signed-off-by: Yauheni Kaliuta --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 5c6d4de..7b7046a 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 26 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -103,6 +103,9 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Mon Feb 25 2019 Yauheni Kaliuta - 26-3 +- weak-modules: sync with RHEL + * Sun Feb 24 2019 Yauheni Kaliuta - 26-2 - add PKCS7/openssl support (rhbz 1320921) From 2c61399a4a4498bba90d43efe422e11310ccd1cb Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 25 Jul 2019 11:56:57 +0000 Subject: [PATCH 15/77] - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 7b7046a..2522822 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 26 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -103,6 +103,9 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Thu Jul 25 2019 Fedora Release Engineering - 26-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + * Mon Feb 25 2019 Yauheni Kaliuta - 26-3 - weak-modules: sync with RHEL From b006530fb5301bd3ed98ad27e4bf3d8e32b065bd Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Fri, 1 Nov 2019 09:22:38 -0400 Subject: [PATCH 16/77] weak-modules: Sync with RHEL Signed-off-by: Laura Abbott --- weak-modules | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/weak-modules b/weak-modules index db1839c..dd163cc 100644 --- a/weak-modules +++ b/weak-modules @@ -468,7 +468,7 @@ prepare_sandbox() { #config echo "search external extra built-in weak-updates" >"$conf" - echo "external $krel $dir" >>"$conf" + echo "external * $dir" >>"$conf" depmod="$depmod_orig -C $conf" } @@ -966,6 +966,7 @@ add_kernel() { local krel=${1:-$(uname -r)} local tmp local no_force_update="" + local num tmp=$(mktemp -p $tmpdir) @@ -983,9 +984,28 @@ add_kernel() { # reuse tmp + # optimization, check independent modules in one run. + # first try groups with one element in each. + # it means independent modules, so we can safely remove + # incompatible links + # some cut and paste here + + echo > $tmp for g in "${groups[@]}"; do + num="$(echo "$g" | wc -w)" + [ "$num" -gt 1 ] && continue + + printf '%s\n' $g >> $tmp + done + # to avoid subshell, see the read_modules_list comment + read_modules_list < $tmp + update_modules_for_krel $krel add_weak_links force_update + + for g in "${groups[@]}"; do + num="$(echo "$g" | wc -w)" + [ "$num" -eq 1 ] && continue + printf '%s\n' $g > $tmp - # to avoid subshell, see the read_modules_list comment read_modules_list < $tmp update_modules_for_krel $krel add_weak_links $no_force_update done From 933fad99cbd4fc1706dda143053d8c2579cd3eab Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Mon, 20 Jan 2020 18:56:21 +0200 Subject: [PATCH 17/77] weak-modules: Sync with RHEL Signed-off-by: Yauheni Kaliuta --- weak-modules | 99 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 78 insertions(+), 21 deletions(-) diff --git a/weak-modules b/weak-modules index dd163cc..65806d0 100644 --- a/weak-modules +++ b/weak-modules @@ -3,15 +3,6 @@ # weak-modules - determine which modules are kABI compatible with installed # kernels and set up the symlinks in /lib/*/weak-updates. # -# This is an updated version of the script which doesn't support -# multiple installation of the same out-of-tree module (stored in the -# 'extra' subdirectory) for multiple kernels. This assumption is -# supposed to be verified at the rpm level of the packages delivering -# these modules. There are some checks for this assumption, however we -# really don't solve this situation. This limitation allows for a much -# simpler version of the script. Previous version tried to work in this -# case but was incorrect in some cases. - unset LANG LC_ALL LC_COLLATE tmpdir=$(mktemp -td ${0##*/}.XXXXXX) @@ -32,6 +23,14 @@ declare -A weak_modules_before declare -A groups declare -A grouped_modules +# output of validate_weak_links, one iteration +# short_name -> path +declare -A compatible_modules + +# state for update_modules_for_krel (needed for add_kernel case) +# short_name -> path +declare -A installed_modules + # doit: # A wrapper used whenever we're going to perform a real operation. doit() { @@ -473,6 +472,29 @@ prepare_sandbox() { depmod="$depmod_orig -C $conf" } +# discard_installed: +# remove installed_modules[] from modules[] +discard_installed() +{ + local short_name + + for m in "${!modules[@]}"; do + short_name="$(module_short_name "${modules[$m]}")" + + [[ -z "${installed_modules[$short_name]}" ]] && continue + + unset "modules[$m]" + done +} + +# update_installed: +# add compatible_modules[] to installed_modules[] +update_installed() +{ + for m in "${!compatible_modules[@]}"; do + installed_modules[$m]="${compatible_modules[$m]}" + done +} # finish_sandbox: # restore global state after sandboxing @@ -568,6 +590,7 @@ find_systemmap_file() { # the given kernel) # - check the state after validation to produce needed messages # and trigger initrd regeneration if the list changed. +# update_modules_for_krel() { local krel="$1" local func="$2" @@ -579,12 +602,24 @@ update_modules_for_krel() { global_link_state_save $krel + # remove already installed from modules[] + discard_installed + + # do not run heavy validation procedure if no modules to install + if [[ "${#modules[@]}" -eq 0 ]]; then + finish_sandbox $krel + return + fi + $func $krel if ! validate_weak_links $krel && [[ -z "$force_update" ]]; then global_link_state_restore $krel fi + # add compatible to installed + update_installed + global_link_state_announce_changes $krel finish_sandbox $krel @@ -600,12 +635,16 @@ update_modules() { local func="$1" local force_update="$2" local module_krel + declare -a saved_modules read_modules_list || exit 1 [[ ${#modules[@]} -gt 0 ]] || return + saved_modules=("${modules[@]}") for krel in $(find_installed_kernels); do update_modules_for_krel $krel $func $force_update + modules=("${saved_modules[@]}") + installed_modules=() done for module in "${modules[@]}"; do @@ -630,7 +669,7 @@ add_weak_links() { module_krel="$(krel_of_module $module)" case "$module" in - /lib/modules/$krel/*) + $BASEDIR/lib/modules/$krel/*) # Module already installed to the current kernel continue ;; esac @@ -698,6 +737,7 @@ remove_weak_links() { # # Returns 0 (success) if proposal is fine or # 1 (false) if some incompatible symlinks were removed +# initializes global hashmap compatible_modules with all the valid ones validate_weak_links() { local krel="$1" local basedir=${BASEDIR:+-b $BASEDIR} @@ -715,6 +755,7 @@ validate_weak_links() { local is_configuration_valid=0 tmp=$(mktemp -p $tmpdir) + compatible_modules=() if ! [[ -e $tmpdir/symvers-$krel ]]; then local symvers_path=$(find_symvers_file "$krel") @@ -779,6 +820,9 @@ validate_weak_links() { module_krel=$(krel_of_module $target) if [[ "$module" == "$target" ]]; then + short_name="$(module_short_name "$module")" + compatible_modules+=([$short_name]="$module") + pr_verbose "Module ${module##*/} from kernel $module_krel is compatible with kernel $krel" fi done @@ -877,9 +921,12 @@ add_modules() { # do_make_groups: # Takes tmp file which contains preprocessed modules.dep # output (or modules.dep) +# # reads modules.dep format information from stdin # produces groups associative array # the group is a maximum subset of modules having at least a link +# +# more fine tuned extra filtering. do_make_groups() { local tmp="$1" @@ -890,6 +937,8 @@ do_make_groups() while read i; do mods=($i) + echo "${mods[0]}" |grep -q "extra/" || continue + # if the module already met, then its dependencies already counted module_group="${grouped_modules[${mods[0]}]}" [[ -n $module_group ]] && continue @@ -898,6 +947,8 @@ do_make_groups() group_name="${mods[0]}" for mod in "${mods[@]}"; do + echo "$mod" |grep -q "extra/" || continue + # if there is already such group, # it is a subset of the one being created # due to depmod output @@ -915,26 +966,32 @@ do_make_groups() # preprocess output for make_groups # depmod -n produces also aliases, so it cuts them off # also it removes colon after the first module -filter_depmod_deps() +cut_depmod_deps() { awk 'BEGIN { pr = 1 } /^#/{ pr = 0 } pr == 1 {sub(":",""); print $0}' } -# make_abs_path: +# filter_extra_absoluted: # Takes kernel version # makes full path from the relative module path # (produced by depmod for in-kernel-dir modules) -make_abs_path() +# filter only extra/ modules +filter_extra_absoluted() { local kver="$1" local mod declare -a mods while read i; do + # skip non-extra. The check is not perfect, but ok + # to speed up handling in general cases + echo "$i" |grep -q "extra/" || continue + mods=($i) for j in "${!mods[@]}"; do mod="${mods[$j]}" - [[ ${mod:0:1} == "/" ]] || mod="/lib/modules/$kver/$mod" + + [[ ${mod:0:1} == "/" ]] || mod="$BASEDIR/lib/modules/$kver/$mod" mods[$j]="$mod" done echo "${mods[@]}" @@ -942,20 +999,20 @@ make_abs_path() } # make_groups: -# takes krel and a file with the list of modules, +# takes k -- kernel version, we are installing extras from # prepares and feeds to do_make_groups # to create the module groups (global) make_groups() { - local krel="$1" - local tmp1="$2" + local k="$1" local tmp2=$(mktemp -p $tmpdir) + local basedir=${BASEDIR:+-b $BASEDIR} groups=() grouped_modules=() - $depmod -n $krel $(cat $tmp1) 2>/dev/null | - filter_depmod_deps | make_abs_path $krel > $tmp2 + $depmod -n $basedir $k 2>/dev/null | + cut_depmod_deps | filter_extra_absoluted $k > $tmp2 do_make_groups $tmp2 @@ -976,11 +1033,11 @@ add_kernel() { exit 1 fi - for k in $(find_kernels_with_extra | rpmsort); do + for k in $(find_kernels_with_extra | rpmsort -r); do [[ "$krel" == "$k" ]] && continue find_modules $k extra > $tmp - is_empty_file "$tmp" || make_groups $krel $tmp + is_empty_file "$tmp" || make_groups $k # reuse tmp From afdb88d8b3795dcb68bbc42c4c5b844b1ddaea86 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Mon, 20 Jan 2020 18:58:12 +0200 Subject: [PATCH 18/77] packaging: bump up version, 26-5 - weak-modules: sync with RHEL Signed-off-by: Yauheni Kaliuta --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 2522822..0896218 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 26 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -103,6 +103,9 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Mon Jan 20 2020 Yauheni Kaliuta - 26-5 +- weak-modules: sync with RHEL + * Thu Jul 25 2019 Fedora Release Engineering - 26-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild From ed503860f1cd9e7796f4676de5fcba1b61328275 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Wed, 22 Jan 2020 17:45:25 +0000 Subject: [PATCH 19/77] minor spec cleanups and modernisation --- kmod.spec | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/kmod.spec b/kmod.spec index 0896218..e65dd3c 100644 --- a/kmod.spec +++ b/kmod.spec @@ -43,23 +43,25 @@ The kmod-devel package provides header files used for development of applications that wish to load or unload Linux kernel modules. %prep -%setup -q +%autosetup -p1 %build -export V=1 %configure \ --with-openssl \ --with-zlib \ --with-xz -make %{?_smp_mflags} + +%{make_build} V=1 %install -make install DESTDIR=$RPM_BUILD_ROOT +%{make_install} + pushd $RPM_BUILD_ROOT/%{_mandir}/man5 ln -s modprobe.d.5.gz modprobe.conf.5.gz popd -rm -rf $RPM_BUILD_ROOT%{_libdir}/*.la +find %{buildroot} -type f -name "*.la" -delete + mkdir -p $RPM_BUILD_ROOT%{_sbindir} ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/modprobe ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/modinfo @@ -93,7 +95,6 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %doc NEWS README TODO %files libs -%{!?_licensedir:%global license %%doc} %license COPYING %{_libdir}/libkmod.so.* From 1988940ee760fd86699edf0f874adc9584dcb550 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 20 Feb 2020 11:35:04 +0000 Subject: [PATCH 20/77] v27 --- .gitignore | 1 + kmod.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 9e55472..f339cc1 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ /kmod-24.tar.xz /kmod-25.tar.xz /kmod-26.tar.xz +/kmod-27.tar.xz diff --git a/kmod.spec b/kmod.spec index e65dd3c..652b5d5 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod -Version: 26 -Release: 5%{?dist} +Version: 27 +Release: 1%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -104,6 +104,9 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Thu Feb 20 2020 Peter Robinson - 27-1 +- New upstream v27 + * Mon Jan 20 2020 Yauheni Kaliuta - 26-5 - weak-modules: sync with RHEL diff --git a/sources b/sources index 1681452..47c908a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (kmod-26.tar.xz) = 3ca276c6fc13c2dd2220ec528b8dc4ab4edee5d2b22e16b6f945c552e51f74342c01c33a53740e6af8c893d42bd4d6f629cd8fa6e15ef8bd8da30cb003ef0865 +SHA512 (kmod-27.tar.xz) = e0513094935333fca1fb4c3e3493b232507a579ab00a6457cc9ed3e928363d05aad80634fb65a8287a336bf9895194c7be8ddc41bb088a6c2cca44fc1bfbdb6c From f1da57f28981ae3b332ac6b3efca264f6dba5884 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Wed, 25 Mar 2020 09:55:48 +0200 Subject: [PATCH 21/77] fix crash on fseek/ftell of stdout (27-2) - add 0001-depmod-do-not-output-.bin-to-stdout.patch Resolves: rhbz#1808430 Signed-off-by: Yauheni Kaliuta --- ...-depmod-do-not-output-.bin-to-stdout.patch | 53 +++++++++++++++++++ kmod.spec | 9 +++- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 0001-depmod-do-not-output-.bin-to-stdout.patch diff --git a/0001-depmod-do-not-output-.bin-to-stdout.patch b/0001-depmod-do-not-output-.bin-to-stdout.patch new file mode 100644 index 0000000..1461006 --- /dev/null +++ b/0001-depmod-do-not-output-.bin-to-stdout.patch @@ -0,0 +1,53 @@ +From 53b30aeba2dedae9f5558f560231d9462e063dfc Mon Sep 17 00:00:00 2001 +From: Lucas De Marchi +Date: Thu, 5 Mar 2020 13:33:10 -0800 +Subject: [PATCH] depmod: do not output .bin to stdout + +index_write() relies on fseek/ftell to manage the position to which we +are write and thus needs the file stream to support it. + +Right now when trying to write the index to stdout we fail with: + + depmod: tools/depmod.c:416: index_write: Assertion `initial_offset >= 0' failed. + Aborted (core dumped) + +We have no interest in outputting our index to stdout, so just skip it +like is done with other indexes. + +While at it, add/remove some newlines to improve readability. + +Reported-by: Yanko Kaneti +Fix: b866b2165ae6 ("Lookup aliases in the modules.builtin.modinfo") +--- + tools/depmod.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/tools/depmod.c b/tools/depmod.c +index fbbce10eb0db..875e31480818 100644 +--- a/tools/depmod.c ++++ b/tools/depmod.c +@@ -2408,8 +2408,10 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) + struct index_node *idx; + struct kmod_list *l, *builtin = NULL; + +- idx = index_create(); ++ if (out == stdout) ++ return 0; + ++ idx = index_create(); + if (idx == NULL) { + ret = -ENOMEM; + goto fail; +@@ -2456,7 +2458,9 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) + + if (count) + index_write(idx, out); ++ + index_destroy(idx); ++ + fail: + if (builtin) + kmod_module_unref_list(builtin); +-- +2.25.0 + diff --git a/kmod.spec b/kmod.spec index 652b5d5..0dbfbb4 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 27 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -9,6 +9,8 @@ Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.t Source1: weak-modules Exclusiveos: Linux +Patch01: 0001-depmod-do-not-output-.bin-to-stdout.patch + BuildRequires: gcc BuildRequires: chrpath BuildRequires: zlib-devel @@ -44,6 +46,7 @@ applications that wish to load or unload Linux kernel modules. %prep %autosetup -p1 +%patch01 -p %build %configure \ @@ -104,6 +107,10 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Wed Mar 25 2020 Yauheni Kaliuta - 27-2 +- add 0001-depmod-do-not-output-.bin-to-stdout.patch + Resolves: rhbz#1808430 + * Thu Feb 20 2020 Peter Robinson - 27-1 - New upstream v27 From 176e9652239e4ebf6bc6abccaf639ac8059b3e91 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Wed, 25 Mar 2020 10:02:12 +0200 Subject: [PATCH 22/77] Revert "fix crash on fseek/ftell of stdout (27-2)" This reverts commit f1da57f28981ae3b332ac6b3efca264f6dba5884. The commit is broken Signed-off-by: Yauheni Kaliuta --- ...-depmod-do-not-output-.bin-to-stdout.patch | 53 ------------------- kmod.spec | 9 +--- 2 files changed, 1 insertion(+), 61 deletions(-) delete mode 100644 0001-depmod-do-not-output-.bin-to-stdout.patch diff --git a/0001-depmod-do-not-output-.bin-to-stdout.patch b/0001-depmod-do-not-output-.bin-to-stdout.patch deleted file mode 100644 index 1461006..0000000 --- a/0001-depmod-do-not-output-.bin-to-stdout.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 53b30aeba2dedae9f5558f560231d9462e063dfc Mon Sep 17 00:00:00 2001 -From: Lucas De Marchi -Date: Thu, 5 Mar 2020 13:33:10 -0800 -Subject: [PATCH] depmod: do not output .bin to stdout - -index_write() relies on fseek/ftell to manage the position to which we -are write and thus needs the file stream to support it. - -Right now when trying to write the index to stdout we fail with: - - depmod: tools/depmod.c:416: index_write: Assertion `initial_offset >= 0' failed. - Aborted (core dumped) - -We have no interest in outputting our index to stdout, so just skip it -like is done with other indexes. - -While at it, add/remove some newlines to improve readability. - -Reported-by: Yanko Kaneti -Fix: b866b2165ae6 ("Lookup aliases in the modules.builtin.modinfo") ---- - tools/depmod.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/tools/depmod.c b/tools/depmod.c -index fbbce10eb0db..875e31480818 100644 ---- a/tools/depmod.c -+++ b/tools/depmod.c -@@ -2408,8 +2408,10 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) - struct index_node *idx; - struct kmod_list *l, *builtin = NULL; - -- idx = index_create(); -+ if (out == stdout) -+ return 0; - -+ idx = index_create(); - if (idx == NULL) { - ret = -ENOMEM; - goto fail; -@@ -2456,7 +2458,9 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) - - if (count) - index_write(idx, out); -+ - index_destroy(idx); -+ - fail: - if (builtin) - kmod_module_unref_list(builtin); --- -2.25.0 - diff --git a/kmod.spec b/kmod.spec index 0dbfbb4..652b5d5 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 27 -Release: 2%{?dist} +Release: 1%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -9,8 +9,6 @@ Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.t Source1: weak-modules Exclusiveos: Linux -Patch01: 0001-depmod-do-not-output-.bin-to-stdout.patch - BuildRequires: gcc BuildRequires: chrpath BuildRequires: zlib-devel @@ -46,7 +44,6 @@ applications that wish to load or unload Linux kernel modules. %prep %autosetup -p1 -%patch01 -p %build %configure \ @@ -107,10 +104,6 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog -* Wed Mar 25 2020 Yauheni Kaliuta - 27-2 -- add 0001-depmod-do-not-output-.bin-to-stdout.patch - Resolves: rhbz#1808430 - * Thu Feb 20 2020 Peter Robinson - 27-1 - New upstream v27 From 2a32527449aebfcdb4aa33e5575ce7c01598074b Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Wed, 25 Mar 2020 09:55:48 +0200 Subject: [PATCH 23/77] fix crash on fseek/ftell of stdout, try 2 (27-2) - add 0001-depmod-do-not-output-.bin-to-stdout.patch Resolves: rhbz#1808430 Signed-off-by: Yauheni Kaliuta --- ...-depmod-do-not-output-.bin-to-stdout.patch | 53 +++++++++++++++++++ kmod.spec | 8 ++- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 0001-depmod-do-not-output-.bin-to-stdout.patch diff --git a/0001-depmod-do-not-output-.bin-to-stdout.patch b/0001-depmod-do-not-output-.bin-to-stdout.patch new file mode 100644 index 0000000..1461006 --- /dev/null +++ b/0001-depmod-do-not-output-.bin-to-stdout.patch @@ -0,0 +1,53 @@ +From 53b30aeba2dedae9f5558f560231d9462e063dfc Mon Sep 17 00:00:00 2001 +From: Lucas De Marchi +Date: Thu, 5 Mar 2020 13:33:10 -0800 +Subject: [PATCH] depmod: do not output .bin to stdout + +index_write() relies on fseek/ftell to manage the position to which we +are write and thus needs the file stream to support it. + +Right now when trying to write the index to stdout we fail with: + + depmod: tools/depmod.c:416: index_write: Assertion `initial_offset >= 0' failed. + Aborted (core dumped) + +We have no interest in outputting our index to stdout, so just skip it +like is done with other indexes. + +While at it, add/remove some newlines to improve readability. + +Reported-by: Yanko Kaneti +Fix: b866b2165ae6 ("Lookup aliases in the modules.builtin.modinfo") +--- + tools/depmod.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/tools/depmod.c b/tools/depmod.c +index fbbce10eb0db..875e31480818 100644 +--- a/tools/depmod.c ++++ b/tools/depmod.c +@@ -2408,8 +2408,10 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) + struct index_node *idx; + struct kmod_list *l, *builtin = NULL; + +- idx = index_create(); ++ if (out == stdout) ++ return 0; + ++ idx = index_create(); + if (idx == NULL) { + ret = -ENOMEM; + goto fail; +@@ -2456,7 +2458,9 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) + + if (count) + index_write(idx, out); ++ + index_destroy(idx); ++ + fail: + if (builtin) + kmod_module_unref_list(builtin); +-- +2.25.0 + diff --git a/kmod.spec b/kmod.spec index 652b5d5..1a5c7af 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 27 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -9,6 +9,8 @@ Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.t Source1: weak-modules Exclusiveos: Linux +Patch01: 0001-depmod-do-not-output-.bin-to-stdout.patch + BuildRequires: gcc BuildRequires: chrpath BuildRequires: zlib-devel @@ -104,6 +106,10 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Wed Mar 25 2020 Yauheni Kaliuta - 27-2 +- add 0001-depmod-do-not-output-.bin-to-stdout.patch + Resolves: rhbz#1808430 + * Thu Feb 20 2020 Peter Robinson - 27-1 - New upstream v27 From bddd48bb1f02b70118e3a0b652848567edac13b0 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 28 Jul 2020 03:32:01 +0000 Subject: [PATCH 24/77] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 1a5c7af..a136dd9 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 27 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -106,6 +106,9 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Tue Jul 28 2020 Fedora Release Engineering - 27-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Wed Mar 25 2020 Yauheni Kaliuta - 27-2 - add 0001-depmod-do-not-output-.bin-to-stdout.patch Resolves: rhbz#1808430 From b6296f9ad3bf1a11226d6d68932294db915279d4 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 4 Jan 2021 22:48:43 +0000 Subject: [PATCH 25/77] Add BuildRequires: make https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot --- kmod.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/kmod.spec b/kmod.spec index a136dd9..34f4382 100644 --- a/kmod.spec +++ b/kmod.spec @@ -17,6 +17,7 @@ BuildRequires: zlib-devel BuildRequires: xz-devel BuildRequires: libxslt BuildRequires: openssl-devel +BuildRequires: make Provides: module-init-tools = 4.0-1 Obsoletes: module-init-tools < 4.0-1 From 393f16a127b027b16b5193efadbbe59490fb0ee2 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Thu, 7 Jan 2021 19:31:43 -0500 Subject: [PATCH 26/77] New upstream v28 Enable zstd support Resolves: rhbz#1913949 --- .gitignore | 1 + ...-depmod-do-not-output-.bin-to-stdout.patch | 53 ------------------- kmod.spec | 17 +++--- sources | 2 +- 4 files changed, 13 insertions(+), 60 deletions(-) delete mode 100644 0001-depmod-do-not-output-.bin-to-stdout.patch diff --git a/.gitignore b/.gitignore index f339cc1..9e1f6d9 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ /kmod-25.tar.xz /kmod-26.tar.xz /kmod-27.tar.xz +/kmod-28.tar.xz diff --git a/0001-depmod-do-not-output-.bin-to-stdout.patch b/0001-depmod-do-not-output-.bin-to-stdout.patch deleted file mode 100644 index 1461006..0000000 --- a/0001-depmod-do-not-output-.bin-to-stdout.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 53b30aeba2dedae9f5558f560231d9462e063dfc Mon Sep 17 00:00:00 2001 -From: Lucas De Marchi -Date: Thu, 5 Mar 2020 13:33:10 -0800 -Subject: [PATCH] depmod: do not output .bin to stdout - -index_write() relies on fseek/ftell to manage the position to which we -are write and thus needs the file stream to support it. - -Right now when trying to write the index to stdout we fail with: - - depmod: tools/depmod.c:416: index_write: Assertion `initial_offset >= 0' failed. - Aborted (core dumped) - -We have no interest in outputting our index to stdout, so just skip it -like is done with other indexes. - -While at it, add/remove some newlines to improve readability. - -Reported-by: Yanko Kaneti -Fix: b866b2165ae6 ("Lookup aliases in the modules.builtin.modinfo") ---- - tools/depmod.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/tools/depmod.c b/tools/depmod.c -index fbbce10eb0db..875e31480818 100644 ---- a/tools/depmod.c -+++ b/tools/depmod.c -@@ -2408,8 +2408,10 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) - struct index_node *idx; - struct kmod_list *l, *builtin = NULL; - -- idx = index_create(); -+ if (out == stdout) -+ return 0; - -+ idx = index_create(); - if (idx == NULL) { - ret = -ENOMEM; - goto fail; -@@ -2456,7 +2458,9 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) - - if (count) - index_write(idx, out); -+ - index_destroy(idx); -+ - fail: - if (builtin) - kmod_module_unref_list(builtin); --- -2.25.0 - diff --git a/kmod.spec b/kmod.spec index 34f4382..c320536 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod -Version: 27 -Release: 3%{?dist} +Version: 28 +Release: 1%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -9,15 +9,14 @@ Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.t Source1: weak-modules Exclusiveos: Linux -Patch01: 0001-depmod-do-not-output-.bin-to-stdout.patch - BuildRequires: gcc BuildRequires: chrpath BuildRequires: zlib-devel BuildRequires: xz-devel BuildRequires: libxslt BuildRequires: openssl-devel -BuildRequires: make +BuildRequires: make +BuildRequires: libzstd-devel Provides: module-init-tools = 4.0-1 Obsoletes: module-init-tools < 4.0-1 @@ -52,7 +51,8 @@ applications that wish to load or unload Linux kernel modules. %configure \ --with-openssl \ --with-zlib \ - --with-xz + --with-xz \ + --with-zstd %{make_build} V=1 @@ -107,6 +107,11 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Thu Jan 07 2021 Josh Boyer - 28-1 +- New upstream v28 +- Enable zstd support +- Resolves: rhbz#1913949 + * Tue Jul 28 2020 Fedora Release Engineering - 27-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild diff --git a/sources b/sources index 47c908a..9dc7345 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (kmod-27.tar.xz) = e0513094935333fca1fb4c3e3493b232507a579ab00a6457cc9ed3e928363d05aad80634fb65a8287a336bf9895194c7be8ddc41bb088a6c2cca44fc1bfbdb6c +SHA512 (kmod-28.tar.xz) = 50646dc72675a5e17b01e327e3d41b972f18aaeac20c8b00983c4d099c6218f35c32c184a833a2d7f716755d6a86851c90913d2835874cef933bdc4a9722df9a From 406582dd73fb84544bb466d52fa6eecd3c81b6fc Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 26 Jan 2021 15:58:53 +0000 Subject: [PATCH 27/77] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index c320536..5630b00 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 28 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -107,6 +107,9 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Tue Jan 26 2021 Fedora Release Engineering - 28-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Thu Jan 07 2021 Josh Boyer - 28-1 - New upstream v28 - Enable zstd support From 93a23f7391f3f9ffc7f2ab72763442f6c64d5b43 Mon Sep 17 00:00:00 2001 From: Robert Scheck Date: Sat, 30 Jan 2021 23:47:20 +0100 Subject: [PATCH 28/77] Spec file cleanup - Updated URL to current (shorter URL and HTTPS) - Removed superfluous slash for %{_mandir} path - Removed superfluous /sbin (only %{_sbindir} is used) - Preserve timestamp when installing weak-modules(1) --- kmod.spec | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kmod.spec b/kmod.spec index 5630b00..40c2674 100644 --- a/kmod.spec +++ b/kmod.spec @@ -4,7 +4,7 @@ Release: 2%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ -URL: http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary +URL: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.tar.xz Source1: weak-modules Exclusiveos: Linux @@ -59,7 +59,7 @@ applications that wish to load or unload Linux kernel modules. %install %{make_install} -pushd $RPM_BUILD_ROOT/%{_mandir}/man5 +pushd $RPM_BUILD_ROOT%{_mandir}/man5 ln -s modprobe.d.5.gz modprobe.conf.5.gz popd @@ -77,8 +77,7 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d -mkdir -p $RPM_BUILD_ROOT/sbin -install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules +install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %files %dir %{_sysconfdir}/depmod.d From 7c1c60b960c33537f7b3eca00efc58235630b5c3 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Fri, 21 May 2021 08:31:17 -0400 Subject: [PATCH 29/77] New upstream v29 Resolves: rhbz#1962980 --- .gitignore | 2 ++ kmod.spec | 8 ++++++-- sources | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 9e1f6d9..61ee224 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ /kmod-26.tar.xz /kmod-27.tar.xz /kmod-28.tar.xz +/kmod-29.tar.gz +/kmod-29.tar.xz diff --git a/kmod.spec b/kmod.spec index 40c2674..5622515 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod -Version: 28 -Release: 2%{?dist} +Version: 29 +Release: 1%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -106,6 +106,10 @@ install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Fri May 14 2021 Josh Boyer - 29-1 +- New upstream v29 +- Resolves: rhbz#1962980 + * Tue Jan 26 2021 Fedora Release Engineering - 28-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/sources b/sources index 9dc7345..d70bf5f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (kmod-28.tar.xz) = 50646dc72675a5e17b01e327e3d41b972f18aaeac20c8b00983c4d099c6218f35c32c184a833a2d7f716755d6a86851c90913d2835874cef933bdc4a9722df9a +SHA512 (kmod-29.tar.xz) = 557cdcaec75e5a1ceea2d10862c944e9a65ef54f6ee9da6dc98ce4582418fdc9958aab2e14a84807db61daf36ec4fcdc23a36376c39d5dc31d1823ca7cd47998 From 43ae298bc965ee0089b15519075622f94f08d7ac Mon Sep 17 00:00:00 2001 From: "Justin M. Forbes" Date: Mon, 24 May 2021 12:46:42 -0500 Subject: [PATCH 30/77] Remove weak-modules from kmod in Fedora Fedora does not support CONFIG_MODVERSIONS, as we have no guarantee of KABI. With this in mind, the weak-modules script adds no benefit to Fedora, but it can cause serious issues with update times on major kernel rebases, and with dkms. This patch removes the script from Fedora, but leaves it in place for ELN/CentOS/RHEL, etc. Signed-off-by: Justin M. Forbes --- kmod.spec | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kmod.spec b/kmod.spec index 5622515..ef2f73a 100644 --- a/kmod.spec +++ b/kmod.spec @@ -44,6 +44,14 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release} The kmod-devel package provides header files used for development of applications that wish to load or unload Linux kernel modules. +# Fedora does not support CONFIG_MODVERSIONS. Without kabi support +# weak-modules is useless at best, and can be actively harmful. +%if 0%{?fedora} +%define with_weak_modules 0 +%else +%define with_weak_modules 1 +%endif + %prep %autosetup -p1 @@ -77,7 +85,9 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d +%if %{with_weak_modules} install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules +%endif %files %dir %{_sysconfdir}/depmod.d @@ -90,7 +100,9 @@ install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_sbindir}/rmmod %{_sbindir}/lsmod %{_sbindir}/depmod +%if %{with_weak_modules} %{_sbindir}/weak-modules +%endif %{_datadir}/bash-completion/ %attr(0644,root,root) %{_mandir}/man5/*.5* %attr(0644,root,root) %{_mandir}/man8/*.8* @@ -106,6 +118,9 @@ install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Mon May 24 2021 Justin M. Forbes +- Remove weak-modules for Fedora as it causes problems. + * Fri May 14 2021 Josh Boyer - 29-1 - New upstream v29 - Resolves: rhbz#1962980 From 629ab3ccc2d68cf25e768a32bce9596ac947e7b0 Mon Sep 17 00:00:00 2001 From: "Justin M. Forbes" Date: Tue, 25 May 2021 07:37:32 -0500 Subject: [PATCH 31/77] Rebuild for weak-modules drop in Fedora Signed-off-by: Justin M. Forbes --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index ef2f73a..1d75527 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 29 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -118,6 +118,9 @@ install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Tue May 25 2021 Justin M. Forbes - 29-2 +- Rebuild for weak-modules drop in Fedora + * Mon May 24 2021 Justin M. Forbes - Remove weak-modules for Fedora as it causes problems. From 59975932b83be82e9d1933f5df0e3ad803f8a38c Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Tue, 8 Jun 2021 06:27:02 -0400 Subject: [PATCH 32/77] Move the conditional the top to clarify its scope This conditional impacts the whole spec, and generally these things are at the top of the spec to make it clear and avoid random scoping issues at spec parse time. --- kmod.spec | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/kmod.spec b/kmod.spec index 1d75527..80b1ae0 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,3 +1,12 @@ +# Fedora does not support CONFIG_MODVERSIONS. Without kabi support +# weak-modules is useless at best, and can be actively harmful. +%if 0%{?fedora} +%define with_weak_modules 0 +%else +%define with_weak_modules 1 +%endif + + Name: kmod Version: 29 Release: 2%{?dist} @@ -44,14 +53,6 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release} The kmod-devel package provides header files used for development of applications that wish to load or unload Linux kernel modules. -# Fedora does not support CONFIG_MODVERSIONS. Without kabi support -# weak-modules is useless at best, and can be actively harmful. -%if 0%{?fedora} -%define with_weak_modules 0 -%else -%define with_weak_modules 1 -%endif - %prep %autosetup -p1 From a81e15debb46b85a877ea76ce883c3816f2fd229 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Tue, 8 Jun 2021 06:45:19 -0400 Subject: [PATCH 33/77] Fix conditional to only install weak-modules for RHEL Generally speaking, weak-modules is going to be of no use to anyone, since the stabilized kABI is a unique property that only exists with the Red Hat Enterprise Linux distribution kernel. To avoid issues with downstreams, flip the conditional so that it is explicit that this is only useful for RHEL. --- kmod.spec | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/kmod.spec b/kmod.spec index 80b1ae0..7c22d26 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,15 +1,17 @@ # Fedora does not support CONFIG_MODVERSIONS. Without kabi support # weak-modules is useless at best, and can be actively harmful. -%if 0%{?fedora} -%define with_weak_modules 0 +# Since RHEL *does* support this and offers kabi support, +# turn it on there by default. +%if 0%{?rhel} +%bcond_without weak_modules %else -%define with_weak_modules 1 +%bcond_with weak_modules %endif Name: kmod Version: 29 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -86,7 +88,7 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d -%if %{with_weak_modules} +%if %{with weak_modules} install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %endif @@ -101,7 +103,7 @@ install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_sbindir}/rmmod %{_sbindir}/lsmod %{_sbindir}/depmod -%if %{with_weak_modules} +%if %{with weak_modules} %{_sbindir}/weak-modules %endif %{_datadir}/bash-completion/ @@ -119,6 +121,9 @@ install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Tue Jun 08 2021 Neal Gompa - 29-3 +- Fix conditional to only install weak-modules for RHEL + * Tue May 25 2021 Justin M. Forbes - 29-2 - Rebuild for weak-modules drop in Fedora From 6aa03ba354d6e0102b978e2ff475bc13901870b5 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 22 Jul 2021 10:14:32 +0000 Subject: [PATCH 34/77] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 7c22d26..3597670 100644 --- a/kmod.spec +++ b/kmod.spec @@ -11,7 +11,7 @@ Name: kmod Version: 29 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -121,6 +121,9 @@ install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_libdir}/libkmod.so %changelog +* Thu Jul 22 2021 Fedora Release Engineering - 29-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Tue Jun 08 2021 Neal Gompa - 29-3 - Fix conditional to only install weak-modules for RHEL From 35bc85d1e4cd23183f4377f6f4b1d611f0da95a6 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Tue, 10 Aug 2021 13:04:55 +0300 Subject: [PATCH 35/77] Add default config file, /etc/depmod.d/dist.conf External modules packaging depends on the search order provided by RHEL default config which is missing now from CentOS Stream. Add and install the file. Signed-off-by: Yauheni Kaliuta --- kmod.spec | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kmod.spec b/kmod.spec index 3597670..e335857 100644 --- a/kmod.spec +++ b/kmod.spec @@ -4,8 +4,10 @@ # turn it on there by default. %if 0%{?rhel} %bcond_without weak_modules +%bcond_without dist_conf %else %bcond_with weak_modules +%bcond_with dist_conf %endif @@ -18,6 +20,7 @@ License: GPLv2+ URL: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.tar.xz Source1: weak-modules +Source2: depmod.conf.dist Exclusiveos: Linux BuildRequires: gcc @@ -92,6 +95,10 @@ mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %endif +%if %{with dist_conf} +install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf +%endif + %files %dir %{_sysconfdir}/depmod.d %dir %{_sysconfdir}/modprobe.d @@ -107,6 +114,9 @@ install -pm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules %{_sbindir}/weak-modules %endif %{_datadir}/bash-completion/ +%if %{with dist_conf} +%{_sysconfdir}/depmod.d/dist.conf +%endif %attr(0644,root,root) %{_mandir}/man5/*.5* %attr(0644,root,root) %{_mandir}/man8/*.8* %doc NEWS README TODO From 50733019f18055586ce6f00ea923e3064380e8ff Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Tue, 8 Jun 2021 11:44:42 +0300 Subject: [PATCH 36/77] weak-modules: split modules into array with read -a Coverity reports warning for splitting mods=($i) `Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.` Even if it can not cause problems for weak-modules case where the list is coming from modules.dep, use the recommended read -a method. Signed-off-by: Yauheni Kaliuta --- weak-modules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weak-modules b/weak-modules index 65806d0..e328902 100644 --- a/weak-modules +++ b/weak-modules @@ -935,7 +935,7 @@ do_make_groups() declare -a mods while read i; do - mods=($i) + read -a mods <<< "$i" echo "${mods[0]}" |grep -q "extra/" || continue @@ -987,7 +987,7 @@ filter_extra_absoluted() # to speed up handling in general cases echo "$i" |grep -q "extra/" || continue - mods=($i) + read -a mods <<< "$i" for j in "${!mods[@]}"; do mod="${mods[$j]}" From 2679f21c9845e27e988e5f637a899a9dab42d568 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Tue, 8 Jun 2021 11:49:52 +0300 Subject: [PATCH 37/77] weak-modules: compare_initramfs_modules: exit on pushd/popd failures Coverity reports warning `warning[SC2164]: Use 'popd ... || exit' or 'popd ... || return' in case popd fails.` This cannot happen in case of weak-modules, but makes no harm. Signed-off-by: Yauheni Kaliuta --- weak-modules | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/weak-modules b/weak-modules index e328902..1a5312b 100644 --- a/weak-modules +++ b/weak-modules @@ -179,24 +179,24 @@ compare_initramfs_modules() { mkdir "$tmpdir/new_initramfs" decompress_initramfs "$old_initramfs" "$tmpdir/old_initramfs.img" - pushd "$tmpdir/old_initramfs" >/dev/null + pushd "$tmpdir/old_initramfs" >/dev/null || exit cpio -i < "$tmpdir/old_initramfs.img" 2>/dev/null rm "$tmpdir/old_initramfs.img" n=0; for i in `list_module_files|sort`; do old_initramfs_modules[n]="$i" n=$((n+1)) done - popd >/dev/null + popd >/dev/null || exit decompress_initramfs "$new_initramfs" "$tmpdir/new_initramfs.img" - pushd "$tmpdir/new_initramfs" >/dev/null + pushd "$tmpdir/new_initramfs" >/dev/null || exit cpio -i < "$tmpdir/new_initramfs.img" 2>/dev/null rm "$tmpdir/new_initramfs.img" n=0; for i in `list_module_files|sort`; do new_initramfs_modules[n]="$i" n=$((n+1)) done - popd >/dev/null + popd >/dev/null || exit # Compare the length and contents of the arrays if [ "${#old_initramfs_modules[@]}" == "${#new_initramfs_modules[@]}" -a \ From 0b10b0482bfb8dc10eda51027748051c9e464ee8 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Tue, 10 Aug 2021 16:09:15 +0300 Subject: [PATCH 38/77] kmod.spec: enable debug The debug messages pretty often are useful to find configuration problems on customers systems. They are seen only with extra verbose command line switches so should not affect performance a lot. Signed-off-by: Yauheni Kaliuta --- kmod.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index e335857..7d173eb 100644 --- a/kmod.spec +++ b/kmod.spec @@ -66,7 +66,8 @@ applications that wish to load or unload Linux kernel modules. --with-openssl \ --with-zlib \ --with-xz \ - --with-zstd + --with-zstd \ + --enable-debug %{make_build} V=1 From f4aad01fe79d9dc193b1cb837ee23797dc271508 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Tue, 10 Aug 2021 16:14:30 +0300 Subject: [PATCH 39/77] packaging: bump up version, 29-5 - kmod.spec: enable debug - weak-modules: compare_initramfs_modules: exit on pushd/popd failures - weak-modules: split modules into array with read -a - Add default config file, /etc/depmod.d/dist.conf Signed-off-by: Yauheni Kaliuta --- kmod.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 7d173eb..dd787b0 100644 --- a/kmod.spec +++ b/kmod.spec @@ -13,7 +13,7 @@ Name: kmod Version: 29 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -132,6 +132,12 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Tue Aug 10 2021 Yauheni Kaliuta - 29-5 +- kmod.spec: enable debug +- weak-modules: compare_initramfs_modules: exit on pushd/popd failures +- weak-modules: split modules into array with read -a +- Add default config file, /etc/depmod.d/dist.conf + * Thu Jul 22 2021 Fedora Release Engineering - 29-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild From 37c97fb6a8367e1db3f06aac8bd72037e8017923 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Wed, 11 Aug 2021 09:53:59 +0300 Subject: [PATCH 40/77] fedpkg new-source: commit modified files .gitignore sources Signed-off-by: Yauheni Kaliuta --- .gitignore | 1 + sources | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 61ee224..8243eb3 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ /kmod-28.tar.xz /kmod-29.tar.gz /kmod-29.tar.xz +/depmod.conf.dist diff --git a/sources b/sources index d70bf5f..d766e45 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (kmod-29.tar.xz) = 557cdcaec75e5a1ceea2d10862c944e9a65ef54f6ee9da6dc98ce4582418fdc9958aab2e14a84807db61daf36ec4fcdc23a36376c39d5dc31d1823ca7cd47998 +SHA512 (depmod.conf.dist) = b45bc3c6d78ab0a232ad4f6cb70e265cfc21ea7529be9e75fd0223385c8ebf96899884032ff93ba1717b4c746fd6424793d8f14096711b88cf941a91c1a21ac6 From 2e0ab6c0a5d0196c83b9048f81728963b861867e Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Wed, 11 Aug 2021 10:07:23 +0300 Subject: [PATCH 41/77] sources: updated kmod-29.tar.xz koji complained, that the file is not found. Signed-off-by: Yauheni Kaliuta --- sources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources b/sources index d766e45..d70bf5f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (depmod.conf.dist) = b45bc3c6d78ab0a232ad4f6cb70e265cfc21ea7529be9e75fd0223385c8ebf96899884032ff93ba1717b4c746fd6424793d8f14096711b88cf941a91c1a21ac6 +SHA512 (kmod-29.tar.xz) = 557cdcaec75e5a1ceea2d10862c944e9a65ef54f6ee9da6dc98ce4582418fdc9958aab2e14a84807db61daf36ec4fcdc23a36376c39d5dc31d1823ca7cd47998 From be3d947ed195facf36fdb7738b0501df6d7ee1ba Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Wed, 11 Aug 2021 10:18:42 +0300 Subject: [PATCH 42/77] sources: updated depmod.conf.dist Signed-off-by: Yauheni Kaliuta --- sources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources b/sources index d70bf5f..d766e45 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (kmod-29.tar.xz) = 557cdcaec75e5a1ceea2d10862c944e9a65ef54f6ee9da6dc98ce4582418fdc9958aab2e14a84807db61daf36ec4fcdc23a36376c39d5dc31d1823ca7cd47998 +SHA512 (depmod.conf.dist) = b45bc3c6d78ab0a232ad4f6cb70e265cfc21ea7529be9e75fd0223385c8ebf96899884032ff93ba1717b4c746fd6424793d8f14096711b88cf941a91c1a21ac6 From d00681e45464923760b0751fbd6a66caffc8d1d7 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Wed, 11 Aug 2021 10:25:12 +0300 Subject: [PATCH 43/77] depmod.dist.conf: commit to git koji still complains. Commit it to git like weak-modules. Signed-off-by: Yauheni Kaliuta --- .gitignore | 1 - depmod.conf.dist | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 depmod.conf.dist diff --git a/.gitignore b/.gitignore index 8243eb3..61ee224 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,3 @@ /kmod-28.tar.xz /kmod-29.tar.gz /kmod-29.tar.xz -/depmod.conf.dist diff --git a/depmod.conf.dist b/depmod.conf.dist new file mode 100644 index 0000000..8513288 --- /dev/null +++ b/depmod.conf.dist @@ -0,0 +1,6 @@ +# +# depmod.conf +# + +# override default search ordering for kmod packaging +search updates extra built-in weak-updates From 43ea30869b5010b25747783605bd64b1d22d7533 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Wed, 11 Aug 2021 10:29:45 +0300 Subject: [PATCH 44/77] sources: update again Signed-off-by: Yauheni Kaliuta --- sources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources b/sources index d766e45..d70bf5f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (depmod.conf.dist) = b45bc3c6d78ab0a232ad4f6cb70e265cfc21ea7529be9e75fd0223385c8ebf96899884032ff93ba1717b4c746fd6424793d8f14096711b88cf941a91c1a21ac6 +SHA512 (kmod-29.tar.xz) = 557cdcaec75e5a1ceea2d10862c944e9a65ef54f6ee9da6dc98ce4582418fdc9958aab2e14a84807db61daf36ec4fcdc23a36376c39d5dc31d1823ca7cd47998 From 7b3a5b1282b7e50be8f2f790484b4c18693b229a Mon Sep 17 00:00:00 2001 From: Sahana Prasad Date: Tue, 14 Sep 2021 19:05:21 +0200 Subject: [PATCH 45/77] Rebuilt with OpenSSL 3.0.0 --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index dd787b0..ebde4b9 100644 --- a/kmod.spec +++ b/kmod.spec @@ -13,7 +13,7 @@ Name: kmod Version: 29 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -132,6 +132,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Tue Sep 14 2021 Sahana Prasad - 29-6 +- Rebuilt with OpenSSL 3.0.0 + * Tue Aug 10 2021 Yauheni Kaliuta - 29-5 - kmod.spec: enable debug - weak-modules: compare_initramfs_modules: exit on pushd/popd failures From 22122f8f4fe417b5cd5ccb3e1002185c5a31a2ad Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jan 2022 15:00:31 +0000 Subject: [PATCH 46/77] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index ebde4b9..faa177f 100644 --- a/kmod.spec +++ b/kmod.spec @@ -13,7 +13,7 @@ Name: kmod Version: 29 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -132,6 +132,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Thu Jan 20 2022 Fedora Release Engineering - 29-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Tue Sep 14 2021 Sahana Prasad - 29-6 - Rebuilt with OpenSSL 3.0.0 From 095680a70dfff8c1aebb51a5c7d0a6e512b8c4fc Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Mon, 4 Jul 2022 15:49:29 +0300 Subject: [PATCH 47/77] New upstream release (v30) - README was removed in order to keep only README.md. Update the spec. - Resolves: rhbz#2102796 Signed-off-by: Yauheni Kaliuta --- .gitignore | 2 ++ kmod.spec | 10 +++++++--- sources | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 61ee224..0587760 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ /kmod-28.tar.xz /kmod-29.tar.gz /kmod-29.tar.xz +/kmod-30.tar.gz +/kmod-30.tar.xz diff --git a/kmod.spec b/kmod.spec index faa177f..a9e837b 100644 --- a/kmod.spec +++ b/kmod.spec @@ -12,8 +12,8 @@ Name: kmod -Version: 29 -Release: 7%{?dist} +Version: 30 +Release: 1%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -120,7 +120,7 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %endif %attr(0644,root,root) %{_mandir}/man5/*.5* %attr(0644,root,root) %{_mandir}/man8/*.8* -%doc NEWS README TODO +%doc NEWS README.md TODO %files libs %license COPYING @@ -132,6 +132,10 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Mon Jul 4 2022 Yauheni Kaliuta - 30-1 +- New upstream v30 +- Resolves: rhbz#2102796 + * Thu Jan 20 2022 Fedora Release Engineering - 29-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/sources b/sources index d70bf5f..0b8dd33 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (kmod-29.tar.xz) = 557cdcaec75e5a1ceea2d10862c944e9a65ef54f6ee9da6dc98ce4582418fdc9958aab2e14a84807db61daf36ec4fcdc23a36376c39d5dc31d1823ca7cd47998 +SHA512 (kmod-30.tar.xz) = e2cd34e600a72e44710760dfda9364b790b8352a99eafbd43e683e4a06f37e6b5c0b5d14e7c28070e30fc5fc6ceddedf7b97f3b6c2c5c2d91204fefd630b9a3e From 73532e3bda14da6002d79aa7d76aee81b273a23e Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Thu, 23 Jun 2022 01:22:32 +0000 Subject: [PATCH 48/77] Move zlib, xz, and zstd to bcond This allows experiments to be run with reducing the size of the initramfs by having fewer bulky shared libraries in it, and also makes it easier for downstream distributions to make different configuration choices. We keep the defaults the same, building *with* all of these in order to not change what is practically being built in Fedora. Signed-off-by: Stewart Smith --- kmod.spec | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kmod.spec b/kmod.spec index a9e837b..fabb8b8 100644 --- a/kmod.spec +++ b/kmod.spec @@ -10,6 +10,9 @@ %bcond_with dist_conf %endif +%bcond_without zlib +%bcond_without xz +%bcond_without zstd Name: kmod Version: 30 @@ -25,12 +28,18 @@ Exclusiveos: Linux BuildRequires: gcc BuildRequires: chrpath +%if %{with zlib} BuildRequires: zlib-devel +%endif +%if %{with xz} BuildRequires: xz-devel +%endif BuildRequires: libxslt BuildRequires: openssl-devel BuildRequires: make +%if %{with zstd} BuildRequires: libzstd-devel +%endif Provides: module-init-tools = 4.0-1 Obsoletes: module-init-tools < 4.0-1 @@ -64,9 +73,15 @@ applications that wish to load or unload Linux kernel modules. %build %configure \ --with-openssl \ +%if %{with zlib} --with-zlib \ +%endif +%if %{with xz} --with-xz \ +%endif +%if %{with zstd} --with-zstd \ +%endif --enable-debug %{make_build} V=1 From 35cb0afc6a2c2cb25c6ed09abbaaf479138affc5 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 21 Jul 2022 16:27:22 +0000 Subject: [PATCH 49/77] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index fabb8b8..c1e076e 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 30 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -147,6 +147,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Thu Jul 21 2022 Fedora Release Engineering - 30-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Mon Jul 4 2022 Yauheni Kaliuta - 30-1 - New upstream v30 - Resolves: rhbz#2102796 From 5a0a5922f1468e533bc3e7cfea0d3148993281fe Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Sat, 17 Dec 2022 18:20:55 +0100 Subject: [PATCH 50/77] Port configure script to C99 Related to: --- kmod-configure-c99.patch | 37 +++++++++++++++++++++++++++++++++++++ kmod.spec | 8 +++++++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 kmod-configure-c99.patch diff --git a/kmod-configure-c99.patch b/kmod-configure-c99.patch new file mode 100644 index 0000000..86cda4d --- /dev/null +++ b/kmod-configure-c99.patch @@ -0,0 +1,37 @@ +configure.ac: In _Noreturn check, include for exit + +Otherwise, an implicit functiona declaration is used, causing +a C99 compatibility issue. + +Submitted upstream: + + + +diff --git a/configure b/configure +index d053310a8b4a313a..ec1f12d02428f848 100755 +--- a/configure ++++ b/configure +@@ -14021,7 +14021,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + printf %s "checking whether _Noreturn is supported... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-_Noreturn int foo(void) { exit(0); } ++#include ++ _Noreturn int foo(void) { exit(0); } + _ACEOF + if ac_fn_c_try_compile "$LINENO" + then : +diff --git a/configure.ac b/configure.ac +index 6989e9360da23721..12e0518533201ccf 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -68,7 +68,8 @@ AC_COMPILE_IFELSE( + + AC_MSG_CHECKING([whether _Noreturn is supported]) + AC_COMPILE_IFELSE( +- [AC_LANG_SOURCE([[_Noreturn int foo(void) { exit(0); }]])], ++ [AC_LANG_SOURCE([[#include ++ _Noreturn int foo(void) { exit(0); }]])], + [AC_DEFINE([HAVE_NORETURN], [1], [Define if _Noreturn is available]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) diff --git a/kmod.spec b/kmod.spec index c1e076e..8d4ee3d 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 30 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -24,6 +24,7 @@ URL: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.tar.xz Source1: weak-modules Source2: depmod.conf.dist +Patch0: kmod-configure-c99.patch Exclusiveos: Linux BuildRequires: gcc @@ -69,6 +70,8 @@ applications that wish to load or unload Linux kernel modules. %prep %autosetup -p1 +# Avoid rebuilding the autoconf scripts. +touch -r aclocal.m4 configure* %build %configure \ @@ -147,6 +150,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Sat Dec 17 2022 Florian Weimer - 30-3 +- Port configure script to C99 + * Thu Jul 21 2022 Fedora Release Engineering - 30-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From 351c2750481b439c0ca0fdcb0ad34e92e6b10e22 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 19 Jan 2023 14:58:10 +0000 Subject: [PATCH 51/77] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 8d4ee3d..5db359e 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 30 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -150,6 +150,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Thu Jan 19 2023 Fedora Release Engineering - 30-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Sat Dec 17 2022 Florian Weimer - 30-3 - Port configure script to C99 From 2f9252cb9ec647af097ba07cd6b530d12ceba5e9 Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Tue, 9 May 2023 09:11:45 +0200 Subject: [PATCH 52/77] weak-modules: add symvers.xz support Check for symvers.xz support in addition to symvers.gz, due to unnanounced unilateral change[1][2] in the kernel packaging. [1] https://gitlab.com/cki-project/kernel-ark/-/commit/26446656572b8d5934f5d714b1fea76f3ed559c0 [2] https://src.fedoraproject.org/rpms/kernel/c/2db77a072a997c00ee63ddf38b79766699094f1c?branch=rawhide * weak-modules (make_kernel_file_names): Interpret all arguments after the second as a list of suffixes, iterate over them (find_kernel_file): Switch print and suffix arguments, interpret all argument after print as suffixes, pass them to make_kernel_file_names. (find_symvers_file): Update the order of arguments in the find_kernel_file call, add .xz suffix in addition to .gz. (find_systemmap_file): Update the order of arguments in the find_kernel_file call. Signed-off-by: Eugene Syromiatnikov References: https://bugzilla.redhat.com/show_bug.cgi?id=2192895 --- weak-modules | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/weak-modules b/weak-modules index 1a5312b..d4ac171 100644 --- a/weak-modules +++ b/weak-modules @@ -520,26 +520,31 @@ finish_sandbox() { # Auxiliary functions to find symvers file make_kernel_file_names() { local krel="$1" - local file="$2" - local suffix="$3" + shift + local file="$1" + shift - echo "${BASEDIR}/boot/${file}-${krel}${suffix}" - echo "${BASEDIR}/lib/modules/${krel}/${file}${suffix}" + for suffix in "$@"; do + echo "${BASEDIR}/boot/${file}-${krel}${suffix}" + echo "${BASEDIR}/lib/modules/${krel}/${file}${suffix}" + done } find_kernel_file() { local krel="$1" - local file="$2" - local suffix="$3" - local print="$4" + shift + local file="$1" + shift + local print="$1" + shift local i if [[ "$print" != "" ]]; then - make_kernel_file_names "$krel" "$file" "$suffix" + make_kernel_file_names "$krel" "$file" "$@" return 0 fi - for i in $(make_kernel_file_names "$krel" "$file" "$suffix"); do + for i in $(make_kernel_file_names "$krel" "$file" "$@"); do if [[ -r "$i" ]]; then echo "$i" return 0 @@ -563,7 +568,7 @@ find_symvers_file() { local krel="$1" local print="$2" - find_kernel_file "$krel" symvers .gz "$print" + find_kernel_file "$krel" symvers "$print" .xz .gz } # find_systemmap_file: @@ -573,7 +578,7 @@ find_systemmap_file() { local print="$2" local no_suffix="" - find_kernel_file "$krel" System.map "$no_suffix" "$print" + find_kernel_file "$krel" System.map "$print" "$no_suffix" } #### Main logic From b215525d804ccc5bba3737dded24bfd4e101e19b Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Tue, 9 May 2023 09:54:35 +0200 Subject: [PATCH 53/77] packaging: bump up version, 30-5 - Add symvers.xz support to weak-modules Signed-off-by: Eugene Syromiatnikov --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 5db359e..a130db6 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 30 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -150,6 +150,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Tue May 09 2023 Eugene Syromiatnikov - 30-5 +- Add symvers.xz support to weak-modules + * Thu Jan 19 2023 Fedora Release Engineering - 30-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From 389eca78ce46553388cad55ff130214592881a74 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jul 2023 09:22:57 +0000 Subject: [PATCH 54/77] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index a130db6..10ac33f 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 30 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -150,6 +150,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Thu Jul 20 2023 Fedora Release Engineering - 30-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Tue May 09 2023 Eugene Syromiatnikov - 30-5 - Add symvers.xz support to weak-modules From 15b926cdb793effda714ab931e68037ede82dccd Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Thu, 9 Nov 2023 09:01:37 -0500 Subject: [PATCH 55/77] New upstream v31 Resolves: rhbz#2241394 --- kmod-configure-c99.patch | 37 ------------------------------------- kmod.spec | 9 ++++++--- 2 files changed, 6 insertions(+), 40 deletions(-) delete mode 100644 kmod-configure-c99.patch diff --git a/kmod-configure-c99.patch b/kmod-configure-c99.patch deleted file mode 100644 index 86cda4d..0000000 --- a/kmod-configure-c99.patch +++ /dev/null @@ -1,37 +0,0 @@ -configure.ac: In _Noreturn check, include for exit - -Otherwise, an implicit functiona declaration is used, causing -a C99 compatibility issue. - -Submitted upstream: - - - -diff --git a/configure b/configure -index d053310a8b4a313a..ec1f12d02428f848 100755 ---- a/configure -+++ b/configure -@@ -14021,7 +14021,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - printf %s "checking whether _Noreturn is supported... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ --_Noreturn int foo(void) { exit(0); } -+#include -+ _Noreturn int foo(void) { exit(0); } - _ACEOF - if ac_fn_c_try_compile "$LINENO" - then : -diff --git a/configure.ac b/configure.ac -index 6989e9360da23721..12e0518533201ccf 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -68,7 +68,8 @@ AC_COMPILE_IFELSE( - - AC_MSG_CHECKING([whether _Noreturn is supported]) - AC_COMPILE_IFELSE( -- [AC_LANG_SOURCE([[_Noreturn int foo(void) { exit(0); }]])], -+ [AC_LANG_SOURCE([[#include -+ _Noreturn int foo(void) { exit(0); }]])], - [AC_DEFINE([HAVE_NORETURN], [1], [Define if _Noreturn is available]) - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])]) diff --git a/kmod.spec b/kmod.spec index 10ac33f..2d7d19d 100644 --- a/kmod.spec +++ b/kmod.spec @@ -15,8 +15,8 @@ %bcond_without zstd Name: kmod -Version: 30 -Release: 6%{?dist} +Version: 31 +Release: 1%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -24,7 +24,6 @@ URL: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.tar.xz Source1: weak-modules Source2: depmod.conf.dist -Patch0: kmod-configure-c99.patch Exclusiveos: Linux BuildRequires: gcc @@ -150,6 +149,10 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Thu Nov 09 2023 Josh Boyer - 31-1 +- New upstream v31 +- Resolves: rhbz#2241394 + * Thu Jul 20 2023 Fedora Release Engineering - 30-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From 2d51006e981aa880dbe923cd48e178aad0b4b7b2 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Thu, 9 Nov 2023 11:37:47 -0500 Subject: [PATCH 56/77] Add upstream patches to enable SHA3 support New upstream v31 Resolves: rhbz#2241394 --- .gitignore | 1 + kmod-tip.patch | 561 +++++++++++++++++++++++++++++++++++++++++++++++++ kmod.spec | 17 +- sources | 2 +- 4 files changed, 573 insertions(+), 8 deletions(-) create mode 100644 kmod-tip.patch diff --git a/.gitignore b/.gitignore index 0587760..b19ddb5 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ /kmod-29.tar.xz /kmod-30.tar.gz /kmod-30.tar.xz +/kmod-31.tar.xz diff --git a/kmod-tip.patch b/kmod-tip.patch new file mode 100644 index 0000000..d57d9f4 --- /dev/null +++ b/kmod-tip.patch @@ -0,0 +1,561 @@ +From 1bb23d7f19d888fbdd96ae0fe929b7086713ef33 Mon Sep 17 00:00:00 2001 +From: Michal Suchanek +Date: Tue, 18 Jul 2023 14:01:52 +0200 +Subject: [PATCH 1/6] configure: Detect openssl sm3 support + +Older openssl versions do not support sm3. The code has an option to +disable the sm3 hash but the lack of openssl support is not detected +automatically. + +Signed-off-by: Michal Suchanek +Link: https://lore.kernel.org/r/b97e20faa07e9e31c6eaf96683011aa24e80760c.1689681454.git.msuchanek@suse.de +Signed-off-by: Lucas De Marchi +--- + configure.ac | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 82a8532..e5bceea 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -123,6 +123,13 @@ AC_ARG_WITH([openssl], + AS_IF([test "x$with_openssl" != "xno"], [ + PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0], [LIBS="$LIBS $libcrypto_LIBS"]) + AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.]) ++ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include ++ int nid = NID_sm3;]])], [ ++ AC_MSG_NOTICE([openssl supports sm3]) ++ ], [ ++ AC_MSG_NOTICE([openssl sm3 support not detected]) ++ CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SM3" ++ ]) + ], [ + AC_MSG_NOTICE([openssl support not requested]) + ]) +-- +2.41.0 + + +From 4e7effbdc00307d0d1e83115e0d00cc75aae5cc6 Mon Sep 17 00:00:00 2001 +From: Michal Suchanek +Date: Tue, 18 Jul 2023 14:01:53 +0200 +Subject: [PATCH 2/6] man/depmod.d: Fix incorrect /usr/lib search path + +depmod searches /lib/depmod.d but the man page says /usr/lib/depmod.d is +searched. Align the documentation with the code. + +Signed-off-by: Michal Suchanek +Link: https://lore.kernel.org/r/9c5a6356b1a111eb6e17ddb110494b7f1d1b44c0.1689681454.git.msuchanek@suse.de +Signed-off-by: Lucas De Marchi +--- + man/depmod.d.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/man/depmod.d.xml b/man/depmod.d.xml +index 76548e9..8d3d821 100644 +--- a/man/depmod.d.xml ++++ b/man/depmod.d.xml +@@ -39,7 +39,7 @@ + + + +- /usr/lib/depmod.d/*.conf ++ /lib/depmod.d/*.conf + /usr/local/lib/depmod.d/*.conf + /run/depmod.d/*.conf + /etc/depmod.d/*.conf +-- +2.41.0 + + +From 8463809f8a29b254b2cab2ce755641bc690f07c9 Mon Sep 17 00:00:00 2001 +From: Michal Suchanek +Date: Tue, 18 Jul 2023 14:01:54 +0200 +Subject: [PATCH 3/6] libkmod, depmod: Load modprobe.d, depmod.d from + ${prefix}/lib. + +There is an ongoing effort to limit use of files outside of /usr (or +${prefix} on general). Currently all modprobe.d paths are hardcoded to +outside of $prefix. Teach kmod to load modprobe.d from ${prefix}/lib. + +On some distributions /usr/lib and /lib are the same directory because +of a compatibility symlink, and it is possible to craft configuration +files with sideeffects that would behave differently when loaded twice. +However, the override semantic ensures that one 'overrides' the other, +and only one configuration file of the same name is loaded from any of +the search directories. + +Signed-off-by: Michal Suchanek +Link: https://lore.kernel.org/r/a290343ce32e2a3c25b134e4f27c13b26e06c9e0.1689681454.git.msuchanek@suse.de +Signed-off-by: Lucas De Marchi +--- + Makefile.am | 1 + + configure.ac | 5 +++++ + libkmod/libkmod.c | 7 ++++--- + man/Makefile.am | 9 +++++++-- + man/depmod.d.xml | 1 + + man/modprobe.d.xml | 1 + + tools/depmod.c | 1 + + 7 files changed, 20 insertions(+), 5 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 5b7abfe..e6630a3 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -19,6 +19,7 @@ AM_CPPFLAGS = \ + -include $(top_builddir)/config.h \ + -I$(top_srcdir) \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ ++ -DDISTCONFDIR=\""$(distconfdir)"\" \ + ${zlib_CFLAGS} + + AM_CFLAGS = $(OUR_CFLAGS) +diff --git a/configure.ac b/configure.ac +index e5bceea..fd88d1f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -79,6 +79,10 @@ AC_COMPILE_IFELSE( + # --with- + ##################################################################### + ++AC_ARG_WITH([distconfdir], AS_HELP_STRING([--with-distconfdir=DIR], [directory to search for distribution configuration files]), ++ [], [with_distconfdir='${prefix}/lib']) ++AC_SUBST([distconfdir], [$with_distconfdir]) ++ + AC_ARG_WITH([rootlibdir], + AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), + [], [with_rootlibdir=$libdir]) +@@ -313,6 +317,7 @@ AC_MSG_RESULT([ + + prefix: ${prefix} + sysconfdir: ${sysconfdir} ++ distconfdir: ${distconfdir} + libdir: ${libdir} + rootlibdir: ${rootlibdir} + includedir: ${includedir} +diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c +index 1b8773c..57fac1c 100644 +--- a/libkmod/libkmod.c ++++ b/libkmod/libkmod.c +@@ -65,6 +65,7 @@ static const char *const default_config_paths[] = { + SYSCONFDIR "/modprobe.d", + "/run/modprobe.d", + "/usr/local/lib/modprobe.d", ++ DISTCONFDIR "/modprobe.d", + "/lib/modprobe.d", + NULL + }; +@@ -272,9 +273,9 @@ static enum kmod_file_compression_type get_kernel_compression(struct kmod_ctx *c + * to load from user-defined configuration parameters such as + * alias, blacklists, commands (install, remove). If NULL + * defaults to /etc/modprobe.d, /run/modprobe.d, +- * /usr/local/lib/modprobe.d and /lib/modprobe.d. Give an empty +- * vector if configuration should not be read. This array must +- * be null terminated. ++ * /usr/local/lib/modprobe.d, DISTCONFDIR/modprobe.d, and ++ * /lib/modprobe.d. Give an empty vector if configuration should ++ * not be read. This array must be null terminated. + * + * Create kmod library context. This reads the kmod configuration + * and fills in the default values. +diff --git a/man/Makefile.am b/man/Makefile.am +index 11514d5..2fea8e4 100644 +--- a/man/Makefile.am ++++ b/man/Makefile.am +@@ -17,9 +17,14 @@ EXTRA_DIST = $(MAN5:%.5=%.xml) $(MAN8:%.8=%.xml) + CLEANFILES = $(dist_man_MANS) + + %.5 %.8: %.xml +- $(AM_V_XSLT)$(XSLT) \ ++ $(AM_V_XSLT)if [ '$(distconfdir)' != '/lib' ] ; then \ ++ sed -e 's|@DISTCONFDIR@|$(distconfdir)|g' $< ; \ ++ else \ ++ sed -e '/@DISTCONFDIR@/d' $< ; \ ++ fi | \ ++ $(XSLT) \ + -o $@ \ + --nonet \ + --stringparam man.output.quietly 1 \ + --param funcsynopsis.style "'ansi'" \ +- http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< ++ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl - +diff --git a/man/depmod.d.xml b/man/depmod.d.xml +index 8d3d821..f282a39 100644 +--- a/man/depmod.d.xml ++++ b/man/depmod.d.xml +@@ -40,6 +40,7 @@ + + + /lib/depmod.d/*.conf ++ @DISTCONFDIR@/depmod.d/*.conf + /usr/local/lib/depmod.d/*.conf + /run/depmod.d/*.conf + /etc/depmod.d/*.conf +diff --git a/man/modprobe.d.xml b/man/modprobe.d.xml +index 0ab3e91..2bf6537 100644 +--- a/man/modprobe.d.xml ++++ b/man/modprobe.d.xml +@@ -41,6 +41,7 @@ + + + /lib/modprobe.d/*.conf ++ @DISTCONFDIR@/modprobe.d/*.conf + /usr/local/lib/modprobe.d/*.conf + /run/modprobe.d/*.conf + /etc/modprobe.d/*.conf +diff --git a/tools/depmod.c b/tools/depmod.c +index 1d1d41d..630fef9 100644 +--- a/tools/depmod.c ++++ b/tools/depmod.c +@@ -54,6 +54,7 @@ static const char *const default_cfg_paths[] = { + SYSCONFDIR "/depmod.d", + "/run/depmod.d", + "/usr/local/lib/depmod.d", ++ DISTCONFDIR "/depmod.d", + "/lib/depmod.d", + NULL + }; +-- +2.41.0 + + +From ecef7c131618bbd9c559924ecae55764089db0dd Mon Sep 17 00:00:00 2001 +From: Michal Suchanek +Date: Tue, 18 Jul 2023 14:01:55 +0200 +Subject: [PATCH 4/6] kmod: Add pkgconfig file with kmod compile time + configuration + +Show distconfdir (where system configuration files are searched/to be +installed), sysconfdir (where user configuration files are searched), +module compressions, and module signatures supported. + +Signed-off-by: Michal Suchanek +Link: https://lore.kernel.org/r/468b3f572d3b84f25bb53ec8fcb15ed4871914d4.1689681454.git.msuchanek@suse.de +Signed-off-by: Lucas De Marchi +--- + Makefile.am | 2 +- + configure.ac | 11 +++++++++++ + tools/kmod.pc.in | 9 +++++++++ + 3 files changed, 21 insertions(+), 1 deletion(-) + create mode 100644 tools/kmod.pc.in + +diff --git a/Makefile.am b/Makefile.am +index e6630a3..2a54c25 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -96,7 +96,7 @@ libkmod_libkmod_internal_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES) + libkmod_libkmod_internal_la_LIBADD = $(libkmod_libkmod_la_LIBADD) + + pkgconfigdir = $(libdir)/pkgconfig +-pkgconfig_DATA = libkmod/libkmod.pc ++pkgconfig_DATA = libkmod/libkmod.pc tools/kmod.pc + + bashcompletiondir=@bashcompletiondir@ + dist_bashcompletion_DATA = \ +diff --git a/configure.ac b/configure.ac +index fd88d1f..7bf8d78 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -21,6 +21,9 @@ LT_INIT([disable-static pic-only]) + AS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static is not supported by kmod])]) + AS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is not supported by kmod])]) + ++module_compressions="" ++module_signatures="legacy" ++ + ##################################################################### + # Program checks and configurations + ##################################################################### +@@ -94,6 +97,7 @@ AC_ARG_WITH([zstd], + AS_IF([test "x$with_zstd" != "xno"], [ + PKG_CHECK_MODULES([libzstd], [libzstd >= 1.4.4], [LIBS="$LIBS $libzstd_LIBS"]) + AC_DEFINE([ENABLE_ZSTD], [1], [Enable Zstandard for modules.]) ++ module_compressions="zstd $module_compressions" + ], [ + AC_MSG_NOTICE([Zstandard support not requested]) + ]) +@@ -105,6 +109,7 @@ AC_ARG_WITH([xz], + AS_IF([test "x$with_xz" != "xno"], [ + PKG_CHECK_MODULES([liblzma], [liblzma >= 4.99], [LIBS="$LIBS $liblzma_LIBS"]) + AC_DEFINE([ENABLE_XZ], [1], [Enable Xz for modules.]) ++ module_compressions="xz $module_compressions" + ], [ + AC_MSG_NOTICE([Xz support not requested]) + ]) +@@ -116,6 +121,7 @@ AC_ARG_WITH([zlib], + AS_IF([test "x$with_zlib" != "xno"], [ + PKG_CHECK_MODULES([zlib], [zlib], [LIBS="$LIBS $zlib_LIBS"]) + AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.]) ++ module_compressions="gzip $module_compressions" + ], [ + AC_MSG_NOTICE([zlib support not requested]) + ]) +@@ -134,6 +140,7 @@ AS_IF([test "x$with_openssl" != "xno"], [ + AC_MSG_NOTICE([openssl sm3 support not detected]) + CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SM3" + ]) ++ module_signatures="PKCS7 $module_signatures" + ], [ + AC_MSG_NOTICE([openssl support not requested]) + ]) +@@ -298,6 +305,9 @@ AC_DEFINE_UNQUOTED(KMOD_FEATURES, ["$with_features"], [Features in this build]) + # Generate files from *.in + ##################################################################### + ++AC_SUBST([module_compressions], $module_compressions) ++AC_SUBST([module_signatures], $module_signatures) ++ + AC_CONFIG_FILES([ + Makefile + man/Makefile +@@ -305,6 +315,7 @@ AC_CONFIG_FILES([ + libkmod/docs/version.xml + libkmod/libkmod.pc + libkmod/python/kmod/version.py ++ tools/kmod.pc + ]) + + +diff --git a/tools/kmod.pc.in b/tools/kmod.pc.in +new file mode 100644 +index 0000000..2595980 +--- /dev/null ++++ b/tools/kmod.pc.in +@@ -0,0 +1,9 @@ ++prefix=@prefix@ ++sysconfdir=@sysconfdir@ ++distconfdir=@distconfdir@ ++module_compressions=@module_compressions@ ++module_signatures=@module_signatures@ ++ ++Name: kmod ++Description: Tools to deal with kernel modules ++Version: @VERSION@ +-- +2.41.0 + + +From 3af2f475b0b729f20279f2ce488cc9f727f0b763 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Sun, 5 Nov 2023 22:02:25 +0000 +Subject: [PATCH 5/6] tools: depmod: fix -Walloc-size +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +GCC 14 introduces a new -Walloc-size included in -Wextra which gives: +``` +tools/depmod.c:192:14: warning: allocation of insufficient size ‘1’ for type ‘struct index_node’ with size ‘1048’ [-Walloc-size] +tools/depmod.c:255:11: warning: allocation of insufficient size ‘1’ for type ‘struct index_value’ with size ‘16’ [-Walloc-size] +tools/depmod.c:286:35: warning: allocation of insufficient size ‘1’ for type ‘struct index_node’ with size ‘1048’ [-Walloc-size] +tools/depmod.c:315:44: warning: allocation of insufficient size ‘1’ for type ‘struct index_node’ with size ‘1048’ [-Walloc-size] +``` + +The calloc prototype is: +``` +void *calloc(size_t nmemb, size_t size); +``` + +So, just swap the number of members and size arguments to match the prototype, as +we're initialising 1 struct of size `sizeof(struct ...)`. GCC then sees we're not +doing anything wrong. + +Signed-off-by: Sam James +--- + tools/depmod.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tools/depmod.c b/tools/depmod.c +index 630fef9..ab8513b 100644 +--- a/tools/depmod.c ++++ b/tools/depmod.c +@@ -190,7 +190,7 @@ static struct index_node *index_create(void) + { + struct index_node *node; + +- node = NOFAIL(calloc(sizeof(struct index_node), 1)); ++ node = NOFAIL(calloc(1, sizeof(struct index_node))); + node->prefix = NOFAIL(strdup("")); + node->first = INDEX_CHILDMAX; + +@@ -253,7 +253,7 @@ static int index_add_value(struct index_value **values, + values = &(*values)->next; + + len = strlen(value); +- v = NOFAIL(calloc(sizeof(struct index_value) + len + 1, 1)); ++ v = NOFAIL(calloc(1, sizeof(struct index_value) + len + 1)); + v->next = *values; + v->priority = priority; + memcpy(v->value, value, len + 1); +@@ -284,7 +284,7 @@ static int index_insert(struct index_node *node, const char *key, + struct index_node *n; + + /* New child is copy of node with prefix[j+1..N] */ +- n = NOFAIL(calloc(sizeof(struct index_node), 1)); ++ n = NOFAIL(calloc(1, sizeof(struct index_node))); + memcpy(n, node, sizeof(struct index_node)); + n->prefix = NOFAIL(strdup(&prefix[j+1])); + +@@ -313,7 +313,7 @@ static int index_insert(struct index_node *node, const char *key, + node->first = ch; + if (ch > node->last) + node->last = ch; +- node->children[ch] = NOFAIL(calloc(sizeof(struct index_node), 1)); ++ node->children[ch] = NOFAIL(calloc(1, sizeof(struct index_node))); + + child = node->children[ch]; + child->prefix = NOFAIL(strdup(&key[i+1])); +-- +2.41.0 + + +From 510c8b7f7455c6613dd1706e5e41ec7b09cf6703 Mon Sep 17 00:00:00 2001 +From: Dimitri John Ledkov +Date: Sun, 29 Oct 2023 03:03:19 +0200 +Subject: [PATCH 6/6] libkmod: remove pkcs7 obj_to_hash_algo() + +Switch to using OBJ_obj2txt() to calculate and print the pkcs7 +signature hash name. This eliminates the need to duplicate libcrypto +NID to name mapping, detect SM3 openssl compile-time support, and +enables using any hashes that openssl and kernel know about. For +example SHA3 are being added for v6.7 and with this patch are +automatically supported. + +Signed-off-by: Dimitri John Ledkov +Link: https://lore.kernel.org/r/20231029010319.157390-1-dimitri.ledkov@canonical.com +--- + configure.ac | 7 ----- + libkmod/libkmod-signature.c | 59 +++++++++++++------------------------ + 2 files changed, 20 insertions(+), 46 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 7bf8d78..a6b8fa0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -133,13 +133,6 @@ AC_ARG_WITH([openssl], + AS_IF([test "x$with_openssl" != "xno"], [ + PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0], [LIBS="$LIBS $libcrypto_LIBS"]) + AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.]) +- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include +- int nid = NID_sm3;]])], [ +- AC_MSG_NOTICE([openssl supports sm3]) +- ], [ +- AC_MSG_NOTICE([openssl sm3 support not detected]) +- CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SM3" +- ]) + module_signatures="PKCS7 $module_signatures" + ], [ + AC_MSG_NOTICE([openssl support not requested]) +diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c +index b749a81..80f6447 100644 +--- a/libkmod/libkmod-signature.c ++++ b/libkmod/libkmod-signature.c +@@ -127,6 +127,7 @@ struct pkcs7_private { + PKCS7 *pkcs7; + unsigned char *key_id; + BIGNUM *sno; ++ char *hash_algo; + }; + + static void pkcs7_free(void *s) +@@ -137,42 +138,11 @@ static void pkcs7_free(void *s) + PKCS7_free(pvt->pkcs7); + BN_free(pvt->sno); + free(pvt->key_id); ++ free(pvt->hash_algo); + free(pvt); + si->private = NULL; + } + +-static int obj_to_hash_algo(const ASN1_OBJECT *o) +-{ +- int nid; +- +- nid = OBJ_obj2nid(o); +- switch (nid) { +- case NID_md4: +- return PKEY_HASH_MD4; +- case NID_md5: +- return PKEY_HASH_MD5; +- case NID_sha1: +- return PKEY_HASH_SHA1; +- case NID_ripemd160: +- return PKEY_HASH_RIPE_MD_160; +- case NID_sha256: +- return PKEY_HASH_SHA256; +- case NID_sha384: +- return PKEY_HASH_SHA384; +- case NID_sha512: +- return PKEY_HASH_SHA512; +- case NID_sha224: +- return PKEY_HASH_SHA224; +-# ifndef OPENSSL_NO_SM3 +- case NID_sm3: +- return PKEY_HASH_SM3; +-# endif +- default: +- return -1; +- } +- return -1; +-} +- + static const char *x509_name_to_str(X509_NAME *name) + { + int i; +@@ -219,7 +189,8 @@ static bool fill_pkcs7(const char *mem, off_t size, + unsigned char *key_id_str; + struct pkcs7_private *pvt; + const char *issuer_str; +- int hash_algo; ++ char *hash_algo; ++ int hash_algo_len; + + size -= sig_len; + pkcs7_raw = mem + size; +@@ -278,27 +249,37 @@ static bool fill_pkcs7(const char *mem, off_t size, + + X509_ALGOR_get0(&o, NULL, NULL, dig_alg); + +- hash_algo = obj_to_hash_algo(o); +- if (hash_algo < 0) ++ // Use OBJ_obj2txt to calculate string length ++ hash_algo_len = OBJ_obj2txt(NULL, 0, o, 0); ++ if (hash_algo_len < 0) + goto err3; +- sig_info->hash_algo = pkey_hash_algo[hash_algo]; +- // hash algo has not been recognized +- if (sig_info->hash_algo == NULL) ++ hash_algo = malloc(hash_algo_len + 1); ++ if (hash_algo == NULL) + goto err3; ++ hash_algo_len = OBJ_obj2txt(hash_algo, hash_algo_len + 1, o, 0); ++ if (hash_algo_len < 0) ++ goto err4; ++ ++ // Assign libcrypto hash algo string or number ++ sig_info->hash_algo = hash_algo; ++ + sig_info->id_type = pkey_id_type[modsig->id_type]; + + pvt = malloc(sizeof(*pvt)); + if (pvt == NULL) +- goto err3; ++ goto err4; + + pvt->pkcs7 = pkcs7; + pvt->key_id = key_id_str; + pvt->sno = sno_bn; ++ pvt->hash_algo = hash_algo; + sig_info->private = pvt; + + sig_info->free = pkcs7_free; + + return true; ++err4: ++ free(hash_algo); + err3: + free(key_id_str); + err2: +-- +2.41.0 + diff --git a/kmod.spec b/kmod.spec index 2d7d19d..f32957d 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 31 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Linux kernel module management utilities License: GPLv2+ @@ -24,6 +24,7 @@ URL: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.tar.xz Source1: weak-modules Source2: depmod.conf.dist +Patch1: kmod-tip.patch Exclusiveos: Linux BuildRequires: gcc @@ -34,9 +35,9 @@ BuildRequires: zlib-devel %if %{with xz} BuildRequires: xz-devel %endif -BuildRequires: libxslt +BuildRequires: libxslt docbook-style-xsl BuildRequires: openssl-devel -BuildRequires: make +BuildRequires: make automake %if %{with zstd} BuildRequires: libzstd-devel %endif @@ -69,8 +70,6 @@ applications that wish to load or unload Linux kernel modules. %prep %autosetup -p1 -# Avoid rebuilding the autoconf scripts. -touch -r aclocal.m4 configure* %build %configure \ @@ -135,7 +134,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %if %{with dist_conf} %{_sysconfdir}/depmod.d/dist.conf %endif -%attr(0644,root,root) %{_mandir}/man5/*.5* +%attr(0644,root,root) %{_mandir}/man5/mod*.d*.5* +%attr(0644,root,root) %{_mandir}/man5/depmod.d.5* +%{_mandir}/man5/modprobe.conf.5* %attr(0644,root,root) %{_mandir}/man8/*.8* %doc NEWS README.md TODO @@ -145,11 +146,13 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %files devel %{_includedir}/libkmod.h +%{_libdir}/pkgconfig/kmod.pc %{_libdir}/pkgconfig/libkmod.pc %{_libdir}/libkmod.so %changelog -* Thu Nov 09 2023 Josh Boyer - 31-1 +* Thu Nov 09 2023 Josh Boyer - 31-2 +- Add upstream patches to enable SHA3 support - New upstream v31 - Resolves: rhbz#2241394 diff --git a/sources b/sources index 0b8dd33..d97b132 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (kmod-30.tar.xz) = e2cd34e600a72e44710760dfda9364b790b8352a99eafbd43e683e4a06f37e6b5c0b5d14e7c28070e30fc5fc6ceddedf7b97f3b6c2c5c2d91204fefd630b9a3e +SHA512 (kmod-31.tar.xz) = 05ca70381808bec5f262b94db625662c385408988178a35e4aaf4960ee0716dc0cbfc327160ea4b61098d0c2130ab1b5142ea8156bea8e06ded7f4d288b6d085 From c63e20debb21495f7ed079bb136479f093f9fbcf Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Fri, 1 Dec 2023 17:29:14 +0100 Subject: [PATCH 57/77] kmod.spec: update the License in an attempt to comply with the new policy * kmod.spec (Release): Bump to 3. (License): Update to include all licenses mentioned in the sources, add a comment that lists files for each license. (%package libs): Remove the License tag. (%changelog): Add "migrated to SPDX license" mention. Signed-off-by: Eugene Syromiatnikov --- kmod.spec | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/kmod.spec b/kmod.spec index f32957d..ea34929 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,10 +16,53 @@ Name: kmod Version: 31 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Linux kernel module management utilities -License: GPLv2+ +# https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis +# GPL-2.0-or-later: +# build-aux/compile +# build-aux/depcomp +# build-aux/ltmain.sh +# build-aux/ltmain.sh +# build-aux/missing +# build-aux/py-compile +# build-aux/test-driver +# m4/attributes.m4 +# m4/features.m4 +# tools +# GPL-3.0-or-later: +# build-aux/config.guess +# build-aux/config.sub +# build-aux/git-version-gen +# libkmod/docs/gtk-doc.make +# m4/gtk-doc.m4 +# FSFUL: +# configure +# FSFULLRWD: +# aclocal.m4 +# libkmod/docs/Makefile.in +# m4/libtool.m4 +# m4/lt~obsolete.m4 +# m4/ltoptions.m4 +# m4/ltsugar.m4 +# m4/ltversion.m4 +# Makefile.in +# LGPL-2.1-only: +# libkmod/python/kmod/error.py +# libkmod/python/kmod/__init__.py +# libkmod/python/kmod/version.py +# libkmod/python/kmod/version.py.in +# LGPL-2.1-or-later: +# config.h.in (no explicit license, the one in COPYING is assumed) +# libkmod +# man (no explicit license, the one in COPYING is assumed) +# shared +# shell-completion/bash/kmod +# testsuite +# X11: +# build-aux/install-sh +License: GPL-2.0-or-later AND GPL-3.0-or-later AND FSFUL AND FSFULLRWD AND LGPL-2.1-only AND LGPL-2.1-or-later AND X11 URL: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.tar.xz Source1: weak-modules @@ -54,7 +97,6 @@ examples of loaded and unloaded modules. %package libs Summary: Libraries to handle kernel module loading and unloading -License: LGPLv2+ %description libs The kmod-libs package provides runtime libraries for any application that @@ -151,6 +193,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Fri Dec 01 2023 Eugene Syromiatnikov - 31-3 +- migrated to SPDX license + * Thu Nov 09 2023 Josh Boyer - 31-2 - Add upstream patches to enable SHA3 support - New upstream v31 From b335496724965971438ed634792e0d24caab1db1 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 21 Jan 2024 01:06:54 +0000 Subject: [PATCH 58/77] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index ea34929..dfed280 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 31 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Linux kernel module management utilities # https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis @@ -193,6 +193,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Sun Jan 21 2024 Fedora Release Engineering - 31-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Fri Dec 01 2023 Eugene Syromiatnikov - 31-3 - migrated to SPDX license From bac67d1d7478ffa5fe40e671c24e9f10e7aa29c2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 25 Jan 2024 00:42:55 +0000 Subject: [PATCH 59/77] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index dfed280..e3ffcd3 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 31 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Linux kernel module management utilities # https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis @@ -193,6 +193,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Thu Jan 25 2024 Fedora Release Engineering - 31-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Sun Jan 21 2024 Fedora Release Engineering - 31-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 7648e1a704a4aefe5a2926e4825d0b54087be1b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 11 Apr 2024 10:47:32 +0200 Subject: [PATCH 60/77] Prepare for bin-sbin merge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin Create symlinks use 'ln --relative' so that we don't get /usr/bin/foo → ../bin/bar, but instead /usr/bin/foo → bar. Create compat provides for the old file locations to satisfy Requires in other packages. --- kmod.spec | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/kmod.spec b/kmod.spec index e3ffcd3..5971c8b 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 31 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Linux kernel module management utilities # https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis @@ -89,6 +89,18 @@ Provides: module-init-tools = 4.0-1 Obsoletes: module-init-tools < 4.0-1 Provides: /sbin/modprobe +%if "%{_sbindir}" == "%{_bindir}" +# Compat symlinks for Requires in other packages. +# We rely on filesystem to create the symlinks for us. +Requires: filesystem(unmerged-sbin-symlinks) +Provides: /usr/sbin/modprobe +Provides: /usr/sbin/modinfo +Provides: /usr/sbin/insmod +Provides: /usr/sbin/rmmod +Provides: /usr/sbin/lsmod +Provides: /usr/sbin/depmod +%endif + %description The kmod package provides various programs needed for automatic loading and unloading of modules under 2.6, 3.x, and later kernels, as well @@ -139,12 +151,9 @@ popd find %{buildroot} -type f -name "*.la" -delete mkdir -p $RPM_BUILD_ROOT%{_sbindir} -ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/modprobe -ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/modinfo -ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/insmod -ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/rmmod -ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/depmod -ln -sf ../bin/kmod $RPM_BUILD_ROOT%{_sbindir}/lsmod +for i in modprobe modinfo insmod rmmod depmod lsmod; do + ln -sf --relative $RPM_BUILD_ROOT%{_bindir}/kmod $RPM_BUILD_ROOT%{_sbindir}/$i +done mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d @@ -193,6 +202,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Thu Apr 11 2024 Zbigniew Jedrzejewski-Szmek - 31-6 +- Prepare for %%_bindir==%%_sbindir + * Thu Jan 25 2024 Fedora Release Engineering - 31-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 486394f8b7dc812cb158ffaef8cf39a03ffbb439 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 18 Jul 2024 12:29:07 +0000 Subject: [PATCH 61/77] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 5971c8b..3b532d0 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 31 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Linux kernel module management utilities # https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis @@ -202,6 +202,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Thu Jul 18 2024 Fedora Release Engineering - 31-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Thu Apr 11 2024 Zbigniew Jedrzejewski-Szmek - 31-6 - Prepare for %%_bindir==%%_sbindir From 5baad98a23cd1503639538bf649b0ea9d05b2138 Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Mon, 12 Aug 2024 15:59:22 +0200 Subject: [PATCH 62/77] weak-modules: use a proper program for dumping symvers Previously it was assumed that symvers is in gzip format, which is no longer the case, so zcat was used. Dispatch based on the symvers file extension. References: RHEL-39388 Signed-off-by: Eugene Syromiatnikov --- kmod.spec | 5 ++++- weak-modules | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/kmod.spec b/kmod.spec index 3b532d0..fed1427 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 31 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Linux kernel module management utilities # https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis @@ -202,6 +202,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Mon Aug 12 20234 Eugene Syromiatnikov - 31-8 +- weak-modules: use either zcat or xzcat based on symvers file extension + * Thu Jul 18 2024 Fedora Release Engineering - 31-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild diff --git a/weak-modules b/weak-modules index d4ac171..76523a7 100644 --- a/weak-modules +++ b/weak-modules @@ -758,6 +758,7 @@ validate_weak_links() { # to return to caller that original proposal is not valid # here 0 is true, 1 is false, since it will be the return code local is_configuration_valid=0 + local cat_prog tmp=$(mktemp -p $tmpdir) compatible_modules=() @@ -766,7 +767,12 @@ validate_weak_links() { local symvers_path=$(find_symvers_file "$krel") [[ -n "$symvers_path" ]] || return - zcat "$symvers_path" > $tmpdir/symvers-$krel + cat_prog="cat" + case "$symvers" in + *.gz) cat_prog="zcat" ;; + *.xz) cat_prog="xzcat" ;; + esac + "$cat_prog" "$symvers_path" > $tmpdir/symvers-$krel fi while ((is_updates_changed)); do From 73d6e056b5127a939e3ef6c0440056ac6f1dbd3a Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Mon, 12 Aug 2024 16:11:02 +0200 Subject: [PATCH 63/77] kmod.spec: fix a typo in date in changelog entry Signed-off-by: Eugene Syromiatnikov --- kmod.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index fed1427..c01dc48 100644 --- a/kmod.spec +++ b/kmod.spec @@ -202,7 +202,7 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog -* Mon Aug 12 20234 Eugene Syromiatnikov - 31-8 +* Mon Aug 12 2024 Eugene Syromiatnikov - 31-8 - weak-modules: use either zcat or xzcat based on symvers file extension * Thu Jul 18 2024 Fedora Release Engineering - 31-7 From de9195aa3e41469bb6b51f0788fecd9c57d60f6f Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Thu, 15 Aug 2024 20:40:57 +0200 Subject: [PATCH 64/77] New upstream v33 * .gitignore: Add /kmod-33.tar.xz, * kmod-tip.patch: Remove. * kmod.spec (Version): Bump to 33. (Release): Reset to 1. (Patch1): Remove. (BuildRequires): Remove libxslt and docbook-style-xsl, add scdoc; upstream switched to scdoc-based man pages in commt v33~46. (%install): Remove symlinks installed by make install since v32~3. (%files): kmod.pc is moved to %{_datadir} and is moved to be a part of the main package and not kmod-devel, as it should be; TODO file has been removed in v33~2. (%chanelog): Add a record. * sources: Replace the kmod-31.tar.xz with kmod-33.tar.xz. Resolves: rhbz#2268030 Signed-off-by: Eugene Syromiatnikov --- .gitignore | 1 + kmod-tip.patch | 561 ------------------------------------------------- kmod.spec | 17 +- sources | 2 +- 4 files changed, 13 insertions(+), 568 deletions(-) delete mode 100644 kmod-tip.patch diff --git a/.gitignore b/.gitignore index b19ddb5..b486f98 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ /kmod-30.tar.gz /kmod-30.tar.xz /kmod-31.tar.xz +/kmod-33.tar.xz diff --git a/kmod-tip.patch b/kmod-tip.patch deleted file mode 100644 index d57d9f4..0000000 --- a/kmod-tip.patch +++ /dev/null @@ -1,561 +0,0 @@ -From 1bb23d7f19d888fbdd96ae0fe929b7086713ef33 Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Tue, 18 Jul 2023 14:01:52 +0200 -Subject: [PATCH 1/6] configure: Detect openssl sm3 support - -Older openssl versions do not support sm3. The code has an option to -disable the sm3 hash but the lack of openssl support is not detected -automatically. - -Signed-off-by: Michal Suchanek -Link: https://lore.kernel.org/r/b97e20faa07e9e31c6eaf96683011aa24e80760c.1689681454.git.msuchanek@suse.de -Signed-off-by: Lucas De Marchi ---- - configure.ac | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 82a8532..e5bceea 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -123,6 +123,13 @@ AC_ARG_WITH([openssl], - AS_IF([test "x$with_openssl" != "xno"], [ - PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0], [LIBS="$LIBS $libcrypto_LIBS"]) - AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.]) -+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include -+ int nid = NID_sm3;]])], [ -+ AC_MSG_NOTICE([openssl supports sm3]) -+ ], [ -+ AC_MSG_NOTICE([openssl sm3 support not detected]) -+ CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SM3" -+ ]) - ], [ - AC_MSG_NOTICE([openssl support not requested]) - ]) --- -2.41.0 - - -From 4e7effbdc00307d0d1e83115e0d00cc75aae5cc6 Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Tue, 18 Jul 2023 14:01:53 +0200 -Subject: [PATCH 2/6] man/depmod.d: Fix incorrect /usr/lib search path - -depmod searches /lib/depmod.d but the man page says /usr/lib/depmod.d is -searched. Align the documentation with the code. - -Signed-off-by: Michal Suchanek -Link: https://lore.kernel.org/r/9c5a6356b1a111eb6e17ddb110494b7f1d1b44c0.1689681454.git.msuchanek@suse.de -Signed-off-by: Lucas De Marchi ---- - man/depmod.d.xml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/man/depmod.d.xml b/man/depmod.d.xml -index 76548e9..8d3d821 100644 ---- a/man/depmod.d.xml -+++ b/man/depmod.d.xml -@@ -39,7 +39,7 @@ - - - -- /usr/lib/depmod.d/*.conf -+ /lib/depmod.d/*.conf - /usr/local/lib/depmod.d/*.conf - /run/depmod.d/*.conf - /etc/depmod.d/*.conf --- -2.41.0 - - -From 8463809f8a29b254b2cab2ce755641bc690f07c9 Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Tue, 18 Jul 2023 14:01:54 +0200 -Subject: [PATCH 3/6] libkmod, depmod: Load modprobe.d, depmod.d from - ${prefix}/lib. - -There is an ongoing effort to limit use of files outside of /usr (or -${prefix} on general). Currently all modprobe.d paths are hardcoded to -outside of $prefix. Teach kmod to load modprobe.d from ${prefix}/lib. - -On some distributions /usr/lib and /lib are the same directory because -of a compatibility symlink, and it is possible to craft configuration -files with sideeffects that would behave differently when loaded twice. -However, the override semantic ensures that one 'overrides' the other, -and only one configuration file of the same name is loaded from any of -the search directories. - -Signed-off-by: Michal Suchanek -Link: https://lore.kernel.org/r/a290343ce32e2a3c25b134e4f27c13b26e06c9e0.1689681454.git.msuchanek@suse.de -Signed-off-by: Lucas De Marchi ---- - Makefile.am | 1 + - configure.ac | 5 +++++ - libkmod/libkmod.c | 7 ++++--- - man/Makefile.am | 9 +++++++-- - man/depmod.d.xml | 1 + - man/modprobe.d.xml | 1 + - tools/depmod.c | 1 + - 7 files changed, 20 insertions(+), 5 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 5b7abfe..e6630a3 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -19,6 +19,7 @@ AM_CPPFLAGS = \ - -include $(top_builddir)/config.h \ - -I$(top_srcdir) \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ -+ -DDISTCONFDIR=\""$(distconfdir)"\" \ - ${zlib_CFLAGS} - - AM_CFLAGS = $(OUR_CFLAGS) -diff --git a/configure.ac b/configure.ac -index e5bceea..fd88d1f 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -79,6 +79,10 @@ AC_COMPILE_IFELSE( - # --with- - ##################################################################### - -+AC_ARG_WITH([distconfdir], AS_HELP_STRING([--with-distconfdir=DIR], [directory to search for distribution configuration files]), -+ [], [with_distconfdir='${prefix}/lib']) -+AC_SUBST([distconfdir], [$with_distconfdir]) -+ - AC_ARG_WITH([rootlibdir], - AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), - [], [with_rootlibdir=$libdir]) -@@ -313,6 +317,7 @@ AC_MSG_RESULT([ - - prefix: ${prefix} - sysconfdir: ${sysconfdir} -+ distconfdir: ${distconfdir} - libdir: ${libdir} - rootlibdir: ${rootlibdir} - includedir: ${includedir} -diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c -index 1b8773c..57fac1c 100644 ---- a/libkmod/libkmod.c -+++ b/libkmod/libkmod.c -@@ -65,6 +65,7 @@ static const char *const default_config_paths[] = { - SYSCONFDIR "/modprobe.d", - "/run/modprobe.d", - "/usr/local/lib/modprobe.d", -+ DISTCONFDIR "/modprobe.d", - "/lib/modprobe.d", - NULL - }; -@@ -272,9 +273,9 @@ static enum kmod_file_compression_type get_kernel_compression(struct kmod_ctx *c - * to load from user-defined configuration parameters such as - * alias, blacklists, commands (install, remove). If NULL - * defaults to /etc/modprobe.d, /run/modprobe.d, -- * /usr/local/lib/modprobe.d and /lib/modprobe.d. Give an empty -- * vector if configuration should not be read. This array must -- * be null terminated. -+ * /usr/local/lib/modprobe.d, DISTCONFDIR/modprobe.d, and -+ * /lib/modprobe.d. Give an empty vector if configuration should -+ * not be read. This array must be null terminated. - * - * Create kmod library context. This reads the kmod configuration - * and fills in the default values. -diff --git a/man/Makefile.am b/man/Makefile.am -index 11514d5..2fea8e4 100644 ---- a/man/Makefile.am -+++ b/man/Makefile.am -@@ -17,9 +17,14 @@ EXTRA_DIST = $(MAN5:%.5=%.xml) $(MAN8:%.8=%.xml) - CLEANFILES = $(dist_man_MANS) - - %.5 %.8: %.xml -- $(AM_V_XSLT)$(XSLT) \ -+ $(AM_V_XSLT)if [ '$(distconfdir)' != '/lib' ] ; then \ -+ sed -e 's|@DISTCONFDIR@|$(distconfdir)|g' $< ; \ -+ else \ -+ sed -e '/@DISTCONFDIR@/d' $< ; \ -+ fi | \ -+ $(XSLT) \ - -o $@ \ - --nonet \ - --stringparam man.output.quietly 1 \ - --param funcsynopsis.style "'ansi'" \ -- http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< -+ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl - -diff --git a/man/depmod.d.xml b/man/depmod.d.xml -index 8d3d821..f282a39 100644 ---- a/man/depmod.d.xml -+++ b/man/depmod.d.xml -@@ -40,6 +40,7 @@ - - - /lib/depmod.d/*.conf -+ @DISTCONFDIR@/depmod.d/*.conf - /usr/local/lib/depmod.d/*.conf - /run/depmod.d/*.conf - /etc/depmod.d/*.conf -diff --git a/man/modprobe.d.xml b/man/modprobe.d.xml -index 0ab3e91..2bf6537 100644 ---- a/man/modprobe.d.xml -+++ b/man/modprobe.d.xml -@@ -41,6 +41,7 @@ - - - /lib/modprobe.d/*.conf -+ @DISTCONFDIR@/modprobe.d/*.conf - /usr/local/lib/modprobe.d/*.conf - /run/modprobe.d/*.conf - /etc/modprobe.d/*.conf -diff --git a/tools/depmod.c b/tools/depmod.c -index 1d1d41d..630fef9 100644 ---- a/tools/depmod.c -+++ b/tools/depmod.c -@@ -54,6 +54,7 @@ static const char *const default_cfg_paths[] = { - SYSCONFDIR "/depmod.d", - "/run/depmod.d", - "/usr/local/lib/depmod.d", -+ DISTCONFDIR "/depmod.d", - "/lib/depmod.d", - NULL - }; --- -2.41.0 - - -From ecef7c131618bbd9c559924ecae55764089db0dd Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Tue, 18 Jul 2023 14:01:55 +0200 -Subject: [PATCH 4/6] kmod: Add pkgconfig file with kmod compile time - configuration - -Show distconfdir (where system configuration files are searched/to be -installed), sysconfdir (where user configuration files are searched), -module compressions, and module signatures supported. - -Signed-off-by: Michal Suchanek -Link: https://lore.kernel.org/r/468b3f572d3b84f25bb53ec8fcb15ed4871914d4.1689681454.git.msuchanek@suse.de -Signed-off-by: Lucas De Marchi ---- - Makefile.am | 2 +- - configure.ac | 11 +++++++++++ - tools/kmod.pc.in | 9 +++++++++ - 3 files changed, 21 insertions(+), 1 deletion(-) - create mode 100644 tools/kmod.pc.in - -diff --git a/Makefile.am b/Makefile.am -index e6630a3..2a54c25 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -96,7 +96,7 @@ libkmod_libkmod_internal_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES) - libkmod_libkmod_internal_la_LIBADD = $(libkmod_libkmod_la_LIBADD) - - pkgconfigdir = $(libdir)/pkgconfig --pkgconfig_DATA = libkmod/libkmod.pc -+pkgconfig_DATA = libkmod/libkmod.pc tools/kmod.pc - - bashcompletiondir=@bashcompletiondir@ - dist_bashcompletion_DATA = \ -diff --git a/configure.ac b/configure.ac -index fd88d1f..7bf8d78 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -21,6 +21,9 @@ LT_INIT([disable-static pic-only]) - AS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static is not supported by kmod])]) - AS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is not supported by kmod])]) - -+module_compressions="" -+module_signatures="legacy" -+ - ##################################################################### - # Program checks and configurations - ##################################################################### -@@ -94,6 +97,7 @@ AC_ARG_WITH([zstd], - AS_IF([test "x$with_zstd" != "xno"], [ - PKG_CHECK_MODULES([libzstd], [libzstd >= 1.4.4], [LIBS="$LIBS $libzstd_LIBS"]) - AC_DEFINE([ENABLE_ZSTD], [1], [Enable Zstandard for modules.]) -+ module_compressions="zstd $module_compressions" - ], [ - AC_MSG_NOTICE([Zstandard support not requested]) - ]) -@@ -105,6 +109,7 @@ AC_ARG_WITH([xz], - AS_IF([test "x$with_xz" != "xno"], [ - PKG_CHECK_MODULES([liblzma], [liblzma >= 4.99], [LIBS="$LIBS $liblzma_LIBS"]) - AC_DEFINE([ENABLE_XZ], [1], [Enable Xz for modules.]) -+ module_compressions="xz $module_compressions" - ], [ - AC_MSG_NOTICE([Xz support not requested]) - ]) -@@ -116,6 +121,7 @@ AC_ARG_WITH([zlib], - AS_IF([test "x$with_zlib" != "xno"], [ - PKG_CHECK_MODULES([zlib], [zlib], [LIBS="$LIBS $zlib_LIBS"]) - AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.]) -+ module_compressions="gzip $module_compressions" - ], [ - AC_MSG_NOTICE([zlib support not requested]) - ]) -@@ -134,6 +140,7 @@ AS_IF([test "x$with_openssl" != "xno"], [ - AC_MSG_NOTICE([openssl sm3 support not detected]) - CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SM3" - ]) -+ module_signatures="PKCS7 $module_signatures" - ], [ - AC_MSG_NOTICE([openssl support not requested]) - ]) -@@ -298,6 +305,9 @@ AC_DEFINE_UNQUOTED(KMOD_FEATURES, ["$with_features"], [Features in this build]) - # Generate files from *.in - ##################################################################### - -+AC_SUBST([module_compressions], $module_compressions) -+AC_SUBST([module_signatures], $module_signatures) -+ - AC_CONFIG_FILES([ - Makefile - man/Makefile -@@ -305,6 +315,7 @@ AC_CONFIG_FILES([ - libkmod/docs/version.xml - libkmod/libkmod.pc - libkmod/python/kmod/version.py -+ tools/kmod.pc - ]) - - -diff --git a/tools/kmod.pc.in b/tools/kmod.pc.in -new file mode 100644 -index 0000000..2595980 ---- /dev/null -+++ b/tools/kmod.pc.in -@@ -0,0 +1,9 @@ -+prefix=@prefix@ -+sysconfdir=@sysconfdir@ -+distconfdir=@distconfdir@ -+module_compressions=@module_compressions@ -+module_signatures=@module_signatures@ -+ -+Name: kmod -+Description: Tools to deal with kernel modules -+Version: @VERSION@ --- -2.41.0 - - -From 3af2f475b0b729f20279f2ce488cc9f727f0b763 Mon Sep 17 00:00:00 2001 -From: Sam James -Date: Sun, 5 Nov 2023 22:02:25 +0000 -Subject: [PATCH 5/6] tools: depmod: fix -Walloc-size -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -GCC 14 introduces a new -Walloc-size included in -Wextra which gives: -``` -tools/depmod.c:192:14: warning: allocation of insufficient size ‘1’ for type ‘struct index_node’ with size ‘1048’ [-Walloc-size] -tools/depmod.c:255:11: warning: allocation of insufficient size ‘1’ for type ‘struct index_value’ with size ‘16’ [-Walloc-size] -tools/depmod.c:286:35: warning: allocation of insufficient size ‘1’ for type ‘struct index_node’ with size ‘1048’ [-Walloc-size] -tools/depmod.c:315:44: warning: allocation of insufficient size ‘1’ for type ‘struct index_node’ with size ‘1048’ [-Walloc-size] -``` - -The calloc prototype is: -``` -void *calloc(size_t nmemb, size_t size); -``` - -So, just swap the number of members and size arguments to match the prototype, as -we're initialising 1 struct of size `sizeof(struct ...)`. GCC then sees we're not -doing anything wrong. - -Signed-off-by: Sam James ---- - tools/depmod.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/tools/depmod.c b/tools/depmod.c -index 630fef9..ab8513b 100644 ---- a/tools/depmod.c -+++ b/tools/depmod.c -@@ -190,7 +190,7 @@ static struct index_node *index_create(void) - { - struct index_node *node; - -- node = NOFAIL(calloc(sizeof(struct index_node), 1)); -+ node = NOFAIL(calloc(1, sizeof(struct index_node))); - node->prefix = NOFAIL(strdup("")); - node->first = INDEX_CHILDMAX; - -@@ -253,7 +253,7 @@ static int index_add_value(struct index_value **values, - values = &(*values)->next; - - len = strlen(value); -- v = NOFAIL(calloc(sizeof(struct index_value) + len + 1, 1)); -+ v = NOFAIL(calloc(1, sizeof(struct index_value) + len + 1)); - v->next = *values; - v->priority = priority; - memcpy(v->value, value, len + 1); -@@ -284,7 +284,7 @@ static int index_insert(struct index_node *node, const char *key, - struct index_node *n; - - /* New child is copy of node with prefix[j+1..N] */ -- n = NOFAIL(calloc(sizeof(struct index_node), 1)); -+ n = NOFAIL(calloc(1, sizeof(struct index_node))); - memcpy(n, node, sizeof(struct index_node)); - n->prefix = NOFAIL(strdup(&prefix[j+1])); - -@@ -313,7 +313,7 @@ static int index_insert(struct index_node *node, const char *key, - node->first = ch; - if (ch > node->last) - node->last = ch; -- node->children[ch] = NOFAIL(calloc(sizeof(struct index_node), 1)); -+ node->children[ch] = NOFAIL(calloc(1, sizeof(struct index_node))); - - child = node->children[ch]; - child->prefix = NOFAIL(strdup(&key[i+1])); --- -2.41.0 - - -From 510c8b7f7455c6613dd1706e5e41ec7b09cf6703 Mon Sep 17 00:00:00 2001 -From: Dimitri John Ledkov -Date: Sun, 29 Oct 2023 03:03:19 +0200 -Subject: [PATCH 6/6] libkmod: remove pkcs7 obj_to_hash_algo() - -Switch to using OBJ_obj2txt() to calculate and print the pkcs7 -signature hash name. This eliminates the need to duplicate libcrypto -NID to name mapping, detect SM3 openssl compile-time support, and -enables using any hashes that openssl and kernel know about. For -example SHA3 are being added for v6.7 and with this patch are -automatically supported. - -Signed-off-by: Dimitri John Ledkov -Link: https://lore.kernel.org/r/20231029010319.157390-1-dimitri.ledkov@canonical.com ---- - configure.ac | 7 ----- - libkmod/libkmod-signature.c | 59 +++++++++++++------------------------ - 2 files changed, 20 insertions(+), 46 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 7bf8d78..a6b8fa0 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -133,13 +133,6 @@ AC_ARG_WITH([openssl], - AS_IF([test "x$with_openssl" != "xno"], [ - PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0], [LIBS="$LIBS $libcrypto_LIBS"]) - AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.]) -- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include -- int nid = NID_sm3;]])], [ -- AC_MSG_NOTICE([openssl supports sm3]) -- ], [ -- AC_MSG_NOTICE([openssl sm3 support not detected]) -- CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SM3" -- ]) - module_signatures="PKCS7 $module_signatures" - ], [ - AC_MSG_NOTICE([openssl support not requested]) -diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c -index b749a81..80f6447 100644 ---- a/libkmod/libkmod-signature.c -+++ b/libkmod/libkmod-signature.c -@@ -127,6 +127,7 @@ struct pkcs7_private { - PKCS7 *pkcs7; - unsigned char *key_id; - BIGNUM *sno; -+ char *hash_algo; - }; - - static void pkcs7_free(void *s) -@@ -137,42 +138,11 @@ static void pkcs7_free(void *s) - PKCS7_free(pvt->pkcs7); - BN_free(pvt->sno); - free(pvt->key_id); -+ free(pvt->hash_algo); - free(pvt); - si->private = NULL; - } - --static int obj_to_hash_algo(const ASN1_OBJECT *o) --{ -- int nid; -- -- nid = OBJ_obj2nid(o); -- switch (nid) { -- case NID_md4: -- return PKEY_HASH_MD4; -- case NID_md5: -- return PKEY_HASH_MD5; -- case NID_sha1: -- return PKEY_HASH_SHA1; -- case NID_ripemd160: -- return PKEY_HASH_RIPE_MD_160; -- case NID_sha256: -- return PKEY_HASH_SHA256; -- case NID_sha384: -- return PKEY_HASH_SHA384; -- case NID_sha512: -- return PKEY_HASH_SHA512; -- case NID_sha224: -- return PKEY_HASH_SHA224; --# ifndef OPENSSL_NO_SM3 -- case NID_sm3: -- return PKEY_HASH_SM3; --# endif -- default: -- return -1; -- } -- return -1; --} -- - static const char *x509_name_to_str(X509_NAME *name) - { - int i; -@@ -219,7 +189,8 @@ static bool fill_pkcs7(const char *mem, off_t size, - unsigned char *key_id_str; - struct pkcs7_private *pvt; - const char *issuer_str; -- int hash_algo; -+ char *hash_algo; -+ int hash_algo_len; - - size -= sig_len; - pkcs7_raw = mem + size; -@@ -278,27 +249,37 @@ static bool fill_pkcs7(const char *mem, off_t size, - - X509_ALGOR_get0(&o, NULL, NULL, dig_alg); - -- hash_algo = obj_to_hash_algo(o); -- if (hash_algo < 0) -+ // Use OBJ_obj2txt to calculate string length -+ hash_algo_len = OBJ_obj2txt(NULL, 0, o, 0); -+ if (hash_algo_len < 0) - goto err3; -- sig_info->hash_algo = pkey_hash_algo[hash_algo]; -- // hash algo has not been recognized -- if (sig_info->hash_algo == NULL) -+ hash_algo = malloc(hash_algo_len + 1); -+ if (hash_algo == NULL) - goto err3; -+ hash_algo_len = OBJ_obj2txt(hash_algo, hash_algo_len + 1, o, 0); -+ if (hash_algo_len < 0) -+ goto err4; -+ -+ // Assign libcrypto hash algo string or number -+ sig_info->hash_algo = hash_algo; -+ - sig_info->id_type = pkey_id_type[modsig->id_type]; - - pvt = malloc(sizeof(*pvt)); - if (pvt == NULL) -- goto err3; -+ goto err4; - - pvt->pkcs7 = pkcs7; - pvt->key_id = key_id_str; - pvt->sno = sno_bn; -+ pvt->hash_algo = hash_algo; - sig_info->private = pvt; - - sig_info->free = pkcs7_free; - - return true; -+err4: -+ free(hash_algo); - err3: - free(key_id_str); - err2: --- -2.41.0 - diff --git a/kmod.spec b/kmod.spec index c01dc48..05ddde2 100644 --- a/kmod.spec +++ b/kmod.spec @@ -15,8 +15,8 @@ %bcond_without zstd Name: kmod -Version: 31 -Release: 8%{?dist} +Version: 33 +Release: 1%{?dist} Summary: Linux kernel module management utilities # https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis @@ -67,7 +67,6 @@ URL: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.tar.xz Source1: weak-modules Source2: depmod.conf.dist -Patch1: kmod-tip.patch Exclusiveos: Linux BuildRequires: gcc @@ -78,7 +77,7 @@ BuildRequires: zlib-devel %if %{with xz} BuildRequires: xz-devel %endif -BuildRequires: libxslt docbook-style-xsl +BuildRequires: scdoc BuildRequires: openssl-devel BuildRequires: make automake %if %{with zstd} @@ -152,6 +151,8 @@ find %{buildroot} -type f -name "*.la" -delete mkdir -p $RPM_BUILD_ROOT%{_sbindir} for i in modprobe modinfo insmod rmmod depmod lsmod; do + # kmod now installs the links into bindir by itself + rm $RPM_BUILD_ROOT%{_bindir}/$i ln -sf --relative $RPM_BUILD_ROOT%{_bindir}/kmod $RPM_BUILD_ROOT%{_sbindir}/$i done @@ -185,11 +186,12 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %if %{with dist_conf} %{_sysconfdir}/depmod.d/dist.conf %endif +%{_datadir}/pkgconfig/kmod.pc %attr(0644,root,root) %{_mandir}/man5/mod*.d*.5* %attr(0644,root,root) %{_mandir}/man5/depmod.d.5* %{_mandir}/man5/modprobe.conf.5* %attr(0644,root,root) %{_mandir}/man8/*.8* -%doc NEWS README.md TODO +%doc NEWS README.md %files libs %license COPYING @@ -197,11 +199,14 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %files devel %{_includedir}/libkmod.h -%{_libdir}/pkgconfig/kmod.pc %{_libdir}/pkgconfig/libkmod.pc %{_libdir}/libkmod.so %changelog +* Thu Aug 15 2024 Eugene Syromiatnikov - 33-1 +- New upstream v33 +- Resolves: rhbz#2268030 + * Mon Aug 12 2024 Eugene Syromiatnikov - 31-8 - weak-modules: use either zcat or xzcat based on symvers file extension diff --git a/sources b/sources index d97b132..0c06f7c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (kmod-31.tar.xz) = 05ca70381808bec5f262b94db625662c385408988178a35e4aaf4960ee0716dc0cbfc327160ea4b61098d0c2130ab1b5142ea8156bea8e06ded7f4d288b6d085 +SHA512 (kmod-33.tar.xz) = 32d79d0bb7e89012f18458d4e88325f8e19a7dba6e1d5cff01aec3e618d1757b0f7c119735bf38d02e0d056a14273fd7522fca7c61a4d12a3ea5854bb662fff8 From 0a2caa79e2880b25a791b1130827d1dd8c643c60 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 28 Oct 2024 16:09:50 +0000 Subject: [PATCH 65/77] cleanup gitignore --- .gitignore | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index b486f98..4e53c68 100644 --- a/.gitignore +++ b/.gitignore @@ -1,28 +1 @@ -/kmod-7.tar.xz -/kmod-8.tar.xz -/kmod-9.tar.xz -/kmod-10.tar.xz -/kmod-11.tar.xz -/kmod-12.tar.xz -/kmod-13.tar.xz -/kmod-14.tar.xz -/kmod-15.tar.xz -/kmod-16.tar.xz -/kmod-17.tar.xz -/kmod-18.tar.xz -/kmod-19.tar.xz -/kmod-20.tar.xz -/kmod-21.tar.xz -/kmod-22.tar.xz -/kmod-23.tar.xz -/kmod-24.tar.xz -/kmod-25.tar.xz -/kmod-26.tar.xz -/kmod-27.tar.xz -/kmod-28.tar.xz -/kmod-29.tar.gz -/kmod-29.tar.xz -/kmod-30.tar.gz -/kmod-30.tar.xz -/kmod-31.tar.xz -/kmod-33.tar.xz +/kmod-*.tar.xz From 26240b4bb3f9a4199c4aa8213ce585780bd540a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 12 Jan 2025 14:32:51 +0100 Subject: [PATCH 66/77] Rebuilt for the bin-sbin merge (2nd attempt) https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index 05ddde2..e171cbf 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 33 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Linux kernel module management utilities # https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis @@ -203,6 +203,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Sun Jan 12 2025 Zbigniew Jędrzejewski-Szmek - 33-2 +- Rebuilt for the bin-sbin merge (2nd attempt) + * Thu Aug 15 2024 Eugene Syromiatnikov - 33-1 - New upstream v33 - Resolves: rhbz#2268030 From 35b018985525206e6d7a67dcfe3be70aafae8766 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jan 2025 09:35:58 +0000 Subject: [PATCH 67/77] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index e171cbf..7a935b4 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 33 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Linux kernel module management utilities # https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis @@ -203,6 +203,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Fri Jan 17 2025 Fedora Release Engineering - 33-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Sun Jan 12 2025 Zbigniew Jędrzejewski-Szmek - 33-2 - Rebuilt for the bin-sbin merge (2nd attempt) From c6eaf81e4cb61123c4ee84a7da4b64e9b8d5036c Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Mon, 24 Feb 2025 12:13:48 -0500 Subject: [PATCH 68/77] New upstream release --- kmod.spec | 10 +++++++--- sources | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/kmod.spec b/kmod.spec index 7a935b4..d88670a 100644 --- a/kmod.spec +++ b/kmod.spec @@ -15,8 +15,8 @@ %bcond_without zstd Name: kmod -Version: 33 -Release: 3%{?dist} +Version: 34 +Release: 1%{?dist} Summary: Linux kernel module management utilities # https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis @@ -79,7 +79,7 @@ BuildRequires: xz-devel %endif BuildRequires: scdoc BuildRequires: openssl-devel -BuildRequires: make automake +BuildRequires: make automake libtool %if %{with zstd} BuildRequires: libzstd-devel %endif @@ -203,6 +203,10 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Mon Feb 24 2025 Josh Boyer +- New upstream v34 +- Resolves: rhbz#2347049 + * Fri Jan 17 2025 Fedora Release Engineering - 33-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild diff --git a/sources b/sources index 0c06f7c..b9ece1c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (kmod-33.tar.xz) = 32d79d0bb7e89012f18458d4e88325f8e19a7dba6e1d5cff01aec3e618d1757b0f7c119735bf38d02e0d056a14273fd7522fca7c61a4d12a3ea5854bb662fff8 +SHA512 (kmod-34.tar.xz) = 214ef8ea78da059a1dd8cce66267690f27ee47e22398e7b0e0b68834c42eb94f2b77cf99ef9c4bdb3f0aee103abda1d9bc9dfc414051e9ad47a72e063802fdbf From 46456317d7f14ae2ef2fd7b5142e800cd61b16b5 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Mon, 24 Feb 2025 12:26:43 -0500 Subject: [PATCH 69/77] Add gtk-doc BR --- kmod.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index d88670a..5497eaf 100644 --- a/kmod.spec +++ b/kmod.spec @@ -77,7 +77,7 @@ BuildRequires: zlib-devel %if %{with xz} BuildRequires: xz-devel %endif -BuildRequires: scdoc +BuildRequires: scdoc gtk-doc BuildRequires: openssl-devel BuildRequires: make automake libtool %if %{with zstd} From 56b12983a2a52fcc2e8291af771b7bddf4f43f61 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Mon, 24 Feb 2025 13:16:51 -0500 Subject: [PATCH 70/77] Last changes for -34 --- kmod.spec | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/kmod.spec b/kmod.spec index 5497eaf..9f22611 100644 --- a/kmod.spec +++ b/kmod.spec @@ -125,6 +125,7 @@ applications that wish to load or unload Linux kernel modules. %autosetup -p1 %build +autoreconf --install %configure \ --with-openssl \ %if %{with zlib} @@ -149,13 +150,6 @@ popd find %{buildroot} -type f -name "*.la" -delete -mkdir -p $RPM_BUILD_ROOT%{_sbindir} -for i in modprobe modinfo insmod rmmod depmod lsmod; do - # kmod now installs the links into bindir by itself - rm $RPM_BUILD_ROOT%{_bindir}/$i - ln -sf --relative $RPM_BUILD_ROOT%{_bindir}/kmod $RPM_BUILD_ROOT%{_sbindir}/$i -done - mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d @@ -183,6 +177,8 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_sbindir}/weak-modules %endif %{_datadir}/bash-completion/ +%{_datadir}/fish/vendor_functions.d/* +%{_datadir}/zsh/site-functions/* %if %{with dist_conf} %{_sysconfdir}/depmod.d/dist.conf %endif From bd7db8fb025ec5567a796bd2e1b9c734ee71b1bc Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Sat, 8 Mar 2025 13:05:24 -0500 Subject: [PATCH 71/77] New upstream v34.1 Resolves: rhbz#2350269 --- kmod.spec | 6 +++++- sources | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kmod.spec b/kmod.spec index 9f22611..19192eb 100644 --- a/kmod.spec +++ b/kmod.spec @@ -15,7 +15,7 @@ %bcond_without zstd Name: kmod -Version: 34 +Version: 34.1 Release: 1%{?dist} Summary: Linux kernel module management utilities @@ -199,6 +199,10 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Sat Mar 08 2025 Josh Boyer - 34.1-1 +- New upstream v34.1 +- Resolves: rhbz#2350269 + * Mon Feb 24 2025 Josh Boyer - New upstream v34 - Resolves: rhbz#2347049 diff --git a/sources b/sources index b9ece1c..eca3a3b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (kmod-34.tar.xz) = 214ef8ea78da059a1dd8cce66267690f27ee47e22398e7b0e0b68834c42eb94f2b77cf99ef9c4bdb3f0aee103abda1d9bc9dfc414051e9ad47a72e063802fdbf +SHA512 (kmod-34.1.tar.xz) = f1f5026f31747270aea8b65df9eca95cc253e48622bfdb87e016e272a79ad1e90c0026cdf83a947fd53d8cbc1be1c546a5116db9617b690ab1b80f9792b6f5b2 From c41da9ae87a643a5fbc77a9b67af2d543371353b Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Mon, 31 Mar 2025 07:41:52 -0400 Subject: [PATCH 72/77] New upstream v34.2 Resolves: rhbz#2355680 --- kmod.spec | 6 +++++- sources | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kmod.spec b/kmod.spec index 19192eb..bc28ee9 100644 --- a/kmod.spec +++ b/kmod.spec @@ -15,7 +15,7 @@ %bcond_without zstd Name: kmod -Version: 34.1 +Version: 34.2 Release: 1%{?dist} Summary: Linux kernel module management utilities @@ -199,6 +199,10 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Mon Mar 31 2025 Josh Boyer - 34.2-1 +- New upstream v34.2 +- Resolves: rhbz#2355680 + * Sat Mar 08 2025 Josh Boyer - 34.1-1 - New upstream v34.1 - Resolves: rhbz#2350269 diff --git a/sources b/sources index eca3a3b..0390a92 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (kmod-34.1.tar.xz) = f1f5026f31747270aea8b65df9eca95cc253e48622bfdb87e016e272a79ad1e90c0026cdf83a947fd53d8cbc1be1c546a5116db9617b690ab1b80f9792b6f5b2 +SHA512 (kmod-34.2.tar.xz) = 0e095c45ad61a6c61ce1ad61b9aa10cf5040e688b749f9a933b0e7d12de493c58027a5068b459cbbce05576fc564a22b83a3dbef1e6511b2a3e27034c88afd33 From d1dc8b58a874162dd3d0e0004d0f6172ac090f4e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 24 Jul 2025 18:50:59 +0000 Subject: [PATCH 73/77] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- kmod.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index bc28ee9..ce3b8be 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 34.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Linux kernel module management utilities # https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis @@ -199,6 +199,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Thu Jul 24 2025 Fedora Release Engineering - 34.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Mon Mar 31 2025 Josh Boyer - 34.2-1 - New upstream v34.2 - Resolves: rhbz#2355680 From b64bf8be07c2fe54ca79009218e72161de636a89 Mon Sep 17 00:00:00 2001 From: "Ziqian SUN (Zamir)" Date: Thu, 20 Mar 2025 16:50:10 +0800 Subject: [PATCH 74/77] Convert gating to restraint and tmt Signed-off-by: Ziqian SUN (Zamir) --- .fmf/version | 1 + tests/libkmod/Makefile | 46 ----------------------- tests/libkmod/libkmod.fmf | 6 +++ tests/libkmod/metadata | 14 +++++++ tests/libkmod/runtest.sh | 1 + tests/plan.fmf | 4 ++ tests/sanity/Makefile | 79 --------------------------------------- tests/sanity/metadata | 12 ++++++ tests/sanity/sanity.fmf | 1 + tests/tests.yml | 2 +- 10 files changed, 40 insertions(+), 126 deletions(-) create mode 100644 .fmf/version delete mode 100644 tests/libkmod/Makefile create mode 100644 tests/libkmod/libkmod.fmf create mode 100644 tests/libkmod/metadata create mode 100644 tests/plan.fmf delete mode 100644 tests/sanity/Makefile create mode 100644 tests/sanity/metadata create mode 100644 tests/sanity/sanity.fmf diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/tests/libkmod/Makefile b/tests/libkmod/Makefile deleted file mode 100644 index cc53a81..0000000 --- a/tests/libkmod/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/libkmod -# Description: Test if libkmod working ok -# Author: Susant Sahani -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -export TEST=/CoreOS/libkmod -export TESTVERSION=1.0 - -OBJS = test-libkmod.c -CFLAG = -Wall -g3 -CC = gcc -LIBS = -lkmod -lcmocka - -test-libkmod:${OBJ} - ${CC} ${CFLAGS} ${INCLUDES} -o $@ ${OBJS} ${LIBS} - -run: test-libkmod - ./runtest.sh -clean: - -rm -f test-libkmod - -.c.o: - ${CC} ${CFLAGS} ${INCLUDES} -c $< - -CC = gcc - -include /usr/share/rhts/lib/rhts-make.include -$(METADATA): Makefile - @echo "Owner: Susant Sahani" > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test libkmod works ok" >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 5m" >> $(METADATA) - @echo "RunFor: libkmod" >> $(METADATA) - @echo "Requires: libkmod libkmod-devel" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Releases: -Fedora 29" >> $(METADATA) - rhts-lint $(METADATA) diff --git a/tests/libkmod/libkmod.fmf b/tests/libkmod/libkmod.fmf new file mode 100644 index 0000000..d796b57 --- /dev/null +++ b/tests/libkmod/libkmod.fmf @@ -0,0 +1,6 @@ +test: bash ./runtest.sh +require: + - libcmocka-devel + - kmod-devel + - make + - gcc diff --git a/tests/libkmod/metadata b/tests/libkmod/metadata new file mode 100644 index 0000000..455987a --- /dev/null +++ b/tests/libkmod/metadata @@ -0,0 +1,14 @@ +[General] +name=libkmod gating test +owner=Susant Sahani +description=libkmod gating test +license=GPLv2 +confidential=no +destructive=no + +[restraint] +entry_point=./runtest.sh +max_time=15m +use_pty=false +dependencies=gcc,make,libcmocka-devel,kmod-devel + diff --git a/tests/libkmod/runtest.sh b/tests/libkmod/runtest.sh index 1ef013c..d86b2e2 100755 --- a/tests/libkmod/runtest.sh +++ b/tests/libkmod/runtest.sh @@ -18,6 +18,7 @@ rlJournalStart rlPhaseStartSetup rlAssertRpm $PACKAGE rlAssertExists "$IPIP" + rlRun "gcc -o test-libkmod test-libkmod.c -lkmod -lcmocka" rlRun "cp test-libkmod /usr/bin/" rlPhaseEnd diff --git a/tests/plan.fmf b/tests/plan.fmf new file mode 100644 index 0000000..e6427de --- /dev/null +++ b/tests/plan.fmf @@ -0,0 +1,4 @@ +discover: + how: fmf +execute: + how: tmt diff --git a/tests/sanity/Makefile b/tests/sanity/Makefile deleted file mode 100644 index e422f7f..0000000 --- a/tests/sanity/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of general/kmod/sanity -# Description: kmod test -# -# 2016-07-31 -# Author: Chunyu Hu -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2016 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing -# to use, modify, copy, or redistribute it subject to the terms -# and conditions of the GNU General Public License version 2. -# -# This program is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program; if not, write to the Free -# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -TENV=_env -ifeq ($(PKG_TOP_DIR),) - export PKG_TOP_DIR := $(shell p=$$PWD; while :; do \ - [ -e $$p/env.mk -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) - export _TOP_DIR := $(shell p=$$PWD; while :; do \ - [ -d $$p/.git -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) - -include $(PKG_TOP_DIR)/env.mk -endif -include $(TENV) -ifeq ($(_TOP_DIR),) - _TOP_DIR=/mnt/tests/$(TOPLEVEL_NAMESPACE) -endif - -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(TENV) $(METADATA) _env runtest.sh Makefile PURPOSE lib.sh - -.PHONY: all install download clean - -run: $(FILES) build - ( set +o posix; . /usr/bin/rhts_environment.sh; \ - . /usr/share/beakerlib/beakerlib.sh; \ - . runtest.sh ) - -build: $(BUILT_FILES) - test -x runtest.sh || chmod a+x runtest.sh - -clean: - rm -fr *~ $(BUILT_FILES) - -include /usr/share/rhts/lib/rhts-make.include - -$(METADATA): Makefile - @echo "Owner: Chunyu Hu " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: kmod kernel module check from kernel modules tools">> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 1h" >> $(METADATA) - @echo "RunFor: kernel" >> $(METADATA) - @echo "Requires: kernel" >> $(METADATA) - @echo "Requires: sysstat perf trace-cmd" >> $(METADATA) - @echo "Requires: $(PACKAGE_NAME) python rpm wget" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - rhts-lint $(METADATA) diff --git a/tests/sanity/metadata b/tests/sanity/metadata new file mode 100644 index 0000000..6c68b4b --- /dev/null +++ b/tests/sanity/metadata @@ -0,0 +1,12 @@ +[General] +name=kmod gating test +owner=Ziqian SUN +description=kmod gating test +license=GPLv2 +confidential=no +destructive=no + +[restraint] +entry_point=./runtest.sh +max_time=15m +use_pty=false diff --git a/tests/sanity/sanity.fmf b/tests/sanity/sanity.fmf new file mode 100644 index 0000000..e9c6959 --- /dev/null +++ b/tests/sanity/sanity.fmf @@ -0,0 +1 @@ +test: bash ./runtest.sh diff --git a/tests/tests.yml b/tests/tests.yml index 828a27a..c8bd0fd 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -2,7 +2,7 @@ tags: - classic roles: - - role: standard-test-beakerlib + - role: standard-test-basic tests: - sanity - libkmod From b4bcf63353f3da600ec5a48b0cf60873f9d313ea Mon Sep 17 00:00:00 2001 From: Zamir SUN Date: Wed, 13 Aug 2025 15:11:26 +0800 Subject: [PATCH 75/77] Tests: Fix fmf files for gating Signed-off-by: Zamir SUN --- tests/libkmod/libkmod.fmf | 7 ++----- tests/plan.fmf | 6 ++++++ tests/sanity/sanity.fmf | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/libkmod/libkmod.fmf b/tests/libkmod/libkmod.fmf index d796b57..8733518 100644 --- a/tests/libkmod/libkmod.fmf +++ b/tests/libkmod/libkmod.fmf @@ -1,6 +1,3 @@ test: bash ./runtest.sh -require: - - libcmocka-devel - - kmod-devel - - make - - gcc +framework: beakerlib +duration: 15m diff --git a/tests/plan.fmf b/tests/plan.fmf index e6427de..160239c 100644 --- a/tests/plan.fmf +++ b/tests/plan.fmf @@ -1,3 +1,9 @@ +prepare: + how: install + package: + - libcmocka-devel + - make + - gcc discover: how: fmf execute: diff --git a/tests/sanity/sanity.fmf b/tests/sanity/sanity.fmf index e9c6959..8733518 100644 --- a/tests/sanity/sanity.fmf +++ b/tests/sanity/sanity.fmf @@ -1 +1,3 @@ test: bash ./runtest.sh +framework: beakerlib +duration: 15m From 91014e42d6e32377371d118a529f2295357f552c Mon Sep 17 00:00:00 2001 From: Zamir SUN Date: Wed, 13 Aug 2025 15:11:51 +0800 Subject: [PATCH 76/77] Tests: Remove tests.yml STI entrypoint to make tmt work Signed-off-by: Zamir SUN --- tests/tests.yml | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 tests/tests.yml diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index c8bd0fd..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,18 +0,0 @@ -- hosts: localhost - tags: - - classic - roles: - - role: standard-test-basic - tests: - - sanity - - libkmod - required_packages: - - kernel - - perf - - sysstat - - trace-cmd - - kmod - - kmod-devel - - gcc - - libcmocka - - libcmocka-devel From 2ce6b84eca9864e2d1286ffa184c728bd2ecc75f Mon Sep 17 00:00:00 2001 From: Zamir SUN Date: Wed, 13 Aug 2025 15:14:36 +0800 Subject: [PATCH 77/77] Bump to 34.2-3 to build and run new gating Signed-off-by: Zamir SUN --- kmod.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kmod.spec b/kmod.spec index ce3b8be..8d0b67b 100644 --- a/kmod.spec +++ b/kmod.spec @@ -16,7 +16,7 @@ Name: kmod Version: 34.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Linux kernel module management utilities # https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis @@ -199,6 +199,10 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Wed Aug 13 2025 Zamir SUN - 34.2-3 +- Rebuild to switch gating to TMT. +- Resolves: rhbz#2382934 + * Thu Jul 24 2025 Fedora Release Engineering - 34.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild