Blame SPECS/kpatch-patch.spec

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