From f6434ef593686e646bd04cda8e3c7af167b15646 Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Mon, 24 Jul 2023 14:38:18 +0300 Subject: [PATCH] import kmod-redhat-arc4-5.14.0_284.11.1_dup9.2-2.el9_2 --- .gitignore | 1 + .kmod-redhat-arc4.metadata | 1 + SOURCES/9000-Makefile.patch | 77 ++++++ SOURCES/9001-add-driver-version.patch | 27 +++ SPECS/kmod-redhat-arc4.spec | 333 ++++++++++++++++++++++++++ 5 files changed, 439 insertions(+) create mode 100644 .gitignore create mode 100644 .kmod-redhat-arc4.metadata create mode 100644 SOURCES/9000-Makefile.patch create mode 100644 SOURCES/9001-add-driver-version.patch create mode 100644 SPECS/kmod-redhat-arc4.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..704be9e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/arc4-redhat-5.14.0_284.11.1_dup9.2.tar.bz2 diff --git a/.kmod-redhat-arc4.metadata b/.kmod-redhat-arc4.metadata new file mode 100644 index 0000000..770b851 --- /dev/null +++ b/.kmod-redhat-arc4.metadata @@ -0,0 +1 @@ +a811a1de2b0d56923b35b2e6c93eb4343fd82c3b SOURCES/arc4-redhat-5.14.0_284.11.1_dup9.2.tar.bz2 diff --git a/SOURCES/9000-Makefile.patch b/SOURCES/9000-Makefile.patch new file mode 100644 index 0000000..1ffa153 --- /dev/null +++ b/SOURCES/9000-Makefile.patch @@ -0,0 +1,77 @@ +Index: src/lib/crypto/Makefile +=================================================================== +--- src.orig/lib/crypto/Makefile 2023-05-31 09:41:53.066737337 +0200 ++++ src/lib/crypto/Makefile 2023-06-06 01:48:00.997429347 +0200 +@@ -1,8 +1,8 @@ + # SPDX-License-Identifier: GPL-2.0 + + # chacha is used by the /dev/random driver which is always builtin +-obj-y += chacha.o +-obj-$(CONFIG_CRYPTO_LIB_CHACHA_GENERIC) += libchacha.o ++#obj-y += chacha.o ++#obj-$(CONFIG_CRYPTO_LIB_CHACHA_GENERIC) += libchacha.o + + obj-$(CONFIG_CRYPTO_LIB_AES) += libaes.o + libaes-y := aes.o +@@ -11,34 +11,34 @@ + libarc4-y := arc4.o + + # blake2s is used by the /dev/random driver which is always builtin +-obj-y += libblake2s.o +-libblake2s-y := blake2s.o +-libblake2s-$(CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC) += blake2s-generic.o +- +-obj-$(CONFIG_CRYPTO_LIB_CHACHA20POLY1305) += libchacha20poly1305.o +-libchacha20poly1305-y += chacha20poly1305.o +- +-obj-$(CONFIG_CRYPTO_LIB_CURVE25519_GENERIC) += libcurve25519-generic.o +-libcurve25519-generic-y := curve25519-fiat32.o +-libcurve25519-generic-$(CONFIG_ARCH_SUPPORTS_INT128) := curve25519-hacl64.o +-libcurve25519-generic-y += curve25519-generic.o +- +-obj-$(CONFIG_CRYPTO_LIB_CURVE25519) += libcurve25519.o +-libcurve25519-y += curve25519.o +- +-obj-$(CONFIG_CRYPTO_LIB_DES) += libdes.o +-libdes-y := des.o +- +-obj-$(CONFIG_CRYPTO_LIB_POLY1305_GENERIC) += libpoly1305.o +-libpoly1305-y := poly1305-donna32.o +-libpoly1305-$(CONFIG_ARCH_SUPPORTS_INT128) := poly1305-donna64.o +-libpoly1305-y += poly1305.o ++#obj-y += libblake2s.o ++#libblake2s-y := blake2s.o ++#libblake2s-$(CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC) += blake2s-generic.o ++ ++#obj-$(CONFIG_CRYPTO_LIB_CHACHA20POLY1305) += libchacha20poly1305.o ++#libchacha20poly1305-y += chacha20poly1305.o ++ ++#obj-$(CONFIG_CRYPTO_LIB_CURVE25519_GENERIC) += libcurve25519-generic.o ++#libcurve25519-generic-y := curve25519-fiat32.o ++#libcurve25519-generic-$(CONFIG_ARCH_SUPPORTS_INT128) := curve25519-hacl64.o ++#libcurve25519-generic-y += curve25519-generic.o ++ ++#obj-$(CONFIG_CRYPTO_LIB_CURVE25519) += libcurve25519.o ++#libcurve25519-y += curve25519.o ++ ++#obj-$(CONFIG_CRYPTO_LIB_DES) += libdes.o ++#libdes-y := des.o ++ ++#obj-$(CONFIG_CRYPTO_LIB_POLY1305_GENERIC) += libpoly1305.o ++#libpoly1305-y := poly1305-donna32.o ++#libpoly1305-$(CONFIG_ARCH_SUPPORTS_INT128) := poly1305-donna64.o ++#libpoly1305-y += poly1305.o + + obj-$(CONFIG_CRYPTO_LIB_SHA256) += libsha256.o + libsha256-y := sha256.o + +-ifneq ($(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS),y) +-libblake2s-y += blake2s-selftest.o +-libchacha20poly1305-y += chacha20poly1305-selftest.o +-libcurve25519-y += curve25519-selftest.o +-endif ++#ifneq ($(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS),y) ++#libblake2s-y += blake2s-selftest.o ++#libchacha20poly1305-y += chacha20poly1305-selftest.o ++#libcurve25519-y += curve25519-selftest.o ++#endif diff --git a/SOURCES/9001-add-driver-version.patch b/SOURCES/9001-add-driver-version.patch new file mode 100644 index 0000000..59cadec --- /dev/null +++ b/SOURCES/9001-add-driver-version.patch @@ -0,0 +1,27 @@ +Index: src/lib/crypto/aes.c +=================================================================== +--- src.orig/lib/crypto/aes.c 2023-05-31 09:41:53.066737337 +0200 ++++ src/lib/crypto/aes.c 2023-06-06 01:51:24.888090454 +0200 +@@ -354,3 +354,4 @@ + MODULE_DESCRIPTION("Generic AES library"); + MODULE_AUTHOR("Ard Biesheuvel "); + MODULE_LICENSE("GPL v2"); ++MODULE_VERSION("5.14.0_284.11.1_dup9.2"); +Index: src/lib/crypto/arc4.c +=================================================================== +--- src.orig/lib/crypto/arc4.c 2023-05-31 09:41:53.067737328 +0200 ++++ src/lib/crypto/arc4.c 2023-06-06 01:50:33.098694214 +0200 +@@ -72,3 +72,4 @@ + EXPORT_SYMBOL(arc4_crypt); + + MODULE_LICENSE("GPL"); ++MODULE_VERSION("5.14.0_284.11.1_dup9.2"); +Index: src/lib/crypto/sha256.c +=================================================================== +--- src.orig/lib/crypto/sha256.c 2023-05-31 09:41:53.075737261 +0200 ++++ src/lib/crypto/sha256.c 2023-06-06 01:51:31.692012588 +0200 +@@ -207,3 +207,4 @@ + EXPORT_SYMBOL(sha256); + + MODULE_LICENSE("GPL"); ++MODULE_VERSION("5.14.0_284.11.1_dup9.2"); diff --git a/SPECS/kmod-redhat-arc4.spec b/SPECS/kmod-redhat-arc4.spec new file mode 100644 index 0000000..94c4fd4 --- /dev/null +++ b/SPECS/kmod-redhat-arc4.spec @@ -0,0 +1,333 @@ +%define kmod_name arc4 +%define kmod_vendor redhat +%define kmod_rpm_name kmod-redhat-arc4 +%define kmod_driver_version 5.14.0_284.11.1_dup9.2 +%define kmod_driver_epoch %{nil} +%define kmod_rpm_release 2 +%define kmod_kernel_version 5.14.0-284.11.1.el9_2 +%define kmod_kernel_version_min 5.14.0-284 +%define kmod_kernel_version_dep 5.14.0-284.el9 +%define kmod_kbuild_dir lib/crypto +%define kmod_dependencies %{nil} +%define kmod_dist_build_deps %{nil} +%define kmod_build_dependencies %{nil} +%define kmod_provides %{nil} +%define kmod_devel_package 1 +%define kmod_devel_src_paths %{nil} +%define kmod_install_path extra/kmod-redhat-arc4 +%define kmod_files_package 0 +%define kmod_files_noarch 1 +%define kernel_pkg kernel +%define kernel_devel_pkg kernel-devel +%define kernel_modules_pkg kernel-modules + +%{!?dist: %define dist .el9_2} +%{!?make_build: %define make_build make} + +%if "%{kmod_kernel_version_dep}" == "" +%define kmod_kernel_version_dep %{kmod_kernel_version} +%endif + +%if "%{kmod_dist_build_deps}" == "" +%if (0%{?rhel} > 8) || (0%{?centos} > 8) +%define abi_list stablelist +%define kmod_dist_build_deps redhat-rpm-config kernel-abi-stablelists elfutils-libelf-devel kernel-rpm-macros kmod +%else +%if (0%{?rhel} > 7) || (0%{?centos} > 7) +%define abi_list whitelist +%define kmod_dist_build_deps redhat-rpm-config kernel-abi-whitelists elfutils-libelf-devel kernel-rpm-macros kmod +%else +%define abi_list whitelist +%define kmod_dist_build_deps redhat-rpm-config kernel-abi-whitelists +%endif +%endif +%endif + +Source0: %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version}.tar.bz2 +# Source code patches +Patch0: 9000-Makefile.patch +Patch1: 9001-add-driver-version.patch + +%define findpat %( echo "%""P" ) +%define __find_requires /usr/lib/rpm/redhat/find-requires.ksyms +%define __find_provides /usr/lib/rpm/redhat/find-provides.ksyms %{kmod_name} %{?epoch:%{epoch}:}%{version}-%{release} +%define sbindir %( if [ -d "/sbin" -a \! -h "/sbin" ]; then echo "/sbin"; else echo %{_sbindir}; fi ) +%define dup_state_dir %{_localstatedir}/lib/rpm-state/kmod-dups +%define kver_state_dir %{dup_state_dir}/kver +%define kver_state_file %{kver_state_dir}/%{kmod_kernel_version}.%(arch) +%define dup_module_list %{dup_state_dir}/rpm-kmod-%{kmod_name}-modules + +Name: kmod-redhat-arc4 +Version: %{kmod_driver_version} +Release: %{kmod_rpm_release}%{?dist} +%if "%{kmod_driver_epoch}" != "" +Epoch: %{kmod_driver_epoch} +%endif +Summary: arc4 kernel module for Driver Update Program +Group: System/Kernel +License: GPLv2 +URL: https://www.kernel.org/ +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) +BuildRequires: %kernel_devel_pkg = %kmod_kernel_version +%if "%{kmod_dist_build_deps}" != "" +BuildRequires: %{kmod_dist_build_deps} +%endif +ExclusiveArch: x86_64 +%global kernel_source() /usr/src/kernels/%{kmod_kernel_version}.$(arch) + +%global _use_internal_dependency_generator 0 +%if "%{?kmod_kernel_version_min}" != "" +Provides: %kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu} +%else +Provides: %kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu} +%endif +Provides: kmod-%{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires(post): %{sbindir}/weak-modules +Requires(postun): %{sbindir}/weak-modules +Requires: kernel >= 5.14.0-284 +%if 0 +Requires: firmware(%{kmod_name}) = ENTER_FIRMWARE_VERSION +%endif +%if "%{kmod_build_dependencies}" != "" +BuildRequires: %{kmod_build_dependencies} +%endif +%if "%{kmod_dependencies}" != "" +Requires: %{kmod_dependencies} +%endif +%if "%{kmod_provides}" != "" +Provides: %{kmod_provides} +%endif +# if there are multiple kmods for the same driver from different vendors, +# they should conflict with each other. +Conflicts: kmod-%{kmod_name} + +%description +arc4 kernel module for Driver Update Program + +%if 0 + +%package -n kmod-redhat-arc4-firmware +Version: ENTER_FIRMWARE_VERSION +Summary: arc4 firmware for Driver Update Program +Provides: firmware(%{kmod_name}) = ENTER_FIRMWARE_VERSION +%if "%{kmod_kernel_version_min}" != "" +Provides: %kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu} +%else +Provides: %kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu} +%endif +%description -n kmod-redhat-arc4-firmware +arc4 firmware for Driver Update Program + + +%files -n kmod-redhat-arc4-firmware +%defattr(644,root,root,755) +%{FIRMWARE_FILES} + +%endif + +# Development package +%if 0%{kmod_devel_package} +%package -n kmod-redhat-arc4-devel +Version: %{kmod_driver_version} +Summary: arc4 development files for Driver Update Program + +%description -n kmod-redhat-arc4-devel +arc4 development files for Driver Update Program + + +%files -n kmod-redhat-arc4-devel +%defattr(644,root,root,755) +/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/ +%endif + +# Extra files package +%if 0%{kmod_files_package} +%package -n kmod-redhat-arc4-files +Version: %{kmod_driver_version} +Summary: arc4 additional files for Driver Update Program +%if 0%{kmod_files_noarch} +BuildArch: noarch +%endif +%if "%{?kmod_kernel_version_min}" != "" +Provides: %kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu} +%else +Provides: %kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu} +%endif + +%description -n kmod-redhat-arc4-files +arc4 additional files for Driver Update Program + + +%files -n kmod-redhat-arc4-files +%defattr(644,root,root,755) + + +%endif + +%post +modules=( $(find /lib/modules/%{kmod_kernel_version}.%(arch)/%{kmod_install_path} | grep '\.ko$') ) +printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --add-modules --no-initramfs + +mkdir -p "%{kver_state_dir}" +touch "%{kver_state_file}" + +exit 0 + +%posttrans +# We have to re-implement part of weak-modules here because it doesn't allow +# calling initramfs regeneration separately +if [ -f "%{kver_state_file}" ]; then + kver_base="%{kmod_kernel_version_dep}" + kvers=$(ls -d "/lib/modules/${kver_base%%.*}"*) + + for k_dir in $kvers; do + k="${k_dir#/lib/modules/}" + + tmp_initramfs="/boot/initramfs-$k.tmp" + dst_initramfs="/boot/initramfs-$k.img" + + # The same check as in weak-modules: we assume that the kernel present + # if the symvers file exists. + if [ -e "/boot/symvers-$k.gz" ] || [ -e "$k_dir/symvers.gz" ]; then + /usr/bin/dracut -f "$tmp_initramfs" "$k" || exit 1 + cmp -s "$tmp_initramfs" "$dst_initramfs" + if [ "$?" = 1 ]; then + mv "$tmp_initramfs" "$dst_initramfs" + else + rm -f "$tmp_initramfs" + fi + fi + done + + rm -f "%{kver_state_file}" + rmdir "%{kver_state_dir}" 2> /dev/null +fi + +rmdir "%{dup_state_dir}" 2> /dev/null + +exit 0 + +%preun +if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then + mkdir -p "%{kver_state_dir}" + touch "%{kver_state_file}" +fi + +mkdir -p "%{dup_state_dir}" +rpm -ql kmod-redhat-arc4-%{kmod_driver_version}-%{kmod_rpm_release}%{?dist}.$(arch) | \ + grep '\.ko$' > "%{dup_module_list}" + +%postun +if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then + initramfs_opt="--no-initramfs" +else + initramfs_opt="" +fi + +modules=( $(cat "%{dup_module_list}") ) +rm -f "%{dup_module_list}" +printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --remove-modules $initramfs_opt + +rmdir "%{dup_state_dir}" 2> /dev/null + +exit 0 + +%files +%defattr(644,root,root,755) +/lib/modules/%{kmod_kernel_version}.%(arch) +/etc/depmod.d/%{kmod_name}.conf +%doc /usr/share/doc/%{kmod_rpm_name}/greylist.txt +%if !0%{kmod_files_package} + + +%endif + +%prep +%setup -n %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version} + +%patch0 -p1 +%patch1 -p1 +set -- * +mkdir source +mv "$@" source/ +mkdir obj + +%build +rm -rf obj +cp -r source obj + +PWD_PATH="$PWD" +%if "%{workaround_no_pwd_rel_path}" != "1" +PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD") +%endif +%{make_build} -C %{kernel_source} V=1 M="$PWD_PATH/obj/%{kmod_kbuild_dir}" \ + NOSTDINC_FLAGS="-I$PWD_PATH/obj/include -I$PWD_PATH/obj/include/uapi %{nil}" \ + EXTRA_CFLAGS="%{nil}" \ + %{nil} +# mark modules executable so that strip-to-file can strip them +find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -exec chmod u+x '{}' + + +kabilist="/lib/modules/kabi-current/kabi_%{abi_list}_%{_target_cpu}" +for modules in $( find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -printf "%{findpat}\n" | sed 's|\.ko$||' | sort -u ) ; do + # update depmod.conf + module_weak_path=$(echo "$modules" | sed 's/[\/]*[^\/]*$//') + if [ -z "$module_weak_path" ]; then + module_weak_path=%{name} + else + module_weak_path=%{name}/$module_weak_path + fi + echo "override $(echo $modules | sed 's/.*\///')" \ + "$(echo "%{kmod_kernel_version_dep}" | + sed 's/\.[^\.]*$//; + s/\([.+?^$\/\\|()\[]\|\]\)/\\\0/g').*" \ + "weak-updates/$module_weak_path" >> source/depmod.conf + + # update greylist + nm -u obj/%{kmod_kbuild_dir}/$modules.ko | sed 's/.*U //' | sed 's/^\.//' | sort -u | while read -r symbol; do + grep -q "^\s*$symbol\$" $kabilist || echo "$symbol" >> source/greylist + done +done +sort -u source/greylist | uniq > source/greylist.txt + +%install +export INSTALL_MOD_PATH=$RPM_BUILD_ROOT +export INSTALL_MOD_DIR=%{kmod_install_path} +PWD_PATH="$PWD" +%if "%{workaround_no_pwd_rel_path}" != "1" +PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD") +%endif +make -C %{kernel_source} modules_install \ + M=$PWD_PATH/obj/%{kmod_kbuild_dir} +# Cleanup unnecessary kernel-generated module dependency files. +find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \; + +install -m 644 -D source/depmod.conf $RPM_BUILD_ROOT/etc/depmod.d/%{kmod_name}.conf +install -m 644 -D source/greylist.txt $RPM_BUILD_ROOT/usr/share/doc/%{kmod_rpm_name}/greylist.txt +%if 0 +%{FIRMWARE_FILES_INSTALL} +%endif +%if 0%{kmod_devel_package} +install -m 644 -D $PWD/obj/%{kmod_kbuild_dir}/Module.symvers $RPM_BUILD_ROOT/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/build/Module.symvers + +if [ -n "%{kmod_devel_src_paths}" ]; then + for i in %{kmod_devel_src_paths}; do + mkdir -p "$RPM_BUILD_ROOT/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/build/$(dirname "$i")" + cp -rv "$PWD/source/$i" \ + "$RPM_BUILD_ROOT/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/build/$i" + done +fi +%endif + + + +%clean +rm -rf $RPM_BUILD_ROOT + +%changelog +* Mon Jul 24 2023 MSVSphere Packaging Team - 5.14.0_284.11.1_dup9.2-2 +- Rebuilt for MSVSphere 9.2 + +* Tue Jun 27 2023 Eugene Syromiatnikov 5.14.0_284.11.1_dup9.2-2 +- c8eb14f582ef9c529860817fbe91ba1a6a270315 +- arc4 kernel module for Driver Update Program +- Resolves: #bz2214527