Blame SPECS/kpatch-patch.spec

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