Blame SPECS/kpatch-patch.spec

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