Blame SPECS/kpatch-patch.spec

350179
# Set to 1 if building an empty subscription-only package.
9c2a32
%define empty_package		0
350179
350179
#######################################################
350179
# Only need to update these variables and the changelog
350179
%define kernel_ver	4.18.0-305.3.1.el8_4
350179
%define kpatch_ver	0.9.3
9c2a32
%define rpm_ver		1
9c2a32
%define rpm_rel		1
350179
350179
%if !%{empty_package}
350179
# Patch sources below. DO NOT REMOVE THIS LINE.
9c2a32
#
9c2a32
# https://bugzilla.redhat.com/1962521
9c2a32
Source100: CVE-2021-33034.patch
350179
# End of patch sources. DO NOT REMOVE THIS LINE.
350179
%endif
350179
350179
%define sanitized_rpm_rel	%{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
350179
%define sanitized_kernel_ver   %{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), '.el8_?\%d?', ""), "%.", "_")))}
350179
%define kernel_ver_arch        %{kernel_ver}.%{_arch}
350179
350179
Name:		kpatch-patch-%{sanitized_kernel_ver}
350179
Version:	%{rpm_ver}
350179
Release:	%{rpm_rel}%{?dist}
350179
350179
%if %{empty_package}
350179
Summary:	Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
350179
%else
350179
Summary:	Live kernel patching module for kernel-%{kernel_ver_arch}
350179
%endif
350179
350179
Group:		System Environment/Kernel
350179
License:	GPLv2
350179
ExclusiveArch:	x86_64 ppc64le
350179
350179
Conflicts:	%{name} < %{version}-%{release}
350179
350179
Provides:	kpatch-patch = %{kernel_ver_arch}
350179
Provides:	kpatch-patch = %{kernel_ver}
350179
350179
%if !%{empty_package}
350179
Requires:	systemd
350179
%endif
350179
Requires:	kpatch >= 0.6.1-1
350179
Requires:	kernel-uname-r = %{kernel_ver_arch}
350179
350179
%if !%{empty_package}
350179
BuildRequires:	patchutils
350179
BuildRequires:	kernel-devel = %{kernel_ver}
350179
BuildRequires:	kernel-debuginfo = %{kernel_ver}
350179
350179
# kernel build requirements, generated from:
350179
#   % rpmspec -q --buildrequires kernel.spec | sort | awk '{print "BuildRequires:\t" $0}'
350179
# with arch-specific packages moved into conditional block
350179
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
350179
350179
%ifarch x86_64
350179
BuildRequires:	pesign >= 0.10-4
350179
%endif
350179
350179
%ifarch ppc64le
350179
BuildRequires:	gcc-plugin-devel
350179
%endif
350179
350179
Source0:	https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
350179
350179
Source10:	kernel-%{kernel_ver}.src.rpm
350179
350179
# kpatch-build patches
350179
350179
%global _dupsign_opts --keyname=rhelkpatch1
350179
350179
%define builddir	%{_builddir}/kpatch-%{kpatch_ver}
350179
%define kpatch		%{_sbindir}/kpatch
350179
%define kmoddir 	%{_usr}/lib/kpatch/%{kernel_ver_arch}
350179
%define kinstdir	%{_sharedstatedir}/kpatch/%{kernel_ver_arch}
350179
%define patchmodname	kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
350179
%define patchmod	%{patchmodname}.ko
350179
350179
%define _missing_build_ids_terminate_build 1
350179
%define _find_debuginfo_opts -r
350179
%undefine _include_minidebuginfo
350179
%undefine _find_debuginfo_dwz_opts
350179
350179
%description
350179
This is a kernel live patch module which can be loaded by the kpatch
350179
command line utility to modify the code of a running kernel.  This patch
350179
module is targeted for kernel-%{kernel_ver}.
350179
350179
%prep
350179
%autosetup -n kpatch-%{kpatch_ver} -p1
350179
350179
%build
350179
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
350179
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
350179
350179
# kpatch-build
350179
make -C kpatch-build
350179
350179
# patch module
350179
for i in %{sources}; do
350179
	[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
350179
done
350179
export CACHEDIR="%{builddir}/.kpatch"
350179
kpatch-build/kpatch-build -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
350179
350179
350179
%install
350179
installdir=%{buildroot}/%{kmoddir}
350179
install -d $installdir
350179
install -m 755 %{builddir}/%{patchmod} $installdir
350179
350179
350179
%files
350179
%{_usr}/lib/kpatch
350179
350179
350179
%post
350179
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
350179
chcon -t modules_object_t %{kinstdir}/%{patchmod}
350179
sync
350179
if [[ %{kernel_ver_arch} = $(uname -r) ]]; then
350179
	cver="%{rpm_ver}_%{rpm_rel}"
350179
	pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
350179
350179
	lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
350179
350179
	if [ "${lver}" != "${cver}" ]; then
350179
		echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
350179
		echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
350179
	else
350179
		%{kpatch} load %{patchmod}
350179
	fi
350179
fi
350179
exit 0
350179
350179
350179
%postun
350179
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
350179
sync
350179
exit 0
350179
350179
%else
350179
%description
350179
This is an empty kpatch-patch package which does not contain any real patches.
350179
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
350179
350179
%files
350179
%doc
350179
%endif
350179
350179
%changelog
9c2a32
* Thu Jun 17 2021 Yannick Cote <ycote@redhat.com> [1-1.el8_4]
9c2a32
- kernel: use-after-free in net/bluetooth/hci_event.c when destroying an hci_chan [1962521] {CVE-2021-33034}
9c2a32
350179
* Wed May 19 2021 Artem Savkov <asavkov@redhat.com> [0-0.el8_4]
350179
- An empty patch to subscribe to kpatch stream for kernel-4.18.0-305.3.1.el8_4 [1962203]