Blame SPECS/kpatch-patch.spec

0c77a0
# Set to 1 if building an empty subscription-only package.
2ec76e
%define empty_package		0
0c77a0
0c77a0
#######################################################
0c77a0
# Only need to update these variables and the changelog
0c77a0
%define kernel_ver	3.10.0-1160.62.1.el7
0c77a0
%define kpatch_ver	0.9.2
2ec76e
%define rpm_ver		1
bb7f30
%define rpm_rel		3
0c77a0
0c77a0
%if !%{empty_package}
0c77a0
# Patch sources below. DO NOT REMOVE THIS LINE.
2ec76e
#
2ec76e
# https://bugzilla.redhat.com/2052183
2ec76e
Source100: CVE-2022-0492.patch
dbdd24
#
dbdd24
# https://bugzilla.redhat.com/2093010
dbdd24
Source101: CVE-2022-1966.patch
bb7f30
#
bb7f30
# https://bugzilla.redhat.com/2122586
bb7f30
Source102: CVE-2022-2588.patch
0c77a0
# End of patch sources. DO NOT REMOVE THIS LINE.
0c77a0
%endif
0c77a0
0c77a0
%define sanitized_rpm_rel	%{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
0c77a0
%define sanitized_kernel_ver	%{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), ".el7", ""), "%.", "_")))}
0c77a0
%define kernel_ver_arch	%{kernel_ver}.%{_arch}
0c77a0
0c77a0
Name:		kpatch-patch-%{sanitized_kernel_ver}
0c77a0
Version:	%{rpm_ver}
0c77a0
Release:	%{rpm_rel}.el7
0c77a0
0c77a0
%if %{empty_package}
0c77a0
Summary:	Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
0c77a0
%else
0c77a0
Summary:	Live kernel patching module for kernel-%{kernel_ver_arch}
0c77a0
%endif
0c77a0
0c77a0
Group:		System Environment/Kernel
0c77a0
License:	GPLv2
0c77a0
ExclusiveArch:	x86_64 ppc64le
0c77a0
0c77a0
Conflicts:	%{name} < %{version}-%{release}
0c77a0
0c77a0
Provides:	kpatch-patch = %{kernel_ver_arch}
0c77a0
Provides:	kpatch-patch = %{kernel_ver}
0c77a0
0c77a0
%if !%{empty_package}
0c77a0
Requires:	systemd
0c77a0
%endif
0c77a0
Requires:	kpatch >= 0.4.0-3
0c77a0
Requires:	kernel-uname-r = %{kernel_ver_arch}
0c77a0
0c77a0
%if !%{empty_package}
0c77a0
BuildRequires:	gcc elfutils-devel rpmdevtools asciidoc bc hmaccalc m4 net-tools xmlto zlib-devel binutils-devel newt-devel python-devel perl(ExtUtils::Embed) bison audit-libs-devel numactl-devel pciutils-devel openssl gettext kernel-devel ncurses-devel hostname java-devel python-docutils
0c77a0
BuildRequires:	kernel-devel = %{kernel_ver}
0c77a0
BuildRequires:	kernel-debuginfo = %{kernel_ver}
0c77a0
0c77a0
%ifarch x86_64
0c77a0
BuildRequires: pesign
0c77a0
%endif
0c77a0
0c77a0
%ifarch ppc64le
0c77a0
BuildRequires: gcc-plugin-devel
0c77a0
%endif
0c77a0
0c77a0
Source0:	https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
0c77a0
0c77a0
Source10:	kernel-%{kernel_ver}.src.rpm
0c77a0
0c77a0
# kpatch-build patches
0c77a0
# Patch1: backport.patch
0c77a0
0c77a0
%global _dupsign_opts --keyname=rhelkpatch1
0c77a0
0c77a0
%define builddir	%{_builddir}/kpatch-%{kpatch_ver}
0c77a0
%define kpatch		%{_sbindir}/kpatch
0c77a0
%define kmoddir		%{_usr}/lib/kpatch/%{kernel_ver_arch}
0c77a0
%define patchmodname	kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
0c77a0
%define patchmod	%{patchmodname}.ko
0c77a0
0c77a0
%define _missing_build_ids_terminate_build 1
0c77a0
%define _find_debuginfo_opts -r
0c77a0
%undefine _include_minidebuginfo
0c77a0
%undefine _find_debuginfo_dwz_opts
0c77a0
0c77a0
%description
0c77a0
This is a kernel live patch module which can be loaded by the kpatch
0c77a0
command line utility to modify the code of a running kernel.  This patch
0c77a0
module is targeted for kernel-%{kernel_ver}.
0c77a0
0c77a0
%prep
0c77a0
%autosetup -n kpatch-%{kpatch_ver} -p1
0c77a0
0c77a0
%build
0c77a0
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
0c77a0
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
0c77a0
0c77a0
# kpatch-build
0c77a0
make -C kpatch-build
0c77a0
0c77a0
# patch module
0c77a0
for i in %{sources}; do
0c77a0
	[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
0c77a0
done
0c77a0
export CACHEDIR="%{builddir}/.kpatch"
0c77a0
kpatch-build/kpatch-build -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
0c77a0
0c77a0
0c77a0
%install
0c77a0
installdir=%{buildroot}/%{kmoddir}
0c77a0
install -d $installdir
0c77a0
install -m 755 %{builddir}/%{patchmod} $installdir
0c77a0
0c77a0
0c77a0
%files
0c77a0
%{_usr}/lib/kpatch
0c77a0
0c77a0
0c77a0
%post
0c77a0
if [[ %{kernel_ver_arch} = $(uname -r) ]]; then
0c77a0
	cver="%{rpm_ver}_%{rpm_rel}"
0c77a0
	pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
0c77a0
0c77a0
	lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
0c77a0
0c77a0
	if [ "${lver}" != "${cver}" ]; then
0c77a0
		echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
0c77a0
		echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
0c77a0
	else
0c77a0
		%{kpatch} load %{kmoddir}/%{patchmod}
0c77a0
	fi
0c77a0
fi
0c77a0
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
0c77a0
sync
0c77a0
exit 0
0c77a0
0c77a0
0c77a0
%postun
0c77a0
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
0c77a0
sync
0c77a0
exit 0
0c77a0
0c77a0
%else
0c77a0
%description
0c77a0
This is an empty kpatch-patch package which does not contain any real patches.
0c77a0
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
0c77a0
0c77a0
%files
0c77a0
%doc
0c77a0
%endif
0c77a0
0c77a0
%changelog
bb7f30
* Thu Oct 13 2022 Yannick Cote <ycote@redhat.com> [1-3.el7]
bb7f30
- kernel: a use-after-free in cls_route filter implementation may lead to privilege escalation [2122586] {CVE-2022-2588}
bb7f30
dbdd24
* Fri Jun 17 2022 Yannick Cote <ycote@redhat.com> [1-2.el7]
dbdd24
- kernel: a use-after-free write in the netfilter subsystem can lead to privilege escalation to root [2093010] {CVE-2022-1966}
dbdd24
2ec76e
* Thu May 12 2022 Joe Lawrence <joe.lawrence@redhat.com> [1-1.el7]
2ec76e
- kernel: cgroups v1 release_agent feature may allow privilege escalation [2052183] {CVE-2022-0492}
2ec76e
0c77a0
* Thu Mar 24 2022 Joe Lawrence <joe.lawrence@redhat.com> [0-0.el7]
0c77a0
- An empty patch to subscribe to kpatch stream for kernel-3.10.0-1160.62.1.el7 [2068101]