Blame SPECS/kpatch-patch.spec

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