Blame SPECS/kpatch-patch.spec

a8eee5
# Set to 1 if building an empty subscription-only package.
263871
%define empty_package		0
a8eee5
a8eee5
#######################################################
a8eee5
# Only need to update these variables and the changelog
a8eee5
%define kernel_ver	3.10.0-1160.42.2.el7
a8eee5
%define kpatch_ver	0.9.2
263871
%define rpm_ver		1
1d4ef1
%define rpm_rel		6
a8eee5
a8eee5
%if !%{empty_package}
a8eee5
# Patch sources below. DO NOT REMOVE THIS LINE.
263871
#
263871
# https://bugzilla.redhat.com/1975766
263871
Source100: CVE-2021-22543.patch
263871
#
263871
# https://bugzilla.redhat.com/1988221
263871
Source101: CVE-2021-37576.patch
229b89
#
229b89
# https://bugzilla.redhat.com/1981703
229b89
Source102: CVE-2020-36385.patch
57a3d0
#
57a3d0
# https://bugzilla.redhat.com/2034878
57a3d0
Source103: CVE-2021-4155.patch
57a3d0
#
57a3d0
# https://bugzilla.redhat.com/2031986
57a3d0
Source104: CVE-2021-0920.patch
57a3d0
#
57a3d0
# https://bugzilla.redhat.com/2042766
57a3d0
Source105: CVE-2020-0466.patch
57a3d0
#
57a3d0
# https://bugzilla.redhat.com/2044373
57a3d0
Source106: CVE-2022-0330.patch
57a3d0
#
57a3d0
# https://bugzilla.redhat.com/2047616
57a3d0
Source107: CVE-2022-22942.patch
3283a7
#
3283a7
# https://bugzilla.redhat.com/2033360
3283a7
Source108: CVE-2021-4028.patch
3283a7
#
3283a7
# https://bugzilla.redhat.com/2032491
3283a7
Source109: CVE-2021-4083.patch
d0bf3c
#
d0bf3c
# https://bugzilla.redhat.com/2052183
d0bf3c
Source110: CVE-2022-0492.patch
1d4ef1
#
1d4ef1
# https://bugzilla.redhat.com/2093010
1d4ef1
Source111: CVE-2022-1966.patch
a8eee5
# End of patch sources. DO NOT REMOVE THIS LINE.
a8eee5
%endif
a8eee5
a8eee5
%define sanitized_rpm_rel	%{lua: print((string.gsub(rpm.expand("%rpm_rel"), "%.", "_")))}
a8eee5
%define sanitized_kernel_ver	%{lua: print((string.gsub(string.gsub(rpm.expand("%kernel_ver"), ".el7", ""), "%.", "_")))}
a8eee5
%define kernel_ver_arch	%{kernel_ver}.%{_arch}
a8eee5
a8eee5
Name:		kpatch-patch-%{sanitized_kernel_ver}
a8eee5
Version:	%{rpm_ver}
a8eee5
Release:	%{rpm_rel}.el7
a8eee5
a8eee5
%if %{empty_package}
a8eee5
Summary:	Initial empty kpatch-patch for kernel-%{kernel_ver_arch}
a8eee5
%else
a8eee5
Summary:	Live kernel patching module for kernel-%{kernel_ver_arch}
a8eee5
%endif
a8eee5
a8eee5
Group:		System Environment/Kernel
a8eee5
License:	GPLv2
a8eee5
ExclusiveArch:	x86_64 ppc64le
a8eee5
a8eee5
Conflicts:	%{name} < %{version}-%{release}
a8eee5
a8eee5
Provides:	kpatch-patch = %{kernel_ver_arch}
a8eee5
Provides:	kpatch-patch = %{kernel_ver}
a8eee5
a8eee5
%if !%{empty_package}
a8eee5
Requires:	systemd
a8eee5
%endif
a8eee5
Requires:	kpatch >= 0.4.0-3
a8eee5
Requires:	kernel-uname-r = %{kernel_ver_arch}
a8eee5
a8eee5
%if !%{empty_package}
a8eee5
BuildRequires:	gcc elfutils-devel rpmdevtools asciidoc bc hmaccalc m4 net-tools xmlto zlib-devel binutils-devel newt-devel python-devel perl(ExtUtils::Embed) bison audit-libs-devel numactl-devel pciutils-devel openssl gettext kernel-devel ncurses-devel hostname java-devel python-docutils
a8eee5
BuildRequires:	kernel-devel = %{kernel_ver}
a8eee5
BuildRequires:	kernel-debuginfo = %{kernel_ver}
a8eee5
a8eee5
%ifarch x86_64
a8eee5
BuildRequires: pesign
a8eee5
%endif
a8eee5
a8eee5
%ifarch ppc64le
a8eee5
BuildRequires: gcc-plugin-devel
a8eee5
%endif
a8eee5
a8eee5
Source0:	https://github.com/dynup/kpatch/archive/v%{kpatch_ver}.tar.gz
a8eee5
a8eee5
Source10:	kernel-%{kernel_ver}.src.rpm
a8eee5
a8eee5
# kpatch-build patches
a8eee5
# Patch1: backport.patch
a8eee5
a8eee5
%global _dupsign_opts --keyname=rhelkpatch1
a8eee5
a8eee5
%define builddir	%{_builddir}/kpatch-%{kpatch_ver}
a8eee5
%define kpatch		%{_sbindir}/kpatch
a8eee5
%define kmoddir		%{_usr}/lib/kpatch/%{kernel_ver_arch}
a8eee5
%define patchmodname	kpatch-%{sanitized_kernel_ver}-%{version}-%{sanitized_rpm_rel}
a8eee5
%define patchmod	%{patchmodname}.ko
a8eee5
a8eee5
%define _missing_build_ids_terminate_build 1
a8eee5
%define _find_debuginfo_opts -r
a8eee5
%undefine _include_minidebuginfo
a8eee5
%undefine _find_debuginfo_dwz_opts
a8eee5
a8eee5
%description
a8eee5
This is a kernel live patch module which can be loaded by the kpatch
a8eee5
command line utility to modify the code of a running kernel.  This patch
a8eee5
module is targeted for kernel-%{kernel_ver}.
a8eee5
a8eee5
%prep
a8eee5
%autosetup -n kpatch-%{kpatch_ver} -p1
a8eee5
a8eee5
%build
a8eee5
kdevdir=/usr/src/kernels/%{kernel_ver_arch}
a8eee5
vmlinux=/usr/lib/debug/lib/modules/%{kernel_ver_arch}/vmlinux
a8eee5
a8eee5
# kpatch-build
a8eee5
make -C kpatch-build
a8eee5
a8eee5
# patch module
a8eee5
for i in %{sources}; do
a8eee5
	[[ $i == *.patch ]] && patch_sources="$patch_sources $i"
