Blame SPECS/kpatch-patch.spec

354435
# Set to 1 if building an empty subscription-only package.
bde638
%define empty_package		0
354435
354435
#######################################################
354435
# Only need to update these variables and the changelog
354435
%define kernel_ver	3.10.0-1160.31.1.el7
354435
%define kpatch_ver	0.9.2
bde638
%define rpm_ver		1
8045f6
%define rpm_rel		4
354435
354435
%if !%{empty_package}
354435
# Patch sources below. DO NOT REMOVE THIS LINE.
bde638
#
bde638
# https://bugzilla.redhat.com/1962518
bde638
Source100: CVE-2021-33034.patch
bde638
#
bde638
# https://bugzilla.redhat.com/1975256
bde638
Source101: CVE-2021-33909.patch
c2599e
#
c2599e
# https://bugzilla.redhat.com/1971474
c2599e
Source102: CVE-2021-32399.patch
c2599e
#
c2599e
# https://bugzilla.redhat.com/1980516
c2599e
Source103: CVE-2021-22555.patch
2ed711
#
2ed711
# https://bugzilla.redhat.com/1997195
2ed711
Source104: CVE-2021-3715.patch
8045f6
#
8045f6
# https://bugzilla.redhat.com/1975766
8045f6
Source105: CVE-2021-22543.patch
8045f6
#
8045f6
# https://bugzilla.redhat.com/1988221
8045f6
Source106: CVE-2021-37576.patch
354435
# End of patch sources. DO NOT REMOVE THIS LINE.
354435
%endif
354435
354435
%define sanitized_rpm_rel	%{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
354435
%define sanitized_kernel_ver	%{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), ".el7", ""), "%.", "_")))}
354435
%define kernel_ver_arch	%{kernel_ver}.%{_arch}
354435
354435
Name:		kpatch-patch-%{sanitized_kernel_ver}
354435
Version:	%{rpm_ver}
354435
Release:	%{rpm_rel}.el7
354435
354435
%if %{empty_package}
354435
Summary:	Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
354435
%else
354435
Summary:	Live kernel patching module for kernel-%{kernel_ver_arch}
354435
%endif
354435
354435
Group:		System Environment/Kernel
354435
License:	GPLv2
354435
ExclusiveArch:	x86_64 ppc64le
354435
354435
Conflicts:	%{name} < %{version}-%{release}
354435
354435
Provides:	kpatch-patch = %{kernel_ver_arch}
354435
Provides:	kpatch-patch = %{kernel_ver}
354435
354435
%if !%{empty_package}
354435
Requires:	systemd
354435
%endif
354435
Requires:	kpatch >= 0.4.0-3
354435
Requires:	kernel-uname-r = %{kernel_ver_arch}
354435
354435
%if !%{empty_package}
354435
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
354435
BuildRequires:	kernel-devel = %{kernel_ver}
354435
BuildRequires:	kernel-debuginfo = %{kernel_ver}
354435
354435
%ifarch x86_64
354435
BuildRequires: pesign
354435
%endif
354435
354435
%ifarch ppc64le
354435
BuildRequires: gcc-plugin-devel
354435
%endif
354435
354435
Source0:	https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
354435
354435
Source10:	kernel-%{kernel_ver}.src.rpm
354435
354435
# kpatch-build patches
354435
# Patch1: backport.patch
354435
354435
%global _dupsign_opts --keyname=rhelkpatch1
354435
354435
%define builddir	%{_builddir}/kpatch-%{kpatch_ver}
354435
%define kpatch		%{_sbindir}/kpatch
354435
%define kmoddir		%{_usr}/lib/kpatch/%{kernel_ver_arch}
354435
%define patchmodname	kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
354435
%define patchmod	%{patchmodname}.ko
354435
354435
%define _missing_build_ids_terminate_build 1
354435
%define _find_debuginfo_opts -r
354435
%undefine _include_minidebuginfo
354435
%undefine _find_debuginfo_dwz_opts
354435
354435
%description
354435
This is a kernel live patch module which can be loaded by the kpatch
354435
command line utility to modify the code of a running kernel.  This patch
354435
module is targeted for kernel-%{kernel_ver}.
354435
354435
%prep
354435
%autosetup -n kpatch-%{kpatch_ver} -p1
354435
354435
%build
354435
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
354435
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
354435
354435
# kpatch-build
354435
make -C kpatch-build
354435
354435
# patch module
354435
for i in %{sources}; do
354435
	[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
354435
done
354435
export CACHEDIR="%{builddir}/.kpatch"
354435
kpatch-build/kpatch-build -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
354435
354435
354435
%install
354435
installdir=%{buildroot}/%{kmoddir}
354435
install -d $installdir
354435
install -m 755 %{builddir}/%{patchmod} $installdir
354435
354435
354435
%files
354435
%{_usr}/lib/kpatch
354435
354435
354435
%post
354435
if [[ %{kernel_ver_arch} = $(uname -r) ]]; then
354435
	cver="%{rpm_ver}_%{rpm_rel}"
354435
	pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
354435
354435
	lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
354435
354435
	if [ "${lver}" != "${cver}" ]; then
354435
		echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
354435
		echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
354435
	else
354435
		%{kpatch} load %{kmoddir}/%{patchmod}
354435
	fi
354435
fi
354435
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
354435
sync
354435
exit 0
354435
354435
354435
%postun
354435
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
354435
sync
354435
exit 0
354435
354435
%else
354435
%description
354435
This is an empty kpatch-patch package which does not contain any real patches.
354435
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
354435
354435
%files
354435
%doc
354435
%endif
354435
354435
%changelog
8045f6
* Wed Sep 29 2021 Joe Lawrence <joe.lawrence@redhat.com> [1-4.el7]
8045f6
- kernel: powerpc: KVM guest OS users can cause host OS memory corruption [1988221] {CVE-2021-37576}
8045f6
- kernel: Improper handling of VM_IO|VM_PFNMAP vmas in KVM can bypass RO checks [1975766] {CVE-2021-22543}
8045f6
2ed711
* Tue Aug 31 2021 Joe Lawrence <joe.lawrence@redhat.com> [1-3.el7]
2ed711
- kernel: use-after-free in route4_change() in net/sched/cls_route.c [1997195] {CVE-2021-3715}
2ed711
c2599e
* Mon Aug 16 2021 Joe Lawrence <joe.lawrence@redhat.com> [1-2.el7]
c2599e
- kernel: out-of-bounds write in xt_compat_target_from_user() in net/netfilter/x_tables.c [1980516] {CVE-2021-22555}
c2599e
- kpatch: kernel: race condition for removal of the HCI controller [1971474] {CVE-2021-32399}
c2599e
bde638
* Fri Jul 09 2021 Joe Lawrence <joe.lawrence@redhat.com> [1-1.el7]
bde638
- kernel: size_t-to-int conversion vulnerability in the filesystem layer [1975256] {CVE-2021-33909}
bde638
- kernel: use-after-free in net/bluetooth/hci_event.c when destroying an hci_chan [1962518] {CVE-2021-33034}
bde638
354435
* Wed Jun 02 2021 Artem Savkov <asavkov@redhat.com> [0-0.el7]
354435
- An empty patch to subscribe to kpatch stream for kernel-3.10.0-1160.31.1.el7 [1967127]