Blame SPECS/kpatch-patch.spec

4e0e9d
# Set to 1 if building an empty subscription-only package.
c54471
%define empty_package		0
4e0e9d
4e0e9d
#######################################################
4e0e9d
# Only need to update these variables and the changelog
4e0e9d
%define kernel_ver	3.10.0-1160.105.1.el7
4e0e9d
%define kpatch_ver	0.9.2
c54471
%define rpm_ver		1
277db7
%define rpm_rel		2
4e0e9d
4e0e9d
%if !%{empty_package}
4e0e9d
# Patch sources below. DO NOT REMOVE THIS LINE.
c54471
#
c54471
# https://issues.redhat.com/browse/RHEL-8456
c54471
Source100: CVE-2023-42753.patch
277db7
#
277db7
# https://issues.redhat.com/browse/RHEL-8831
277db7
Source101: CVE-2022-42896.patch
277db7
#
277db7
# https://issues.redhat.com/browse/RHEL-15213
277db7
Source102: CVE-2023-45871.patch
277db7
#
277db7
# https://issues.redhat.com/browse/RHEL-14416
277db7
Source103: CVE-2023-4921.patch
4e0e9d
# End of patch sources. DO NOT REMOVE THIS LINE.
4e0e9d
%endif
4e0e9d
4e0e9d
%define sanitized_rpm_rel	%{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
4e0e9d
%define sanitized_kernel_ver	%{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), ".el7", ""), "%.", "_")))}
4e0e9d
%define kernel_ver_arch	%{kernel_ver}.%{_arch}
4e0e9d
4e0e9d
Name:		kpatch-patch-%{sanitized_kernel_ver}
4e0e9d
Version:	%{rpm_ver}
4e0e9d
Release:	%{rpm_rel}.el7
4e0e9d
4e0e9d
%if %{empty_package}
4e0e9d
Summary:	Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
4e0e9d
%else
4e0e9d
Summary:	Live kernel patching module for kernel-%{kernel_ver_arch}
4e0e9d
%endif
4e0e9d
4e0e9d
Group:		System Environment/Kernel
4e0e9d
License:	GPLv2
4e0e9d
ExclusiveArch:	x86_64 ppc64le
4e0e9d
4e0e9d
Conflicts:	%{name} < %{version}-%{release}
4e0e9d
4e0e9d
Provides:	kpatch-patch = %{kernel_ver_arch}
4e0e9d
Provides:	kpatch-patch = %{kernel_ver}
4e0e9d
4e0e9d
%if !%{empty_package}
4e0e9d
Requires:	systemd
4e0e9d
%endif
4e0e9d
Requires:	kpatch >= 0.4.0-3
4e0e9d
Requires:	kernel-uname-r = %{kernel_ver_arch}
4e0e9d
4e0e9d
%if !%{empty_package}
4e0e9d
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
4e0e9d
BuildRequires:	kernel-devel = %{kernel_ver}
4e0e9d
BuildRequires:	kernel-debuginfo = %{kernel_ver}
4e0e9d
4e0e9d
%ifarch x86_64
4e0e9d
BuildRequires: pesign
4e0e9d
%endif
4e0e9d
4e0e9d
%ifarch ppc64le
4e0e9d
BuildRequires: gcc-plugin-devel
4e0e9d
%endif
4e0e9d
4e0e9d
Source0:	https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
4e0e9d
4e0e9d
Source10:	kernel-%{kernel_ver}.src.rpm
4e0e9d
4e0e9d
# kpatch-build patches
4e0e9d
# Patch1: backport.patch
4e0e9d
Patch1: v0.9.2-backport-MR-1281-create-diff-object-add-suppo.patch
4e0e9d
Patch2: v0.9.2-backport-MR-1200-Make-sure-section-symbols-ex.patch
4e0e9d
4e0e9d
%global _dupsign_opts --keyname=rhelkpatch1
4e0e9d
4e0e9d
%define builddir	%{_builddir}/kpatch-%{kpatch_ver}
4e0e9d
%define kpatch		%{_sbindir}/kpatch
4e0e9d
%define kmoddir		%{_usr}/lib/kpatch/%{kernel_ver_arch}
4e0e9d
%define patchmodname	kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
4e0e9d
%define patchmod	%{patchmodname}.ko
4e0e9d
4e0e9d
%define _missing_build_ids_terminate_build 1
4e0e9d
%define _find_debuginfo_opts -r
4e0e9d
%undefine _include_minidebuginfo
4e0e9d
%undefine _find_debuginfo_dwz_opts
4e0e9d
4e0e9d
%description
4e0e9d
This is a kernel live patch module which can be loaded by the kpatch
4e0e9d
command line utility to modify the code of a running kernel.  This patch
4e0e9d
module is targeted for kernel-%{kernel_ver}.
4e0e9d
4e0e9d
%prep
4e0e9d
%autosetup -n kpatch-%{kpatch_ver} -p1
4e0e9d
4e0e9d
%build
4e0e9d
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
4e0e9d
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
4e0e9d
4e0e9d
# kpatch-build
4e0e9d
make -C kpatch-build
4e0e9d
4e0e9d
# patch module
4e0e9d
for i in %{sources}; do
4e0e9d
	[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
4e0e9d
done
4e0e9d
export CACHEDIR="%{builddir}/.kpatch"
4e0e9d
kpatch-build/kpatch-build -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
4e0e9d
4e0e9d
4e0e9d
%install
4e0e9d
installdir=%{buildroot}/%{kmoddir}
4e0e9d
install -d $installdir
4e0e9d
install -m 755 %{builddir}/%{patchmod} $installdir
4e0e9d
4e0e9d
4e0e9d
%files
4e0e9d
%{_usr}/lib/kpatch
4e0e9d
4e0e9d
4e0e9d
%post
4e0e9d
if [[ %{kernel_ver_arch} = $(uname -r) ]]; then
4e0e9d
	cver="%{rpm_ver}_%{rpm_rel}"
4e0e9d
	pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
4e0e9d
4e0e9d
	lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
4e0e9d
4e0e9d
	if [ "${lver}" != "${cver}" ]; then
4e0e9d
		echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
4e0e9d
		echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
4e0e9d
	else
4e0e9d
		%{kpatch} load %{kmoddir}/%{patchmod}
4e0e9d
	fi
4e0e9d
fi
4e0e9d
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
4e0e9d
sync
4e0e9d
exit 0
4e0e9d
4e0e9d
4e0e9d
%postun
4e0e9d
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
4e0e9d
sync
4e0e9d
exit 0
4e0e9d
4e0e9d
%else
4e0e9d
%description
4e0e9d
This is an empty kpatch-patch package which does not contain any real patches.
4e0e9d
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
4e0e9d
4e0e9d
%files
4e0e9d
%doc
4e0e9d
%endif
4e0e9d
4e0e9d
%changelog
277db7
* Wed Mar 06 2024 Yannick Cote <ycote@redhat.com> [1-2.el7]
277db7
- kernel: use-after-free in sch_qfq network scheduler [RHEL-14416] {CVE-2023-4921}
277db7
- kernel: IGB driver inadequate buffer size for frames larger than MTU [RHEL-15213] {CVE-2023-45871}
277db7
- kernel: use-after-free in l2cap_connect and l2cap_le_connect_req in net/bluetooth/l2cap_core.c [RHEL-8831] {CVE-2022-42896}
277db7
c54471
* Fri Jan 05 2024 Yannick Cote <ycote@redhat.com> [1-1.el7]
c54471
- kernel: netfilter: potential slab-out-of-bound access due to integer underflow [RHEL-8456] {CVE-2023-42753}
c54471
4e0e9d
* Wed Nov 08 2023 Yannick Cote <ycote@redhat.com> [0-0.el7]
4e0e9d
- An empty patch to subscribe to kpatch stream for kernel-3.10.0-1160.105.1.el7 [RHEL-16012]