Blame SPECS/kpatch-patch.spec

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