Blame SPECS/kpatch-patch.spec

261917
# Set to 1 if building an empty subscription-only package.
7772de
%define empty_package		0
261917
261917
#######################################################
261917
# Only need to update these variables and the changelog
261917
%define kernel_ver	5.14.0-70.22.1.el9_0
261917
%define kpatch_ver	0.9.6
7772de
%define rpm_ver		1
1128b3
%define rpm_rel		3
261917
261917
%if !%{empty_package}
261917
# Patch sources below. DO NOT REMOVE THIS LINE.
7772de
#
7772de
# https://bugzilla.redhat.com/2106306
7772de
Source100: CVE-2022-34918.patch
1128b3
#
1128b3
# https://bugzilla.redhat.com/2118959
1128b3
Source101: CVE-2022-2585.patch
261917
# End of patch sources. DO NOT REMOVE THIS LINE.
261917
%endif
261917
261917
%define sanitized_rpm_rel	%{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
261917
%define sanitized_kernel_ver   %{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), '.el9_?\%d?', ""), "%.", "_")))}
261917
%define kernel_ver_arch        %{kernel_ver}.%{_arch}
261917
261917
Name:		kpatch-patch-%{sanitized_kernel_ver}
261917
Version:	%{rpm_ver}
261917
Release:	%{rpm_rel}%{?dist}
261917
261917
%if %{empty_package}
261917
Summary:	Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
261917
%else
261917
Summary:	Live kernel patching module for kernel-%{kernel_ver_arch}
261917
%endif
261917
261917
Group:		System Environment/Kernel
261917
License:	GPLv2
261917
ExclusiveArch:	x86_64 ppc64le
261917
261917
Conflicts:	%{name} < %{version}-%{release}
261917
261917
Provides:	kpatch-patch = %{kernel_ver_arch}
261917
Provides:	kpatch-patch = %{kernel_ver}
261917
261917
%if !%{empty_package}
261917
Requires:	systemd
261917
%endif
261917
Requires:	kpatch >= 0.6.1-1
261917
Requires:	kernel-uname-r = %{kernel_ver_arch}
261917
261917
%if !%{empty_package}
261917
BuildRequires:	patchutils
261917
BuildRequires:	kernel-devel = %{kernel_ver}
261917
BuildRequires:	kernel-debuginfo = %{kernel_ver}
261917
261917
# kernel build requirements, generated from:
261917
#   % rpmspec -q --buildrequires kernel.spec | sort | awk '{print "BuildRequires:\t" $0}'
261917
# with arch-specific packages moved into conditional block
261917
BuildRequires:	bash
261917
BuildRequires:	bc
261917
BuildRequires:	binutils
261917
BuildRequires:	bison
261917
BuildRequires:	bpftool
261917
BuildRequires:	bzip2
261917
BuildRequires:	coreutils
261917
BuildRequires:	diffutils
261917
BuildRequires:	dwarves
261917
BuildRequires:	elfutils
261917
BuildRequires:	elfutils-devel
261917
BuildRequires:	findutils
261917
BuildRequires:	flex
261917
BuildRequires:	gawk
261917
BuildRequires:	gcc
261917
BuildRequires:	gcc-c++
261917
BuildRequires:	gcc-plugin-devel
261917
BuildRequires:	git-core
261917
BuildRequires:	glibc-static
261917
BuildRequires:	gzip
261917
BuildRequires:	hmaccalc
261917
BuildRequires:	hostname
261917
BuildRequires:	kernel-rpm-macros >= 185-9
261917
BuildRequires:	kmod
261917
BuildRequires:	m4
261917
BuildRequires:	make
261917
BuildRequires:	net-tools
261917
BuildRequires:	nss-tools
261917
BuildRequires:	openssl
261917
BuildRequires:	openssl-devel
261917
BuildRequires:	patch
261917
BuildRequires:	perl-Carp
261917
BuildRequires:	perl-devel
261917
BuildRequires:	perl-generators
261917
BuildRequires:	perl-interpreter
261917
BuildRequires:	python3-devel
261917
BuildRequires:	redhat-rpm-config
261917
BuildRequires:	rpm-build
261917
BuildRequires:	system-sb-certs
261917
BuildRequires:	tar
261917
BuildRequires:	which
261917
BuildRequires:	xz
261917
261917
%ifarch x86_64
261917
BuildRequires:	pesign >= 0.10-4
261917
%endif
261917
261917
Source0:	https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
261917
261917
Source10:	kernel-%{kernel_ver}.src.rpm
261917
261917
# kpatch-build patches
261917
261917
%global _dupsign_opts --keyname=rhelkpatch1
261917
261917
%define builddir	%{_builddir}/kpatch-%{kpatch_ver}
261917
%define kpatch		%{_sbindir}/kpatch
261917
%define kmoddir 	%{_usr}/lib/kpatch/%{kernel_ver_arch}
261917
%define kinstdir	%{_sharedstatedir}/kpatch/%{kernel_ver_arch}
261917
%define patchmodname	kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
261917
%define patchmod	%{patchmodname}.ko
261917
261917
%define _missing_build_ids_terminate_build 1
261917
%define _find_debuginfo_opts -r
261917
%undefine _include_minidebuginfo
261917
%undefine _find_debuginfo_dwz_opts
261917
261917
%description
261917
This is a kernel live patch module which can be loaded by the kpatch
261917
command line utility to modify the code of a running kernel.  This patch
261917
module is targeted for kernel-%{kernel_ver}.
261917
261917
%prep
261917
%autosetup -n kpatch-%{kpatch_ver} -p1
261917
261917
%build
261917
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
261917
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
261917
261917
# kpatch-build
261917
make -C kpatch-build
261917
261917
# patch module
261917
for i in %{sources}; do
261917
	[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
261917
done
261917
export CACHEDIR="%{builddir}/.kpatch"
261917
kpatch-build/kpatch-build -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
261917
261917
261917
%install
261917
installdir=%{buildroot}/%{kmoddir}
261917
install -d $installdir
261917
install -m 755 %{builddir}/%{patchmod} $installdir
261917
261917
261917
%files
261917
%{_usr}/lib/kpatch
261917
261917
261917
%post
261917
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
261917
chcon -t modules_object_t %{kinstdir}/%{patchmod}
261917
sync
261917
if [[ %{kernel_ver_arch} = $(uname -r) && "${LEAPP_IPU_IN_PROGRESS}" != "8to9" ]]; then
261917
	cver="%{rpm_ver}_%{rpm_rel}"
261917
	pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
261917
261917
	lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
261917
261917
	if [ "${lver}" != "${cver}" ]; then
261917
		echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
261917
		echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
261917
	else
261917
		%{kpatch} load %{patchmod}
261917
	fi
261917
fi
261917
exit 0
261917
261917
261917
%postun
261917
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
261917
sync
261917
exit 0
261917
261917
%else
261917
%description
261917
This is an empty kpatch-patch package which does not contain any real patches.
261917
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
261917
261917
%files
261917
%doc
261917
%endif
261917
261917
%changelog
1128b3
* Mon Oct 17 2022 Yannick Cote <ycote@redhat.com> [1-3.el9_0]
1128b3
- kernel: posix cpu timer use-after-free may lead to local privilege escalation [2118959] {CVE-2022-2585}
1128b3
7772de
* Wed Sep 07 2022 Yannick Cote <ycote@redhat.com> [1-1.el9_0]
7772de
- kernel: heap overflow in nft_set_elem_init() [2106306] {CVE-2022-34918}
7772de
261917
* Thu Aug 04 2022 Linqing Lu <lilu@redhat.com> [0-0.el9]
261917
- An empty patch to subscribe to kpatch stream for kernel-5.14.0-70.22.1.el9_0 [2115516]