zstd rebuild

This commit is contained in:
Rmys
2022-06-07 23:52:33 +03:00
committed by GitHub
parent 7d36e8e1fe
commit c116c54229
3 changed files with 145 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
From cd7620a730413a48843e175d34dc408c152f8125 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 11 Jan 2022 07:28:25 -0800
Subject: [PATCH] x86-64: Enable Intel CET
Intel Control-flow Enforcement Technology (CET):
https://en.wikipedia.org/wiki/Control-flow_integrity#Intel_Control-flow_Enforcement_Technology
requires that on Linux, all linker input files are marked as CET enabled
in .note.gnu.property section. For high-level language source codes,
.note.gnu.property section is added by compiler with the -fcf-protection
option. For assembly sources, include <cet.h> to add .note.gnu.property
section.
---
lib/common/portability_macros.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lib/common/portability_macros.h b/lib/common/portability_macros.h
index 627ef9eed4..6ac4b05510 100644
--- a/lib/common/portability_macros.h
+++ b/lib/common/portability_macros.h
@@ -128,4 +128,15 @@
# define ZSTD_ENABLE_ASM_X86_64_BMI2 0
#endif
+/*
+ * For x86 ELF targets, add .note.gnu.property section for Intel CET in
+ * assembly sources when CET is enabled.
+ */
+#if defined(__ELF__) && (defined(__x86_64__) || defined(__i386__)) \
+ && defined(__has_include)
+# if __has_include(<cet.h>)
+# include <cet.h>
+# endif
+#endif
+
#endif /* ZSTD_PORTABILITY_MACROS_H */
@@ -0,0 +1,96 @@
Submitted By: Xi Ruoyao <xry111@linuxfromscratch.org>
Date: 2021-03-04
Initial Package Version: 1.5.2
Upstream Status: Applied
Origin: Upstream Git Repository
Description: Fix bad assertions causing test failure.
From 246982e782849d8646b2d5df6648319935669228 Mon Sep 17 00:00:00 2001
From: Nick Terrell <terrelln@fb.com>
Date: Thu, 20 Jan 2022 22:41:47 -0800
Subject: [PATCH] [dibio] Fix assertion triggered by no inputs
Passing 0 inputs to `DiB_shuffle()` caused an assertion failure where
it should just return.
A test is added in a later commit, with the initial introduction of the
new testing framework.
Fixes #3007.
---
programs/dibio.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/programs/dibio.c b/programs/dibio.c
index d19f954486..147d1e7bfd 100644
--- a/programs/dibio.c
+++ b/programs/dibio.c
@@ -27,9 +27,9 @@
#include <string.h> /* memset */
#include <stdio.h> /* fprintf, fopen, ftello64 */
#include <errno.h> /* errno */
-#include <assert.h>
#include "timefn.h" /* UTIL_time_t, UTIL_clockSpanMicro, UTIL_getTime */
+#include "../lib/common/debug.h" /* assert */
#include "../lib/common/mem.h" /* read */
#include "dibio.h"
@@ -193,7 +193,8 @@ static U32 DiB_rand(U32* src)
static void DiB_shuffle(const char** fileNamesTable, unsigned nbFiles) {
U32 seed = 0xFD2FB528;
unsigned i;
- assert(nbFiles >= 1);
+ if (nbFiles == 0)
+ return;
for (i = nbFiles - 1; i > 0; --i) {
unsigned const j = DiB_rand(&seed) % (i + 1);
const char* const tmp = fileNamesTable[j];
From d109cef2012b1e0ca7a6f47278a2838f68bbc196 Mon Sep 17 00:00:00 2001
From: Xi Ruoyao <xry111@mengyan1223.wang>
Date: Sat, 5 Mar 2022 03:56:44 +0800
Subject: [PATCH] fix the assertion in readLinesFromFile (#3084)
* fix the assertion in readLinesFromFile
When the file is not terminated by endline, readLineFromFile will append
a '\0' for the last line. In this case pos + lineLength == dstCapacity.
* test: don't print very long text garbage
---
programs/util.c | 2 +-
tests/playTests.sh | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/programs/util.c b/programs/util.c
index d69b72a37c..55bcff25af 100644
--- a/programs/util.c
+++ b/programs/util.c
@@ -418,7 +418,7 @@ readLinesFromFile(void* dst, size_t dstCapacity,
while ( !feof(inputFile) ) {
size_t const lineLength = readLineFromFile(buf+pos, dstCapacity-pos, inputFile);
if (lineLength == 0) break;
- assert(pos + lineLength < dstCapacity);
+ assert(pos + lineLength <= dstCapacity); /* '=' for inputFile not terminated with '\n' */
pos += lineLength;
++nbFiles;
}
diff --git a/tests/playTests.sh b/tests/playTests.sh
index 71e8dc0581..d4271b2f07 100755
--- a/tests/playTests.sh
+++ b/tests/playTests.sh
@@ -735,11 +735,11 @@ test -f tmp4
println "test : survive the list of files with too long filenames (--filelist=FILE)"
datagen -g5M > tmp_badList
-zstd -f --filelist=tmp_badList && die "should have failed : file name length is too long"
+zstd -qq -f --filelist=tmp_badList && die "should have failed : file name length is too long" # printing very long text garbage on console will cause CI failure
println "test : survive a list of files which is text garbage (--filelist=FILE)"
datagen > tmp_badList
-zstd -f --filelist=tmp_badList && die "should have failed : list is text garbage"
+zstd -qq -f --filelist=tmp_badList && die "should have failed : list is text garbage" # printing very long text garbage on console will cause CI failure
println "test : survive a list of files which is binary garbage (--filelist=FILE)"
datagen -P0 -g1M > tmp_badList
+11
View File
@@ -20,6 +20,10 @@
<Dependency versionFrom="1.2.12">zlib-devel</Dependency>
<Dependency>xz-devel</Dependency>
</BuildDependencies>
<Patches>
<Patch level="1">enable-CET.patch</Patch>
<Patch level="1">zstd-1.5.2-upstream_fixes-1.patch</Patch>
</Patches>
</Source>
<Package>
@@ -49,6 +53,13 @@
</Package>
<History>
<Update release="5">
<Date>2022-06-07</Date>
<Version>1.5.2</Version>
<Comment>Rebuild.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="4">
<Date>2022-05-05</Date>
<Version>1.5.2</Version>