Blame SPECS/kpatch-patch.spec

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