Blame SPECS/kpatch-patch.spec

aa7d2b
# Set to 1 if building an empty subscription-only package.
970b9f
%define empty_package		0
aa7d2b
aa7d2b
#######################################################
aa7d2b
# Only need to update these variables and the changelog
aa7d2b
%define kernel_ver	4.18.0-348.7.1.el8_5
aa7d2b
%define kpatch_ver	0.9.5
970b9f
%define rpm_ver		1
df284a
%define rpm_rel		2
aa7d2b
aa7d2b
%if !%{empty_package}
aa7d2b
# Patch sources below. DO NOT REMOVE THIS LINE.
970b9f
#
970b9f
# https://bugzilla.redhat.com/2034875
970b9f
Source100: CVE-2021-4155.patch
970b9f
#
970b9f
# https://bugzilla.redhat.com/2040593
970b9f
Source101: CVE-2022-0185.patch
df284a
#
df284a
# https://bugzilla.redhat.com/2031991
df284a
Source102: CVE-2021-0920.patch
df284a
#
df284a
# https://bugzilla.redhat.com/2034618
df284a
Source103: CVE-2021-4154.patch
df284a
#
df284a
# https://bugzilla.redhat.com/2044377
df284a
Source104: CVE-2022-0330.patch
df284a
#
df284a
# https://bugzilla.redhat.com/2050135
df284a
Source105: CVE-2022-0435.patch
df284a
#
df284a
# https://bugzilla.redhat.com/2052187
df284a
Source106: CVE-2022-0492.patch
df284a
#
df284a
# https://bugzilla.redhat.com/2047620
df284a
Source107: CVE-2022-22942.patch
aa7d2b
# End of patch sources. DO NOT REMOVE THIS LINE.
aa7d2b
%endif
aa7d2b
aa7d2b
%define sanitized_rpm_rel	%{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
aa7d2b
%define sanitized_kernel_ver   %{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), '.el8_?\%d?', ""), "%.", "_")))}
aa7d2b
%define kernel_ver_arch        %{kernel_ver}.%{_arch}
aa7d2b
aa7d2b
Name:		kpatch-patch-%{sanitized_kernel_ver}
aa7d2b
Version:	%{rpm_ver}
aa7d2b
Release:	%{rpm_rel}%{?dist}
aa7d2b
aa7d2b
%if %{empty_package}
aa7d2b
Summary:	Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
aa7d2b
%else
aa7d2b
Summary:	Live kernel patching module for kernel-%{kernel_ver_arch}
aa7d2b
%endif
aa7d2b
aa7d2b
Group:		System Environment/Kernel
aa7d2b
License:	GPLv2
aa7d2b
ExclusiveArch:	x86_64 ppc64le
aa7d2b
aa7d2b
Conflicts:	%{name} < %{version}-%{release}
aa7d2b
aa7d2b
Provides:	kpatch-patch = %{kernel_ver_arch}
aa7d2b
Provides:	kpatch-patch = %{kernel_ver}
aa7d2b
aa7d2b
%if !%{empty_package}
aa7d2b
Requires:	systemd
aa7d2b
%endif
aa7d2b
Requires:	kpatch >= 0.6.1-1
aa7d2b
Requires:	kernel-uname-r = %{kernel_ver_arch}
aa7d2b
aa7d2b
%if !%{empty_package}
aa7d2b
BuildRequires:	patchutils
aa7d2b
BuildRequires:	kernel-devel = %{kernel_ver}
aa7d2b
BuildRequires:	kernel-debuginfo = %{kernel_ver}
aa7d2b
aa7d2b
# kernel build requirements, generated from:
aa7d2b
#   % rpmspec -q --buildrequires kernel.spec | sort | awk '{print "BuildRequires:\t" $0}'
aa7d2b
# with arch-specific packages moved into conditional block
aa7d2b
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
aa7d2b
aa7d2b
%ifarch x86_64
aa7d2b
BuildRequires:	pesign >= 0.10-4
aa7d2b
%endif
aa7d2b
aa7d2b
%ifarch ppc64le
aa7d2b
BuildRequires:	gcc-plugin-devel
aa7d2b
%endif
aa7d2b
aa7d2b
Source0:	https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
aa7d2b
aa7d2b
Source10:	kernel-%{kernel_ver}.src.rpm
aa7d2b
aa7d2b
# kpatch-build patches
aa7d2b
aa7d2b
%global _dupsign_opts --keyname=rhelkpatch1
aa7d2b
aa7d2b
%define builddir	%{_builddir}/kpatch-%{kpatch_ver}
aa7d2b
%define kpatch		%{_sbindir}/kpatch
aa7d2b
%define kmoddir 	%{_usr}/lib/kpatch/%{kernel_ver_arch}
aa7d2b
%define kinstdir	%{_sharedstatedir}/kpatch/%{kernel_ver_arch}
aa7d2b
%define patchmodname	kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
aa7d2b
%define patchmod	%{patchmodname}.ko
aa7d2b
aa7d2b
%define _missing_build_ids_terminate_build 1
aa7d2b
%define _find_debuginfo_opts -r
aa7d2b
%undefine _include_minidebuginfo
aa7d2b
%undefine _find_debuginfo_dwz_opts
aa7d2b
aa7d2b
%description
aa7d2b
This is a kernel live patch module which can be loaded by the kpatch
aa7d2b
command line utility to modify the code of a running kernel.  This patch
aa7d2b
module is targeted for kernel-%{kernel_ver}.
aa7d2b
aa7d2b
%prep
aa7d2b
%autosetup -n kpatch-%{kpatch_ver} -p1
aa7d2b
aa7d2b
%build
aa7d2b
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
aa7d2b
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
aa7d2b
aa7d2b
# kpatch-build
aa7d2b
make -C kpatch-build
aa7d2b
aa7d2b
# patch module
aa7d2b
for i in %{sources}; do
aa7d2b
	[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
aa7d2b
done
aa7d2b
export CACHEDIR="%{builddir}/.kpatch"
aa7d2b
kpatch-build/kpatch-build --non-replace -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
aa7d2b
aa7d2b
aa7d2b
%install
aa7d2b
installdir=%{buildroot}/%{kmoddir}
aa7d2b
install -d $installdir
aa7d2b
install -m 755 %{builddir}/%{patchmod} $installdir
aa7d2b
aa7d2b
aa7d2b
%files
aa7d2b
%{_usr}/lib/kpatch
aa7d2b
aa7d2b
aa7d2b
%post
aa7d2b
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
aa7d2b
chcon -t modules_object_t %{kinstdir}/%{patchmod}
aa7d2b
sync
aa7d2b
if [[ %{kernel_ver_arch} = $(uname -r) ]]; then
aa7d2b
	cver="%{rpm_ver}_%{rpm_rel}"
aa7d2b
	pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
aa7d2b
aa7d2b
	lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
aa7d2b
aa7d2b
	if [ "${lver}" != "${cver}" ]; then
aa7d2b
		echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
aa7d2b
		echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
aa7d2b
	else
aa7d2b
		%{kpatch} load %{patchmod}
aa7d2b
	fi
aa7d2b
fi
aa7d2b
exit 0
aa7d2b
aa7d2b
aa7d2b
%postun
aa7d2b
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
aa7d2b
sync
aa7d2b
exit 0
aa7d2b
aa7d2b
%else
aa7d2b
%description
aa7d2b
This is an empty kpatch-patch package which does not contain any real patches.
aa7d2b
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
aa7d2b
aa7d2b
%files
aa7d2b
%doc
aa7d2b
%endif
aa7d2b
aa7d2b
%changelog
df284a
* Fri Mar 04 2022 Yannick Cote <ycote@redhat.com> [1-2.el8_5]
df284a
- kernel: failing usercopy allows for use-after-free exploitation [2047620] {CVE-2022-22942}
df284a
- kernel: cgroups v1 release_agent feature may allow privilege escalation [2052187] {CVE-2022-0492}
df284a
- kernel: remote stack overflow via kernel panic on systems using TIPC may lead to DoS [2050135] {CVE-2022-0435}
df284a
- kernel: possible privileges escalation due to missing TLB flush [2044377] {CVE-2022-0330}
df284a
- kernel: local privilege escalation by exploiting the fsconfig syscall parameter leads to container breakout [2034618] {CVE-2021-4154}
df284a
- kernel: Use After Free in unix_gc() which could result in a local privilege escalation [2031991] {CVE-2021-0920}
df284a
970b9f
* Tue Jan 18 2022 Joe Lawrence <joe.lawrence@redhat.com> [1-1.el8_5]
970b9f
- kernel: fs_context: heap overflow in legacy parameter handling [2040593] {CVE-2022-0185}
970b9f
- kernel: xfs: raw block device data leak in XFS_IOC_ALLOCSP IOCTL [2034875] {CVE-2021-4155}
970b9f
aa7d2b
* Tue Dec 14 2021 Yannick Cote <ycote@redhat.com> [0-0.el8]
aa7d2b
- An empty patch to subscribe to kpatch stream for kernel-4.18.0-348.7.1.el8_5 [2032436]