Blame SPECS/kpatch-patch.spec

a13259
# Set to 1 if building an empty subscription-only package.
661362
%define empty_package		0
a13259
a13259
#######################################################
a13259
# Only need to update these variables and the changelog
a13259
%define kernel_ver	4.18.0-425.10.1.el8_7
a13259
%define kpatch_ver	0.9.6
661362
%define rpm_ver		1
661362
%define rpm_rel		1
a13259
a13259
%if !%{empty_package}
a13259
# Patch sources below. DO NOT REMOVE THIS LINE.
661362
#
661362
# https://bugzilla.redhat.com/2141242
661362
Source100: CVE-2022-41222.patch
661362
#
661362
# https://bugzilla.redhat.com/2143184
661362
Source101: CVE-2022-43945.patch
a13259
# End of patch sources. DO NOT REMOVE THIS LINE.
a13259
%endif
a13259
a13259
%define sanitized_rpm_rel	%{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
a13259
%define sanitized_kernel_ver   %{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), '.el8_?\%d?', ""), "%.", "_")))}
a13259
%define kernel_ver_arch        %{kernel_ver}.%{_arch}
a13259
a13259
Name:		kpatch-patch-%{sanitized_kernel_ver}
a13259
Version:	%{rpm_ver}
a13259
Release:	%{rpm_rel}%{?dist}
a13259
a13259
%if %{empty_package}
a13259
Summary:	Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
a13259
%else
a13259
Summary:	Live kernel patching module for kernel-%{kernel_ver_arch}
a13259
%endif
a13259
a13259
Group:		System Environment/Kernel
a13259
License:	GPLv2
a13259
ExclusiveArch:	x86_64 ppc64le
a13259
a13259
Conflicts:	%{name} < %{version}-%{release}
a13259
a13259
Provides:	kpatch-patch = %{kernel_ver_arch}
a13259
Provides:	kpatch-patch = %{kernel_ver}
a13259
a13259
%if !%{empty_package}
a13259
Requires:	systemd
a13259
%endif
a13259
Requires:	kpatch >= 0.6.1-1
a13259
Requires:	kernel-uname-r = %{kernel_ver_arch}
a13259
a13259
%if !%{empty_package}
a13259
BuildRequires:	patchutils
a13259
BuildRequires:	kernel-devel = %{kernel_ver}
a13259
BuildRequires:	kernel-debuginfo = %{kernel_ver}
a13259
a13259
# kernel build requirements, generated from:
a13259
#   % rpmspec -q --buildrequires kernel.spec | sort | awk '{print "BuildRequires:\t" $0}'
a13259
# with arch-specific packages moved into conditional block
a13259
BuildRequires:	asciidoc audit-libs-devel bash bc binutils binutils-devel bison bzip2 diffutils elfutils elfutils-devel findutils flex gawk gcc gettext git gzip hmaccalc hostname kmod m4 make ncurses-devel net-tools newt-devel numactl-devel openssl openssl-devel patch pciutils-devel perl-Carp perl-devel perl(ExtUtils::Embed) perl-generators perl-interpreter python3-devel python3-docutils redhat-rpm-config rpm-build sh-utils tar xmlto xz xz-devel zlib-devel java-devel kabi-dw
a13259
a13259
%ifarch x86_64
a13259
BuildRequires:	pesign >= 0.10-4
a13259
%endif
a13259
a13259
%ifarch ppc64le
a13259
BuildRequires:	gcc-plugin-devel
a13259
%endif
a13259
a13259
Source0:	https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
a13259
a13259
Source10:	kernel-%{kernel_ver}.src.rpm
a13259
a13259
# kpatch-build patches
a13259
Patch1: v0.9.6-backport-MR-1281-create-diff-object-add-suppo.patch
a13259
a13259
%global _dupsign_opts --keyname=rhelkpatch1
a13259
a13259
%define builddir	%{_builddir}/kpatch-%{kpatch_ver}
a13259
%define kpatch		%{_sbindir}/kpatch
a13259
%define kmoddir 	%{_usr}/lib/kpatch/%{kernel_ver_arch}
a13259
%define kinstdir	%{_sharedstatedir}/kpatch/%{kernel_ver_arch}
a13259
%define patchmodname	kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
a13259
%define patchmod	%{patchmodname}.ko
a13259
a13259
%define _missing_build_ids_terminate_build 1
a13259
%define _find_debuginfo_opts -r
a13259
%undefine _include_minidebuginfo
a13259
%undefine _find_debuginfo_dwz_opts
a13259
a13259
%description
a13259
This is a kernel live patch module which can be loaded by the kpatch
a13259
command line utility to modify the code of a running kernel.  This patch
a13259
module is targeted for kernel-%{kernel_ver}.
a13259
a13259
%prep
a13259
%autosetup -n kpatch-%{kpatch_ver} -p1
a13259
a13259
%build
a13259
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
a13259
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
a13259
a13259
# kpatch-build
a13259
make -C kpatch-build
a13259
a13259
# patch module
a13259
for i in %{sources}; do
a13259
	[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
a13259
done
a13259
export CACHEDIR="%{builddir}/.kpatch"
a13259
kpatch-build/kpatch-build --non-replace -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
a13259
a13259
a13259
%install
a13259
installdir=%{buildroot}/%{kmoddir}
a13259
install -d $installdir
a13259
install -m 755 %{builddir}/%{patchmod} $installdir
a13259
a13259
a13259
%files
a13259
%{_usr}/lib/kpatch
a13259
a13259
a13259
%post
a13259
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
a13259
chcon -t modules_object_t %{kinstdir}/%{patchmod}
a13259
sync
a13259
if [[ %{kernel_ver_arch} = $(uname -r) ]]; then
a13259
	cver="%{rpm_ver}_%{rpm_rel}"
a13259
	pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
a13259
a13259
	lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
a13259
a13259
	if [ "${lver}" != "${cver}" ]; then
a13259
		echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
a13259
		echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
a13259
	else
a13259
		%{kpatch} load %{patchmod}
a13259
	fi
a13259
fi
a13259
exit 0
a13259
a13259
a13259
%postun
a13259
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
a13259
sync
a13259
exit 0
a13259
a13259
%else
a13259
%description
a13259
This is an empty kpatch-patch package which does not contain any real patches.
a13259
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
a13259
a13259
%files
a13259
%doc
a13259
%endif
a13259
a13259
%changelog
661362
* Mon Feb 06 2023 Yannick Cote <ycote@redhat.com> [1-1.el8_7]
661362
- kernel: nfsd buffer overflow by RPC message over TCP with garbage data [2143184] {CVE-2022-43945}
661362
- kernel: mm/mremap.c use-after-free vulnerability [2141242] {CVE-2022-41222}
661362
a13259
* Wed Dec 21 2022 Linqing Lu <lilu@redhat.com> [0-0.el8]
a13259
- An empty patch to subscribe to kpatch stream for kernel-4.18.0-425.10.1.el8_7 [2155558]