Blame SPECS/kpatch-patch.spec

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