Blame SPECS/kpatch-patch.spec

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