Blame SPECS/kpatch-patch.spec

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