Enable Intel CET in i686

Resolves: #1910368
This commit is contained in:
Ondrej Dubaj 2021-01-04 09:17:14 +01:00
parent 61772e8d9a
commit a1cb606d82
2 changed files with 77 additions and 2 deletions

70
xz-5.2.5-enable_CET.patch Normal file
View File

@ -0,0 +1,70 @@
From: H.J. Lu <hjl.tools@gmail.com>
Date: Wed, 23 Dec 2020 15:49:04 +0100 (06:49 -0800)
Subject: [PATCH] liblzma: Enable Intel CET in x86 CRC assembly codes
When Intel CET is enabled, we need to include <cet.h> in assembly codes
to mark Intel CET support and add _CET_ENDBR to indirect jump targets.
Tested on Intel Tiger Lake under CET enabled Linux.
---
src/liblzma/check/crc32_x86.S | 9 +++++++++
src/liblzma/check/crc64_x86.S | 9 +++++++++
2 files changed, 18 insertions(+)
diff --git a/src/liblzma/check/crc32_x86.S b/src/liblzma/check/crc32_x86.S
index 67f68a4..e3745e6 100644
--- a/src/liblzma/check/crc32_x86.S
+++ b/src/liblzma/check/crc32_x86.S
@@ -51,6 +51,14 @@ init_table(void)
* extern uint32_t lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc);
*/
+/* When Intel CET is enabled, include <cet.h> in assembly code to mark
+ Intel CET support. */
+#ifdef __CET__
+# include <cet.h>
+#else
+# define _CET_ENDBR
+#endif
+
/*
* On some systems, the functions need to be prefixed. The prefix is
* usually an underscore.
@@ -83,6 +91,7 @@ init_table(void)
ALIGN(4, 16)
LZMA_CRC32:
+ _CET_ENDBR
/*
* Register usage:
* %eax crc
diff --git a/src/liblzma/check/crc64_x86.S b/src/liblzma/check/crc64_x86.S
index f5bb84b..7ee08f6 100644
--- a/src/liblzma/check/crc64_x86.S
+++ b/src/liblzma/check/crc64_x86.S
@@ -41,6 +41,14 @@ init_table(void)
* extern uint64_t lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc);
*/
+/* When Intel CET is enabled, include <cet.h> in assembly code to mark
+ Intel CET support. */
+#ifdef __CET__
+# include <cet.h>
+#else
+# define _CET_ENDBR
+#endif
+
/*
* On some systems, the functions need to be prefixed. The prefix is
* usually an underscore.
@@ -73,6 +81,7 @@ init_table(void)
ALIGN(4, 16)
LZMA_CRC64:
+ _CET_ENDBR
/*
* Register usage:
* %eax crc LSB
--
2.26.0

View File

@ -4,7 +4,7 @@
Summary: LZMA compression utilities
Name: xz
Version: 5.2.5
Release: 3%{?dist}
Release: 4%{?dist}
# Scripts xz{grep,diff,less,more} and symlinks (copied from gzip) are
# GPLv2+, binaries are Public Domain (linked against LGPL getopt_long but its
@ -16,6 +16,8 @@ Source0: http://tukaani.org/%{name}/%{name}-%{version}.tar.xz
Source100: colorxzgrep.sh
Source101: colorxzgrep.csh
Patch1: xz-5.2.5-enable_CET.patch
URL: http://tukaani.org/%{name}/
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
@ -80,7 +82,7 @@ commands that deal with the older LZMA format.
%prep
%autosetup
%autosetup -p1
%build
@ -157,6 +159,9 @@ LD_LIBRARY_PATH=$PWD/src/liblzma/.libs make check
%changelog
* Mon Mar 30 2020 Ondrej Dubaj <odubaj@redhat.com> - 5.2.5-4
- Enabled CET for i686 (#1910368)
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild