Blame SPECS/kpatch-patch.spec

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