Blame SPECS/kpatch-patch.spec

e4b9db
# Set to 1 if building an empty subscription-only package.
2460d0
%define empty_package		0
e4b9db
e4b9db
#######################################################
e4b9db
# Only need to update these variables and the changelog
e4b9db
%define kernel_ver	3.10.0-1160.11.1.el7
e4b9db
%define kpatch_ver	0.9.2
2460d0
%define rpm_ver		1
1873a3
%define rpm_rel		4
e4b9db
e4b9db
%if !%{empty_package}
e4b9db
# Patch sources below. DO NOT REMOVE THIS LINE.
2460d0
#
2460d0
# https://bugzilla.redhat.com/1908206
2460d0
Source100: tty-Fix-pgrp-locking-in-tiocspgrp.patch
2460d0
#
2460d0
# https://bugzilla.redhat.com/1902568
2460d0
Source101: target-scsi-Fix-XCOPY-NAA-identifier-lookup.patch
1873a3
#
1873a3
# https://bugzilla.redhat.com/1930840
1873a3
# https://bugzilla.redhat.com/1930863
1873a3
Source102: scsi-iscsi-kpatch-fixes-for-CVE-2021-27364-and-CVE-2.patch
e4b9db
# End of patch sources. DO NOT REMOVE THIS LINE.
e4b9db
%endif
e4b9db
e4b9db
%define sanitized_rpm_rel	%{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
e4b9db
%define sanitized_kernel_ver	%{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), ".el7", ""), "%.", "_")))}
e4b9db
%define kernel_ver_arch	%{kernel_ver}.%{_arch}
e4b9db
e4b9db
Name:		kpatch-patch-%{sanitized_kernel_ver}
e4b9db
Version:	%{rpm_ver}
e4b9db
Release:	%{rpm_rel}.el7
e4b9db
e4b9db
%if %{empty_package}
e4b9db
Summary:	Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
e4b9db
%else
e4b9db
Summary:	Live kernel patching module for kernel-%{kernel_ver_arch}
e4b9db
%endif
e4b9db
e4b9db
Group:		System Environment/Kernel
e4b9db
License:	GPLv2
e4b9db
ExclusiveArch:	x86_64 ppc64le
e4b9db
e4b9db
Conflicts:	%{name} < %{version}-%{release}
e4b9db
e4b9db
Provides:	kpatch-patch = %{kernel_ver_arch}
e4b9db
Provides:	kpatch-patch = %{kernel_ver}
e4b9db
e4b9db
%if !%{empty_package}
e4b9db
Requires:	systemd
e4b9db
%endif
e4b9db
Requires:	kpatch >= 0.4.0-3
e4b9db
Requires:	kernel-uname-r = %{kernel_ver_arch}
e4b9db
e4b9db
%if !%{empty_package}
e4b9db
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
e4b9db
BuildRequires:	kernel-devel = %{kernel_ver}
e4b9db
BuildRequires:	kernel-debuginfo = %{kernel_ver}
e4b9db
e4b9db
%ifarch x86_64
e4b9db
BuildRequires: pesign
e4b9db
%endif
e4b9db
e4b9db
%ifarch ppc64le
e4b9db
BuildRequires: gcc-plugin-devel
e4b9db
%endif
e4b9db
e4b9db
Source0:	https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
e4b9db
e4b9db
Source10:	kernel-%{kernel_ver}.src.rpm
e4b9db
e4b9db
# kpatch-build patches
e4b9db
# Patch1: backport.patch
e4b9db
e4b9db
%global _dupsign_opts --keyname=rhelkpatch1
e4b9db
e4b9db
%define builddir	%{_builddir}/kpatch-%{kpatch_ver}
e4b9db
%define kpatch		%{_sbindir}/kpatch
e4b9db
%define kmoddir		%{_usr}/lib/kpatch/%{kernel_ver_arch}
e4b9db
%define patchmodname	kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
e4b9db
%define patchmod	%{patchmodname}.ko
e4b9db
e4b9db
%define _missing_build_ids_terminate_build 1
e4b9db
%define _find_debuginfo_opts -r
e4b9db
%undefine _include_minidebuginfo
e4b9db
%undefine _find_debuginfo_dwz_opts
e4b9db
e4b9db
%description
e4b9db
This is a kernel live patch module which can be loaded by the kpatch
e4b9db
command line utility to modify the code of a running kernel.  This patch
e4b9db
module is targeted for kernel-%{kernel_ver}.
e4b9db
e4b9db
%prep
e4b9db
%autosetup -n kpatch-%{kpatch_ver} -p1
e4b9db
e4b9db
%build
e4b9db
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
e4b9db
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
e4b9db
e4b9db
# kpatch-build
e4b9db
make -C kpatch-build
e4b9db
e4b9db
# patch module
e4b9db
for i in %{sources}; do
e4b9db
	[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
e4b9db
done
e4b9db
export CACHEDIR="%{builddir}/.kpatch"
e4b9db
kpatch-build/kpatch-build -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
e4b9db
e4b9db
e4b9db
%install
e4b9db
installdir=%{buildroot}/%{kmoddir}
e4b9db
install -d $installdir
e4b9db
install -m 755 %{builddir}/%{patchmod} $installdir
e4b9db
e4b9db
e4b9db
%files
e4b9db
%{_usr}/lib/kpatch
e4b9db
e4b9db
e4b9db
%post
e4b9db
if [[ %{kernel_ver_arch} = $(uname -r) ]]; then
e4b9db
	cver="%{rpm_ver}_%{rpm_rel}"
e4b9db
	pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
e4b9db
e4b9db
	lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
e4b9db
e4b9db
	if [ "${lver}" != "${cver}" ]; then
e4b9db
		echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
e4b9db
		echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
e4b9db
	else
e4b9db
		%{kpatch} load %{kmoddir}/%{patchmod}
e4b9db
	fi
e4b9db
fi
e4b9db
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
e4b9db
sync
e4b9db
exit 0
e4b9db
e4b9db
e4b9db
%postun
e4b9db
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
e4b9db
sync
e4b9db
exit 0
e4b9db
e4b9db
%else
e4b9db
%description
e4b9db
This is an empty kpatch-patch package which does not contain any real patches.
e4b9db
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
e4b9db
e4b9db
%files
e4b9db
%doc
e4b9db
%endif
e4b9db
e4b9db
%changelog
1873a3
* Fri Mar 26 2021 Joe Lawrence <joe.lawrence@redhat.com> [1-4.el7]
1873a3
- kernel: out-of-bounds read in libiscsi module [1930840] {CVE-2021-27364}
1873a3
- kernel: heap buffer overflow in the iSCSI subsystem [1930863] {CVE-2021-27365}
1873a3
2460d0
* Tue Feb 02 2021 Artem Savkov <asavkov@redhat.com> [1-2.el7]
2460d0
- SCSI target (LIO) write to any block on ILO backstore [1902568] {CVE-2020-28374}
2460d0
2460d0
* Thu Jan 21 2021 Julien Thierry <jthierry@redhat.com> [1-1.el7]
2460d0
- Fix TTY pgrp locking in tiocspgrp [1908206] {CVE-2020-29661}
2460d0
e4b9db
* Wed Dec 02 2020 Yannick Cote <ycote@redhat.com> [0-0.el7]
e4b9db
- An empty patch to subscribe to kpatch stream for kernel-3.10.0-1160.11.1.el7 [1903664]