|
|
c2d3bd |
# Set to 1 if building an empty subscription-only package.
|
|
|
497ac3 |
%define empty_package 0
|
|
|
c2d3bd |
|
|
|
c2d3bd |
#######################################################
|
|
|
c2d3bd |
# Only need to update these variables and the changelog
|
|
|
c2d3bd |
%define kernel_ver 5.14.0-162.18.1.el9_1
|
|
|
c2d3bd |
%define kpatch_ver 0.9.7
|
|
|
497ac3 |
%define rpm_ver 1
|
|
|
7edbd0 |
%define rpm_rel 2
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%if !%{empty_package}
|
|
|
c2d3bd |
# Patch sources below. DO NOT REMOVE THIS LINE.
|
|
|
497ac3 |
#
|
|
|
497ac3 |
# https://bugzilla.redhat.com/2156383
|
|
|
497ac3 |
Source100: CVE-2022-4744.patch
|
|
|
497ac3 |
#
|
|
|
497ac3 |
# https://bugzilla.redhat.com/2163415
|
|
|
497ac3 |
Source101: CVE-2023-0266.patch
|
|
|
7edbd0 |
#
|
|
|
7edbd0 |
# https://bugzilla.redhat.com/2165362
|
|
|
7edbd0 |
Source102: CVE-2023-0386.patch
|
|
|
c2d3bd |
# End of patch sources. DO NOT REMOVE THIS LINE.
|
|
|
c2d3bd |
%endif
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%define sanitized_rpm_rel %{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
|
|
|
c2d3bd |
%define sanitized_kernel_ver %{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), '.el9_?\%d?', ""), "%.", "_")))}
|
|
|
c2d3bd |
%define kernel_ver_arch %{kernel_ver}.%{_arch}
|
|
|
c2d3bd |
|
|
|
c2d3bd |
Name: kpatch-patch-%{sanitized_kernel_ver}
|
|
|
c2d3bd |
Version: %{rpm_ver}
|
|
|
c2d3bd |
Release: %{rpm_rel}%{?dist}
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%if %{empty_package}
|
|
|
c2d3bd |
Summary: Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
|
|
|
c2d3bd |
%else
|
|
|
c2d3bd |
Summary: Live kernel patching module for kernel-%{kernel_ver_arch}
|
|
|
c2d3bd |
%endif
|
|
|
c2d3bd |
|
|
|
c2d3bd |
Group: System Environment/Kernel
|
|
|
c2d3bd |
License: GPLv2
|
|
|
c2d3bd |
ExclusiveArch: x86_64 ppc64le
|
|
|
c2d3bd |
|
|
|
c2d3bd |
Conflicts: %{name} < %{version}-%{release}
|
|
|
c2d3bd |
|
|
|
c2d3bd |
Provides: kpatch-patch = %{kernel_ver_arch}
|
|
|
c2d3bd |
Provides: kpatch-patch = %{kernel_ver}
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%if !%{empty_package}
|
|
|
c2d3bd |
Requires: systemd
|
|
|
c2d3bd |
%endif
|
|
|
c2d3bd |
Requires: kpatch >= 0.6.1-1
|
|
|
c2d3bd |
Requires: kernel-uname-r = %{kernel_ver_arch}
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%if !%{empty_package}
|
|
|
c2d3bd |
BuildRequires: patchutils
|
|
|
c2d3bd |
BuildRequires: kernel-devel = %{kernel_ver}
|
|
|
c2d3bd |
BuildRequires: kernel-debuginfo = %{kernel_ver}
|
|
|
c2d3bd |
|
|
|
c2d3bd |
# kernel build requirements, generated from:
|
|
|
c2d3bd |
# % rpmspec -q --buildrequires kernel.spec | sort | awk '{print "BuildRequires:\t" $0}'
|
|
|
c2d3bd |
# with arch-specific packages moved into conditional block
|
|
|
c2d3bd |
BuildRequires: bash
|
|
|
c2d3bd |
BuildRequires: bc
|
|
|
c2d3bd |
BuildRequires: binutils
|
|
|
c2d3bd |
BuildRequires: bison
|
|
|
c2d3bd |
BuildRequires: bpftool
|
|
|
c2d3bd |
BuildRequires: bzip2
|
|
|
c2d3bd |
BuildRequires: coreutils
|
|
|
c2d3bd |
BuildRequires: diffutils
|
|
|
c2d3bd |
BuildRequires: dwarves
|
|
|
c2d3bd |
BuildRequires: elfutils
|
|
|
c2d3bd |
BuildRequires: elfutils-devel
|
|
|
c2d3bd |
BuildRequires: findutils
|
|
|
c2d3bd |
BuildRequires: flex
|
|
|
c2d3bd |
BuildRequires: gawk
|
|
|
c2d3bd |
BuildRequires: gcc
|
|
|
c2d3bd |
BuildRequires: gcc-c++
|
|
|
c2d3bd |
BuildRequires: gcc-plugin-devel
|
|
|
c2d3bd |
BuildRequires: git-core
|
|
|
c2d3bd |
BuildRequires: glibc-static
|
|
|
c2d3bd |
BuildRequires: gzip
|
|
|
c2d3bd |
BuildRequires: hmaccalc
|
|
|
c2d3bd |
BuildRequires: hostname
|
|
|
c2d3bd |
BuildRequires: kernel-rpm-macros >= 185-9
|
|
|
c2d3bd |
BuildRequires: kmod
|
|
|
c2d3bd |
BuildRequires: m4
|
|
|
c2d3bd |
BuildRequires: make
|
|
|
c2d3bd |
BuildRequires: net-tools
|
|
|
c2d3bd |
BuildRequires: nss-tools
|
|
|
c2d3bd |
BuildRequires: openssl
|
|
|
c2d3bd |
BuildRequires: openssl-devel
|
|
|
c2d3bd |
BuildRequires: patch
|
|
|
c2d3bd |
BuildRequires: perl-Carp
|
|
|
c2d3bd |
BuildRequires: perl-devel
|
|
|
c2d3bd |
BuildRequires: perl-generators
|
|
|
c2d3bd |
BuildRequires: perl-interpreter
|
|
|
c2d3bd |
BuildRequires: python3-devel
|
|
|
c2d3bd |
BuildRequires: redhat-rpm-config
|
|
|
c2d3bd |
BuildRequires: rpm-build
|
|
|
c2d3bd |
BuildRequires: system-sb-certs
|
|
|
c2d3bd |
BuildRequires: tar
|
|
|
c2d3bd |
BuildRequires: which
|
|
|
c2d3bd |
BuildRequires: xz
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%ifarch x86_64
|
|
|
c2d3bd |
BuildRequires: pesign >= 0.10-4
|
|
|
c2d3bd |
%endif
|
|
|
c2d3bd |
|
|
|
c2d3bd |
Source0: https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
|
|
|
c2d3bd |
|
|
|
c2d3bd |
Source10: kernel-%{kernel_ver}.src.rpm
|
|
|
c2d3bd |
|
|
|
c2d3bd |
# kpatch-build patches
|
|
|
c2d3bd |
Patch1: v0.9.7-backport-MR-1314-create-diff-object-fix-__UNI.patch
|
|
|
c2d3bd |
Patch2: v0.9.7-backport-MR-1315-Static-call-fixes.patch
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%global _dupsign_opts --keyname=rhelkpatch1
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%define builddir %{_builddir}/kpatch-%{kpatch_ver}
|
|
|
c2d3bd |
%define kpatch %{_sbindir}/kpatch
|
|
|
c2d3bd |
%define kmoddir %{_usr}/lib/kpatch/%{kernel_ver_arch}
|
|
|
c2d3bd |
%define kinstdir %{_sharedstatedir}/kpatch/%{kernel_ver_arch}
|
|
|
c2d3bd |
%define patchmodname kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
|
|
|
c2d3bd |
%define patchmod %{patchmodname}.ko
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%define _missing_build_ids_terminate_build 1
|
|
|
c2d3bd |
%define _find_debuginfo_opts -r
|
|
|
c2d3bd |
%undefine _include_minidebuginfo
|
|
|
c2d3bd |
%undefine _find_debuginfo_dwz_opts
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%description
|
|
|
c2d3bd |
This is a kernel live patch module which can be loaded by the kpatch
|
|
|
c2d3bd |
command line utility to modify the code of a running kernel. This patch
|
|
|
c2d3bd |
module is targeted for kernel-%{kernel_ver}.
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%prep
|
|
|
c2d3bd |
%autosetup -n kpatch-%{kpatch_ver} -p1
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%build
|
|
|
c2d3bd |
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
|
|
|
c2d3bd |
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
|
|
|
c2d3bd |
|
|
|
c2d3bd |
# kpatch-build
|
|
|
c2d3bd |
make -C kpatch-build
|
|
|
c2d3bd |
|
|
|
c2d3bd |
# patch module
|
|
|
c2d3bd |
for i in %{sources}; do
|
|
|
c2d3bd |
[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
|
|
|
c2d3bd |
done
|
|
|
c2d3bd |
export CACHEDIR="%{builddir}/.kpatch"
|
|
|
c2d3bd |
kpatch-build/kpatch-build -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
|
|
|
c2d3bd |
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%install
|
|
|
c2d3bd |
installdir=%{buildroot}/%{kmoddir}
|
|
|
c2d3bd |
install -d $installdir
|
|
|
c2d3bd |
install -m 755 %{builddir}/%{patchmod} $installdir
|
|
|
c2d3bd |
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%files
|
|
|
c2d3bd |
%{_usr}/lib/kpatch
|
|
|
c2d3bd |
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%post
|
|
|
c2d3bd |
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
|
|
|
c2d3bd |
chcon -t modules_object_t %{kinstdir}/%{patchmod}
|
|
|
c2d3bd |
sync
|
|
|
c2d3bd |
if [[ %{kernel_ver_arch} = $(uname -r) && "${LEAPP_IPU_IN_PROGRESS}" != "8to9" ]]; then
|
|
|
c2d3bd |
cver="%{rpm_ver}_%{rpm_rel}"
|
|
|
c2d3bd |
pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
|
|
|
c2d3bd |
|
|
|
c2d3bd |
lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
|
|
|
c2d3bd |
|
|
|
c2d3bd |
if [ "${lver}" != "${cver}" ]; then
|
|
|
c2d3bd |
echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
|
|
|
c2d3bd |
echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
|
|
|
c2d3bd |
else
|
|
|
c2d3bd |
%{kpatch} load %{patchmod}
|
|
|
c2d3bd |
fi
|
|
|
c2d3bd |
fi
|
|
|
c2d3bd |
exit 0
|
|
|
c2d3bd |
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%postun
|
|
|
c2d3bd |
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
|
|
|
c2d3bd |
sync
|
|
|
c2d3bd |
exit 0
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%else
|
|
|
c2d3bd |
%description
|
|
|
c2d3bd |
This is an empty kpatch-patch package which does not contain any real patches.
|
|
|
c2d3bd |
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%files
|
|
|
c2d3bd |
%doc
|
|
|
c2d3bd |
%endif
|
|
|
c2d3bd |
|
|
|
c2d3bd |
%changelog
|
|
|
7edbd0 |
* Mon Mar 27 2023 Yannick Cote <ycote@redhat.com> [1-2.el9_1]
|
|
|
7edbd0 |
- kernel: FUSE filesystem low-privileged user privileges escalation [2165362] {CVE-2023-0386}
|
|
|
7edbd0 |
|
|
|
497ac3 |
* Sat Mar 18 2023 Yannick Cote <ycote@redhat.com> [1-1.el9_1]
|
|
|
497ac3 |
- ALSA: pcm: Move rwsem lock inside snd_ctl_elem_read to prevent UAF [2163415] {CVE-2023-0266}
|
|
|
497ac3 |
- EMBARGOED CVE-2022-4744 kernel: tun: avoid double free in tun_free_netdev [2156383] {CVE-2022-4744}
|
|
|
497ac3 |
|
|
|
c2d3bd |
* Thu Feb 09 2023 Linqing Lu <lilu@redhat.com> [0-0.el9]
|
|
|
c2d3bd |
- An empty patch to subscribe to kpatch stream for kernel-5.14.0-162.18.1.el9_1 [2168756]
|