Blame SPECS/kpatch-patch.spec

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