a8eee5
done
a8eee5
export CACHEDIR="%{builddir}/.kpatch"
a8eee5
kpatch-build/kpatch-build -n %{patchmodname} -r %{SOURCE10} -v $vmlinux --skip-cleanup $patch_sources || { cat "${CACHEDIR}/build.log"; exit 1; }
a8eee5
a8eee5
a8eee5
%install
a8eee5
installdir=%{buildroot}/%{kmoddir}
a8eee5
install -d $installdir
a8eee5
install -m 755 %{builddir}/%{patchmod} $installdir
a8eee5
a8eee5
a8eee5
%files
a8eee5
%{_usr}/lib/kpatch
a8eee5
a8eee5
a8eee5
%post
a8eee5
if [[ %{kernel_ver_arch} = $(uname -r) ]]; then
a8eee5
	cver="%{rpm_ver}_%{rpm_rel}"
a8eee5
	pname=$(echo "kpatch_%{sanitized_kernel_ver}" | sed 's/-/_/')
a8eee5
a8eee5
	lver=$({ %{kpatch} list | sed -nr "s/^${pname}_([0-9_]+)\ \[enabled\]$/\1/p"; echo "${cver}"; } | sort -V | tail -1)
a8eee5
a8eee5
	if [ "${lver}" != "${cver}" ]; then
