Blame SPECS/kpatch-patch.spec

559640
# Set to 1 if building an empty subscription-only package.
0b4453
%define empty_package		0
559640
559640
#######################################################
559640
# Only need to update these variables and the changelog
559640
%define kernel_ver	3.10.0-1160.45.1.el7
559640
%define kpatch_ver	0.9.2
0b4453
%define rpm_ver		1
c6ac4c
%define rpm_rel		2
559640
559640
%if !%{empty_package}
559640
# Patch sources below. DO NOT REMOVE THIS LINE.
0b4453
#
0b4453
# https://bugzilla.redhat.com/1981703
0b4453
Source100: CVE-2020-36385.patch
c6ac4c
#
c6ac4c
# https://bugzilla.redhat.com/2034878
c6ac4c
Source101: CVE-2021-4155.patch
c6ac4c
#
c6ac4c
# https://bugzilla.redhat.com/2031986
c6ac4c
Source102: CVE-2021-0920.patch
c6ac4c
#
c6ac4c
# https://bugzilla.redhat.com/2042766
c6ac4c
Source103: CVE-2020-0466.patch
c6ac4c
#
c6ac4c
# https://bugzilla.redhat.com/2044373
c6ac4c
Source104: CVE-2022-0330.patch
c6ac4c
#
c6ac4c
# https://bugzilla.redhat.com/2047616
c6ac4c
Source105: CVE-2022-22942.patch
559640
# End of patch sources. DO NOT REMOVE THIS LINE.
559640
%endif
559640
559640
%define sanitized_rpm_rel	%{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
559640
%define sanitized_kernel_ver	%{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), ".el7", ""), "%.", "_")))}
559640
%define kernel_ver_arch	%{kernel_ver}.%{_arch}
559640
559640
Name:		kpatch-patch-%{sanitized_kernel_ver}
559640
Version:	%{rpm_ver}
559640
Release:	%{rpm_rel}.el7
559640
559640
%if %{empty_package}
559640
Summary:	Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
559640
%else
559640
Summary:	Live kernel patching module for kernel-%{kernel_ver_arch}
559640
%endif
559640
559640
Group:		System Environment/Kernel
559640
License:	GPLv2
559640
ExclusiveArch:	x86_64 ppc64le
559640
559640
Conflicts:	%{name} < %{version}-%{release}
559640
559640
Provides:	kpatch-patch = %{kernel_ver_arch}
559640
Provides:	kpatch-patch = %{kernel_ver}
559640
559640
%if !%{empty_package}
559640
Requires:	systemd
559640
%endif
559640
Requires:	kpatch >= 0.4.0-3
559640
Requires:	kernel-uname-r = %{kernel_ver_arch}
559640
559640
%if !%{empty_package}
559640
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
559640
BuildRequires:	kernel-devel = %{kernel_ver}
559640
BuildRequires:	kernel-debuginfo = %{kernel_ver}
559640
559640
%ifarch x86_64
559640
BuildRequires: pesign
559640
%endif
559640
559640
%ifarch ppc64le
559640
BuildRequires: gcc-plugin-devel
559640
%endif
559640
559640
Source0:	https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
559640
559640
Source10:	kernel-%{kernel_ver}.src.rpm
559640
559640
# kpatch-build patches
559640
# Patch1: backport.patch
559640
559640
%global _dupsign_opts --keyname=rhelkpatch1
559640
559640
%define builddir	%{_builddir}/kpatch-%{kpatch_ver}
559640
%define kpatch		%{_sbindir}/kpatch
559640
%define kmoddir		%{_usr}/lib/kpatch/%{kernel_ver_arch}
559640
%define patchmodname	kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
559640
%define patchmod	%{patchmodname}.ko
559640
559640
%define _missing_build_ids_terminate_build 1
559640
%define _find_debuginfo_opts -r
559640
%undefine _include_minidebuginfo
559640
%undefine _find_debuginfo_dwz_opts
559640
559640
%description
559640
This is a kernel live patch module which can be loaded by the kpatch
559640
command line utility to modify the code of a running kernel.  This patch
559640
module is targeted for kernel-%{kernel_ver}.
559640
559640
%prep
559640
%autosetup -n kpatch-%{kpatch_ver} -p1
559640
559640
%build
559640
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
559640
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
559640
559640
# kpatch-build
559640
make -C kpatch-build
559640
559640
# patch module
559640
for i in %{sources}; do
559640
	[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
559640
done
559640
export CACHEDIR="%{builddir}/.kpatch"
559640
kpatch-build/kpatch-build -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
559640
559640
559640
%install
559640
installdir=%{buildroot}/%{kmoddir}
559640
install -d $installdir
559640
install -m 755 %{builddir}/%{patchmod} $installdir
559640
559640
559640
%files
559640
%{_usr}/lib/kpatch
559640
559640
559640
%post
559640
if [[ %{kernel_ver_arch} = $(uname -r) ]]; then
559640
	cver="%{rpm_ver}_%{rpm_rel}"
559640
	pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
559640
559640
	lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
559640
559640
	if [ "${lver}" != "${cver}" ]; then
559640
		echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
559640
		echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
559640
	else
559640
		%{kpatch} load %{kmoddir}/%{patchmod}
559640
	fi
559640
fi
559640
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
559640
sync
559640
exit 0
559640
559640
559640
%postun
559640
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
559640
sync
559640
exit 0
559640
559640
%else
559640
%description
559640
This is an empty kpatch-patch package which does not contain any real patches.
559640
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
559640
559640
%files
559640
%doc
559640
%endif
559640
559640
%changelog
c6ac4c
* Fri Feb 11 2022 Joe Lawrence <joe.lawrence@redhat.com> [1-2.el7]
c6ac4c
- kernel: failing usercopy allows for use-after-free exploitation [2047616] {CVE-2022-22942}
c6ac4c
- kernel: possible privileges escalation due to missing TLB flush [2044373] {CVE-2022-0330}
c6ac4c
- kernel: use after free in eventpoll.c may lead to escalation of privilege [2042766] {CVE-2020-0466}
c6ac4c
- kernel: Use After Free in unix_gc() which could result in a local privilege escalation [2031986] {CVE-2021-0920}
c6ac4c
- kernel: xfs: raw block device data leak in XFS_IOC_ALLOCSP IOCTL [2034878] {CVE-2021-4155}
c6ac4c
0b4453
* Fri Nov 12 2021 Joe Lawrence <joe.lawrence@redhat.com> [1-1.el7]
0b4453
- kernel: use-after-free in drivers/infiniband/core/ucma.c ctx use-after-free [1981703] {CVE-2020-36385}
0b4453
559640
* Tue Sep 28 2021 Joe Lawrence <joe.lawrence@redhat.com> [0-0.el7]
559640
- An empty patch to subscribe to kpatch stream for kernel-3.10.0-1160.45.1.el7 [2008610]