Blame SPECS/kpatch-patch.spec

326b84
# Set to 1 if building an empty subscription-only package.
525fd3
%define empty_package		0
326b84
326b84
#######################################################
326b84
# Only need to update these variables and the changelog
326b84
%define kernel_ver	3.10.0-1160.88.1.el7
326b84
%define kpatch_ver	0.9.2
525fd3
%define rpm_ver		1
b9644d
%define rpm_rel		3
326b84
326b84
%if !%{empty_package}
326b84
# Patch sources below. DO NOT REMOVE THIS LINE.
525fd3
#
525fd3
# https://bugzilla.redhat.com/2153001
525fd3
Source100: CVE-2022-3564.patch
525fd3
#
525fd3
# https://bugzilla.redhat.com/2196588
525fd3
Source101: CVE-2023-32233.patch
4275d7
#
4275d7
# https://bugzilla.redhat.com/2217003
4275d7
Source102: CVE-2023-35788.patch
b9644d
#
b9644d
# https://bugzilla.redhat.com/2196588
b9644d
Source103: CVE-2023-32233-full.patch
b9644d
#
b9644d
# https://bugzilla.redhat.com/2221747
b9644d
Source104: CVE-2023-35001.patch
b9644d
#
b9644d
# https://bugzilla.redhat.com/2225510
b9644d
Source105: CVE-2023-3609.patch
326b84
# End of patch sources. DO NOT REMOVE THIS LINE.
326b84
%endif
326b84
326b84
%define sanitized_rpm_rel	%{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
326b84
%define sanitized_kernel_ver	%{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), ".el7", ""), "%.", "_")))}
326b84
%define kernel_ver_arch	%{kernel_ver}.%{_arch}
326b84
326b84
Name:		kpatch-patch-%{sanitized_kernel_ver}
326b84
Version:	%{rpm_ver}
326b84
Release:	%{rpm_rel}.el7
326b84
326b84
%if %{empty_package}
326b84
Summary:	Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
326b84
%else
326b84
Summary:	Live kernel patching module for kernel-%{kernel_ver_arch}
326b84
%endif
326b84
326b84
Group:		System Environment/Kernel
326b84
License:	GPLv2
326b84
ExclusiveArch:	x86_64 ppc64le
326b84
326b84
Conflicts:	%{name} < %{version}-%{release}
326b84
326b84
Provides:	kpatch-patch = %{kernel_ver_arch}
326b84
Provides:	kpatch-patch = %{kernel_ver}
326b84
326b84
%if !%{empty_package}
326b84
Requires:	systemd
326b84
%endif
326b84
Requires:	kpatch >= 0.4.0-3
326b84
Requires:	kernel-uname-r = %{kernel_ver_arch}
326b84
326b84
%if !%{empty_package}
326b84
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
326b84
BuildRequires:	kernel-devel = %{kernel_ver}
326b84
BuildRequires:	kernel-debuginfo = %{kernel_ver}
326b84
326b84
%ifarch x86_64
326b84
BuildRequires: pesign
326b84
%endif
326b84
326b84
%ifarch ppc64le
326b84
BuildRequires: gcc-plugin-devel
326b84
%endif
326b84
326b84
Source0:	https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
326b84
326b84
Source10:	kernel-%{kernel_ver}.src.rpm
326b84
326b84
# kpatch-build patches
326b84
# Patch1: backport.patch
326b84
Patch1: v0.9.2-backport-MR-1281-create-diff-object-add-suppo.patch
326b84
Patch2: v0.9.2-backport-MR-1200-Make-sure-section-symbols-ex.patch
326b84
326b84
%global _dupsign_opts --keyname=rhelkpatch1
326b84
326b84
%define builddir	%{_builddir}/kpatch-%{kpatch_ver}
326b84
%define kpatch		%{_sbindir}/kpatch
326b84
%define kmoddir		%{_usr}/lib/kpatch/%{kernel_ver_arch}
326b84
%define patchmodname	kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
326b84
%define patchmod	%{patchmodname}.ko
326b84
326b84
%define _missing_build_ids_terminate_build 1
326b84
%define _find_debuginfo_opts -r
326b84
%undefine _include_minidebuginfo
326b84
%undefine _find_debuginfo_dwz_opts
326b84
326b84
%description
326b84
This is a kernel live patch module which can be loaded by the kpatch
326b84
command line utility to modify the code of a running kernel.  This patch
326b84
module is targeted for kernel-%{kernel_ver}.
326b84
326b84
%prep
326b84
%autosetup -n kpatch-%{kpatch_ver} -p1
326b84
326b84
%build
326b84
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
326b84
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
326b84
326b84
# kpatch-build
326b84
make -C kpatch-build
326b84
326b84
# patch module
326b84
for i in %{sources}; do
326b84
	[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
326b84
done
326b84
export CACHEDIR="%{builddir}/.kpatch"
326b84
kpatch-build/kpatch-build -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
326b84
326b84
326b84
%install
326b84
installdir=%{buildroot}/%{kmoddir}
326b84
install -d $installdir
326b84
install -m 755 %{builddir}/%{patchmod} $installdir
326b84
326b84
326b84
%files
326b84
%{_usr}/lib/kpatch
326b84
326b84
326b84
%post
326b84
if [[ %{kernel_ver_arch} = $(uname -r) ]]; then
326b84
	cver="%{rpm_ver}_%{rpm_rel}"
326b84
	pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
326b84
326b84
	lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
326b84
326b84
	if [ "${lver}" != "${cver}" ]; then
326b84
		echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
326b84
		echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
326b84
	else
326b84
		%{kpatch} load %{kmoddir}/%{patchmod}
326b84
	fi
326b84
fi
326b84
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
326b84
sync
326b84
exit 0
326b84
326b84
326b84
%postun
326b84
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
326b84
sync
326b84
exit 0
326b84
326b84
%else
326b84
%description
326b84
This is an empty kpatch-patch package which does not contain any real patches.
326b84
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
326b84
326b84
%files
326b84
%doc
326b84
%endif
326b84
326b84
%changelog
b9644d
* Mon Sep 25 2023 Yannick Cote <ycote@redhat.com> [1-3.el7]
b9644d
- kernel: net/sched: cls_u32 component reference counter leak if tcf_change_indev() fails [2225510] {CVE-2023-3609}
b9644d
- kernel: nf_tables: stack-out-of-bounds-read in nft_byteorder_eval() [2221747] {CVE-2023-35001}
b9644d
- kernel: netfilter: use-after-free in nf_tables when processing batch requests can lead to privilege escalation [2196588] {CVE-2023-32233}
b9644d
4275d7
* Tue Aug 15 2023 Yannick Cote <ycote@redhat.com> [1-2.el7]
4275d7
- kernel: cls_flower: out-of-bounds write in fl_set_geneve_opt() [2217003] {CVE-2023-35788}
4275d7
525fd3
* Wed Jul 05 2023 Yannick Cote <ycote@redhat.com> [1-1.el7]
525fd3
- kernel: netfilter: use-after-free in nf_tables when processing batch requests can lead to privilege escalation [2196588] {CVE-2023-32233}
525fd3
- kernel: use-after-free caused by l2cap_reassemble_sdu() in net/bluetooth/l2cap_core.c [2153001] {CVE-2022-3564}
525fd3
326b84
* Mon Feb 20 2023 Yannick Cote <ycote@redhat.com> [0-0.el7]
326b84
- An empty patch to subscribe to kpatch stream for kernel-3.10.0-1160.88.1.el7 [2171884]