a8eee5
		echo "WARNING: at least one loaded kpatch-patch (${pname}_${lver}) has a newer version than the one being installed."
a8eee5
		echo "WARNING: You will have to reboot to load a downgraded kpatch-patch"
a8eee5
	else
a8eee5
		%{kpatch} load %{kmoddir}/%{patchmod}
a8eee5
	fi
a8eee5
fi
a8eee5
%{kpatch} install -k %{kernel_ver_arch} %{kmoddir}/%{patchmod}
a8eee5
sync
a8eee5
exit 0
a8eee5
a8eee5
a8eee5
%postun
a8eee5
%{kpatch} uninstall -k %{kernel_ver_arch} %{patchmod}
a8eee5
sync
a8eee5
exit 0
a8eee5
a8eee5
%else
a8eee5
%description
a8eee5
This is an empty kpatch-patch package which does not contain any real patches.
a8eee5
It is only a method to subscribe to the kpatch stream for kernel-%{kernel_ver}.
a8eee5
a8eee5
%files
a8eee5
%doc
a8eee5
%endif
a8eee5
a8eee5
%changelog
1d4ef1
* Fri Jun 17 2022 Yannick Cote <ycote@redhat.com> [1-6.el7]
1d4ef1
- kernel: a use-after-free write in the netfilter subsystem can lead to privilege escalation to root [2093010] {CVE-2022-1966}
1d4ef1
d0bf3c
* Thu May 12 2022 Joe Lawrence <joe.lawrence@redhat.com> [1-5.el7]
d0bf3c
- kernel: cgroups v1 release_agent feature may allow privilege escalation [2052183] {CVE-2022-0492}
d0bf3c
3283a7
* Thu Mar 24 2022 Joe Lawrence <joe.lawrence@redhat.com> [1-4.el7]
3283a7
- kernel: fget: check that the fd still exists after getting a ref to it [2032491] {CVE-2021-4083}
3283a7
- kernel: use-after-free in RDMA listen() [2033360] {CVE-2021-4028}
3283a7
57a3d0
* Fri Feb 11 2022 Joe Lawrence <joe.lawrence@redhat.com> [1-3.el7]
57a3d0
- kernel: failing usercopy allows for use-after-free exploitation [2047616] {CVE-2022-22942}
57a3d0
- kernel: possible privileges escalation due to missing TLB flush [2044373] {CVE-2022-0330}
57a3d0
- kernel: use after free in eventpoll.c may lead to escalation of privilege [2042766] {CVE-2020-0466}
57a3d0
- kernel: Use After Free in unix_gc() which could result in a local privilege escalation [2031986] {CVE-2021-0920}
57a3d0
- kernel: xfs: raw block device data leak in XFS_IOC_ALLOCSP IOCTL [2034878] {CVE-2021-4155}
57a3d0
229b89
* Fri Nov 12 2021 Joe Lawrence <joe.lawrence@redhat.com> [1-2.el7]
229b89
- kernel: use-after-free in drivers/infiniband/core/ucma.c ctx use-after-free [1981703] {CVE-2020-36385}
229b89
263871
* Wed Sep 29 2021 Joe Lawrence <joe.lawrence@redhat.com> [1-1.el7]
263871
- kernel: powerpc: KVM guest OS users can cause host OS memory corruption [1988221] {CVE-2021-37576}
263871
- kernel: Improper handling of VM_IO|VM_PFNMAP vmas in KVM can bypass RO checks [1975766] {CVE-2021-22543}
263871
a8eee5
* Thu Sep 02 2021 Joe Lawrence <joe.lawrence@redhat.com> [0-0.el7]
a8eee5
- An empty patch to subscribe to kpatch stream for kernel-3.10.0-1160.42.2.el7 [2000547]