Blame SPECS/kpatch-patch.spec

b12bf3
# Set to 1 if building an empty subscription-only package.
805d32
%define empty_package		0
b12bf3
b12bf3
#######################################################
b12bf3
# Only need to update these variables and the changelog
b12bf3
%define kernel_ver	4.18.0-305.el8
b12bf3
%define kpatch_ver	0.9.3
805d32
%define rpm_ver		1
d46c83
%define rpm_rel		4
b12bf3
b12bf3
%if !%{empty_package}
b12bf3
# Patch sources below. DO NOT REMOVE THIS LINE.
805d32
#
805d32
# https://bugzilla.redhat.com/1954230
805d32
Source100: KVM-VMX-Don-t-use-vcpu-run-internal.ndata-as-an-arra.patch
fe08b2
#
fe08b2
# https://bugzilla.redhat.com/1962521
fe08b2
Source101: CVE-2021-33034.patch
e91b83
#
e91b83
# https://bugzilla.redhat.com/1971478
e91b83
Source102: CVE-2021-32399.patch
e91b83
#
e91b83
# https://bugzilla.redhat.com/1975190
e91b83
Source103: CVE-2021-33909.patch
d46c83
#
d46c83
# https://bugzilla.redhat.com/1975762
d46c83
Source104: CVE-2021-22543.patch
d46c83
#
d46c83
# https://bugzilla.redhat.com/1980520
d46c83
Source105: CVE-2021-22555.patch
d46c83
#
d46c83
# https://bugzilla.redhat.com/1975066
d46c83
Source106: CVE-2021-3609.patch
b12bf3
# End of patch sources. DO NOT REMOVE THIS LINE.
b12bf3
%endif
b12bf3
b12bf3
%define sanitized_rpm_rel	%{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
b12bf3
%define sanitized_kernel_ver   %{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), '.el8_?\%d?', ""), "%.", "_")))}
b12bf3
%define kernel_ver_arch        %{kernel_ver}.%{_arch}
b12bf3
b12bf3
Name:		kpatch-patch-%{sanitized_kernel_ver}
b12bf3
Version:	%{rpm_ver}
b12bf3
Release:	%{rpm_rel}%{?dist}
b12bf3
b12bf3
%if %{empty_package}
b12bf3
Summary:	Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
b12bf3
%else
b12bf3
Summary:	Live kernel patching module for kernel-%{kernel_ver_arch}
b12bf3
%endif
b12bf3
b12bf3
Group:		System Environment/Kernel
b12bf3
License:	GPLv2
fe08b2
ExclusiveArch:	x86_64 ppc64le
b12bf3
b12bf3
Conflicts:	%{name} < %{version}-%{release}
b12bf3
b12bf3
Provides:	kpatch-patch = %{kernel_ver_arch}
b12bf3
Provides:	kpatch-patch = %{kernel_ver}
b12bf3
b12bf3
%if !%{empty_package}
b12bf3
Requires:	systemd
b12bf3
%endif
b12bf3
Requires:	kpatch >= 0.6.1-1
b12bf3
Requires:	kernel-uname-r = %{kernel_ver_arch}
b12bf3
b12bf3
%if !%{empty_package}
b12bf3
BuildRequires:	patchutils
b12bf3
BuildRequires:	kernel-devel = %{kernel_ver}
b12bf3
BuildRequires:	kernel-debuginfo = %{kernel_ver}
b12bf3
b12bf3
# kernel build requirements, generated from:
b12bf3
#   % rpmspec -q --buildrequires kernel.spec | sort | awk '{print "BuildRequires:\t" $0}'
b12bf3
# with arch-specific packages moved into conditional block
b12bf3
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
b12bf3
b12bf3
%ifarch x86_64
b12bf3
BuildRequires:	pesign >= 0.10-4
b12bf3
%endif
b12bf3
b12bf3
%ifarch ppc64le
b12bf3
BuildRequires:	gcc-plugin-devel
b12bf3
%endif
b12bf3
b12bf3
Source0:	https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
b12bf3
b12bf3
Source10:	kernel-%{kernel_ver}.src.rpm
b12bf3
b12bf3
# kpatch-build patches
b12bf3
b12bf3
%global _dupsign_opts --keyname=rhelkpatch1
b12bf3
b12bf3
%define builddir	%{_builddir}/kpatch-%{kpatch_ver}
b12bf3
%define kpatch		%{_sbindir}/kpatch
b12bf3
%define kmoddir 	%{_usr}/lib/kpatch/%{kernel_ver_arch}
b12bf3
%define kinstdir	%{_sharedstatedir}/kpatch/%{kernel_ver_arch}
b12bf3
%define patchmodname	kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
b12bf3
%define patchmod	%{patchmodname}.ko
b12bf3
b12bf3
%define _missing_build_ids_terminate_build 1
b12bf3
%define _find_debuginfo_opts -r
b12bf3
%undefine _include_minidebuginfo
b12bf3
%undefine _find_debuginfo_dwz_opts
b12bf3
b12bf3
%description
b12bf3
This is a kernel live patch module which can be loaded by the kpatch
b12bf3
command line utility to modify the code of a running kernel.  This patch
b12bf3
module is targeted for kernel-%{kernel_ver}.
b12bf3
b12bf3
%prep
b12bf3
%autosetup -n kpatch-%{kpatch_ver} -p1
b12bf3
b12bf3
%build
b12bf3
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
b12bf3
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
b12bf3
b12bf3
# kpatch-build
b12bf3
make -C kpatch-build
b12bf3
b12bf3
# patch module
b12bf3
for i in %{sources}; do
b12bf3
	[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
b12bf3
done
b12bf3
export CACHEDIR="%{builddir}/.kpatch"
b12bf3
kpatch-build/kpatch-build -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
b12bf3
b12bf3
b12bf3
%install
b12bf3
installdir=%{buildroot}/%{kmoddir}
b12bf3
install -d $installdir
b12bf3
install -m 755 %{builddir}/%{patchmod} $installdir
b12bf3
b12bf3
b12bf3
%files
b12bf3
%{_usr}/lib/kpatch
b12bf3
b12bf3
b12bf3
%post
b12bf3
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
b12bf3
chcon -t modules_object_t %{kinstdir}/%{patchmod}
b12bf3
sync
b12bf3
if [[ %{kernel_ver_arch} = $(uname -r) ]]; then
b12bf3
	cver="%{rpm_ver}_%{rpm_rel}"
b12bf3
	pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
b12bf3
b12bf3
	lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
b12bf3
b12bf3
	if [ "${lver}" != "${cver}" ]; then
b12bf3
		echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
b12bf3
		echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
b12bf3
	else
b12bf3
		%{kpatch} load %{patchmod}
b12bf3
	fi
b12bf3
fi
b12bf3
exit 0
b12bf3
b12bf3
b12bf3
%postun
b12bf3
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
b12bf3
sync
b12bf3
exit 0
b12bf3
b12bf3
%else
b12bf3
%description
b12bf3
This is an empty kpatch-patch package which does not contain any real patches.
b12bf3
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
b12bf3
b12bf3
%files
b12bf3
%doc
b12bf3
%endif
b12bf3
b12bf3
%changelog
d46c83
* Tue Jul 27 2021 Artem Savkov <asavkov@redhat.com> [1-4.el8]
d46c83
- race condition in net/can/bcm.c leads to local privilege escalation [1975066] {CVE-2021-3609}
d46c83
- out-of-bounds write in xt_compat_target_from_user() in net/netfilter/x_tables.c [1980520] {CVE-2021-22555}
d46c83
- Improper handling of VM_IO|VM_PFNMAP vmas in KVM can bypass RO checks [1975762] {CVE-2021-22543}
d46c83
e91b83
* Mon Jul 12 2021 Artem Savkov <asavkov@redhat.com> [1-3.el8]
e91b83
- kernel: size_t-to-int conversion vulnerability in the filesystem layer [1975190] {CVE-2021-33909}
e91b83
- kernel: race condition for removal of the HCI controller [1971478] {CVE-2021-32399}
e91b83
fe08b2
* Thu Jun 17 2021 Yannick Cote <ycote@redhat.com> [1-2.el8]
fe08b2
- kernel: use-after-free in net/bluetooth/hci_event.c when destroying an hci_chan [1962521] {CVE-2021-33034}
fe08b2
805d32
* Tue May 11 2021 Artem Savkov <asavkov@redhat.com> [1-1.el8]
805d32
- serspace applications can misuse the KVM API to cause a write of 16 bytes at an offset up to 32 GB from vcpu->run [1954230] {CVE-2021-3501}
805d32
b12bf3
* Mon May 03 2021 Joe Lawrence <joe.lawrence@redhat.com> [0-0.el8]
b12bf3
- An empty patch to subscribe to kpatch stream for kernel-4.18.0-305.el8 [1956393]