Blame SPECS/kpatch-patch.spec

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