Blame SPECS/kpatch-patch.spec

816573
# Set to 1 if building an empty subscription-only package.
040390
%define empty_package		0
816573
816573
#######################################################
816573
# Only need to update these variables and the changelog
816573
%define kernel_ver	4.18.0-305.7.1.el8_4
816573
%define kpatch_ver	0.9.3
040390
%define rpm_ver		1
fb3ac1
%define rpm_rel		4
816573
816573
%if !%{empty_package}
816573
# Patch sources below. DO NOT REMOVE THIS LINE.
040390
#
040390
# https://bugzilla.redhat.com/1971478
040390
Source100: CVE-2021-32399.patch
040390
#
040390
# https://bugzilla.redhat.com/1975190
040390
Source101: CVE-2021-33909.patch
5a744b
#
5a744b
# https://bugzilla.redhat.com/1975762
5a744b
Source102: CVE-2021-22543.patch
5a744b
#
5a744b
# https://bugzilla.redhat.com/1980520
5a744b
Source103: CVE-2021-22555.patch
5a744b
#
5a744b
# https://bugzilla.redhat.com/1975066
5a744b
Source104: CVE-2021-3609.patch
e6c5ce
#
e6c5ce
# https://bugzilla.redhat.com/1988230
e6c5ce
Source105: CVE-2021-37576.patch
fb3ac1
#
fb3ac1
# https://bugzilla.redhat.com/1981706
fb3ac1
Source106: CVE-2020-36385.patch
fb3ac1
#
fb3ac1
# https://bugzilla.redhat.com/1979028
fb3ac1
Source107: CVE-2021-0512.patch
816573
# End of patch sources. DO NOT REMOVE THIS LINE.
816573
%endif
816573
816573
%define sanitized_rpm_rel	%{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
816573
%define sanitized_kernel_ver   %{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), '.el8_?\%d?', ""), "%.", "_")))}
816573
%define kernel_ver_arch        %{kernel_ver}.%{_arch}
816573
816573
Name:		kpatch-patch-%{sanitized_kernel_ver}
816573
Version:	%{rpm_ver}
816573
Release:	%{rpm_rel}%{?dist}
816573
816573
%if %{empty_package}
816573
Summary:	Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
816573
%else
816573
Summary:	Live kernel patching module for kernel-%{kernel_ver_arch}
816573
%endif
816573
816573
Group:		System Environment/Kernel
816573
License:	GPLv2
fb3ac1
ExclusiveArch:	x86_64 ppc64le
816573
816573
Conflicts:	%{name} < %{version}-%{release}
816573
816573
Provides:	kpatch-patch = %{kernel_ver_arch}
816573
Provides:	kpatch-patch = %{kernel_ver}
816573
816573
%if !%{empty_package}
816573
Requires:	systemd
816573
%endif
816573
Requires:	kpatch >= 0.6.1-1
816573
Requires:	kernel-uname-r = %{kernel_ver_arch}
816573
816573
%if !%{empty_package}
816573
BuildRequires:	patchutils
816573
BuildRequires:	kernel-devel = %{kernel_ver}
816573
BuildRequires:	kernel-debuginfo = %{kernel_ver}
816573
816573
# kernel build requirements, generated from:
816573
#   % rpmspec -q --buildrequires kernel.spec | sort | awk '{print "BuildRequires:\t" $0}'
816573
# with arch-specific packages moved into conditional block
816573
BuildRequires:	asciidoc audit-libs-devel bash bc binutils binutils-devel bison bzip2 diffutils elfutils elfutils-devel findutils flex gawk gcc gettext git gzip hmaccalc hostname kmod m4 make ncurses-devel net-tools newt-devel numactl-devel openssl openssl-devel patch pciutils-devel perl-Carp perl-devel perl(ExtUtils::Embed) perl-generators perl-interpreter python3-devel python3-docutils redhat-rpm-config rpm-build sh-utils tar xmlto xz xz-devel zlib-devel java-devel kabi-dw
816573
816573
%ifarch x86_64
816573
BuildRequires:	pesign >= 0.10-4
816573
%endif
816573
816573
%ifarch ppc64le
816573
BuildRequires:	gcc-plugin-devel
816573
%endif
816573
816573
Source0:	https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
816573
816573
Source10:	kernel-%{kernel_ver}.src.rpm
816573
816573
# kpatch-build patches
816573
816573
%global _dupsign_opts --keyname=rhelkpatch1
816573
816573
%define builddir	%{_builddir}/kpatch-%{kpatch_ver}
816573
%define kpatch		%{_sbindir}/kpatch
816573
%define kmoddir 	%{_usr}/lib/kpatch/%{kernel_ver_arch}
816573
%define kinstdir	%{_sharedstatedir}/kpatch/%{kernel_ver_arch}
816573
%define patchmodname	kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
816573
%define patchmod	%{patchmodname}.ko
816573
816573
%define _missing_build_ids_terminate_build 1
816573
%define _find_debuginfo_opts -r
816573
%undefine _include_minidebuginfo
816573
%undefine _find_debuginfo_dwz_opts
816573
816573
%description
816573
This is a kernel live patch module which can be loaded by the kpatch
816573
command line utility to modify the code of a running kernel.  This patch
816573
module is targeted for kernel-%{kernel_ver}.
816573
816573
%prep
816573
%autosetup -n kpatch-%{kpatch_ver} -p1
816573
816573
%build
816573
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
816573
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
816573
816573
# kpatch-build
816573
make -C kpatch-build
816573
816573
# patch module
816573
for i in %{sources}; do
816573
	[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
816573
done
816573
export CACHEDIR="%{builddir}/.kpatch"
816573
kpatch-build/kpatch-build -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
816573
816573
816573
%install
816573
installdir=%{buildroot}/%{kmoddir}
816573
install -d $installdir
816573
install -m 755 %{builddir}/%{patchmod} $installdir
816573
816573
816573
%files
816573
%{_usr}/lib/kpatch
816573
816573
816573
%post
816573
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
816573
chcon -t modules_object_t %{kinstdir}/%{patchmod}
816573
sync
816573
if [[ %{kernel_ver_arch} = $(uname -r) ]]; then
816573
	cver="%{rpm_ver}_%{rpm_rel}"
816573
	pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
816573
816573
	lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
816573
816573
	if [ "${lver}" != "${cver}" ]; then
816573
		echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
816573
		echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
816573
	else
816573
		%{kpatch} load %{patchmod}
816573
	fi
816573
fi
816573
exit 0
816573
816573
816573
%postun
816573
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
816573
sync
816573
exit 0
816573
816573
%else
816573
%description
816573
This is an empty kpatch-patch package which does not contain any real patches.
816573
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
816573
816573
%files
816573
%doc
816573
%endif
816573
816573
%changelog
fb3ac1
* Wed Oct 27 2021 Artem Savkov <asavkov@redhat.com> [1-4.el8_4]
fb3ac1
- out-of-bounds write due to a heap buffer overflow in __hidinput_change_resolution_multipliers() [1979028] {CVE-2021-0512}
fb3ac1
- use-after-free in drivers/infiniband/core/ucma.c ctx use-after-free [1981706] {CVE-2020-36385}
fb3ac1
e6c5ce
* Wed Sep 01 2021 Artem Savkov <asavkov@redhat.com> [1-3.el8_4]
e6c5ce
- powerpc: KVM guest OS users can cause host OS memory corruption [1988230] {CVE-2021-37576}
e6c5ce
5a744b
* Tue Jul 27 2021 Artem Savkov <asavkov@redhat.com> [1-2.el8_4]
5a744b
- race condition in net/can/bcm.c leads to local privilege escalation [1975066] {CVE-2021-3609}
5a744b
- out-of-bounds write in xt_compat_target_from_user() in net/netfilter/x_tables.c [1980520] {CVE-2021-22555}
5a744b
- Improper handling of VM_IO|VM_PFNMAP vmas in KVM can bypass RO checks [1975762] {CVE-2021-22543}
5a744b
040390
* Mon Jul 12 2021 Artem Savkov <asavkov@redhat.com> [1-1.el8_4]
040390
- kernel: size_t-to-int conversion vulnerability in the filesystem layer [1975190] {CVE-2021-33909}
040390
- kernel: race condition for removal of the HCI controller [1971478] {CVE-2021-32399}
040390
816573
* Wed Jun 16 2021 Yannick Cote <ycote@redhat.com> [0-0.el8_4]
816573
- An empty patch to subscribe to kpatch stream for kernel-4.18.0-305.7.1.el8_4 [1972823]