Blame SPECS/kpatch-patch.spec

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