diff --git a/ceph.spec b/ceph.spec index a35ca3f4a16975e240a3cfbee5a25298553a2bb5..958d3344eb434737ff38bdfd7b7ed42a350dcae2 100644 --- a/ceph.spec +++ b/ceph.spec @@ -68,7 +68,7 @@ ################################################################################# Name: ceph Version: 12.2.8 -Release: 12 +Release: 13 Epoch: 2 # define _epoch_prefix macro which will expand to the empty string if epoch is @@ -92,6 +92,9 @@ Patch5: 0005-CVE-2020-12059.patch Patch6: 0006-CVE-2020-25678-1.patch Patch7: 0007-CVE-2020-25678-2.patch +# backport for upstream +Patch6000: upstream-detect-armv8-crc-and-crypto-feature-using-CHECK_C_COMPILER_FLAG.patch + %if 0%{?suse_version} %if 0%{?is_opensuse} ExclusiveArch: x86_64 aarch64 ppc64 ppc64le @@ -1799,6 +1802,9 @@ exit 0 %changelog +* Tue Jul 06 2021 panchenbo - 1:12.2.8-13 +- detect armv8 crc and crypto feature using CHECK_C_COMPILER_FLAG + * Wed Mar 10 2021 Zhuohui Zou - 1:12.2.8-12 - fix CVE-2020-25678 diff --git a/upstream-detect-armv8-crc-and-crypto-feature-using-CHECK_C_COMPILER_FLAG.patch b/upstream-detect-armv8-crc-and-crypto-feature-using-CHECK_C_COMPILER_FLAG.patch new file mode 100644 index 0000000000000000000000000000000000000000..636a1df3c66e8208157080947c110ee3dcd83c1f --- /dev/null +++ b/upstream-detect-armv8-crc-and-crypto-feature-using-CHECK_C_COMPILER_FLAG.patch @@ -0,0 +1,95 @@ +From 110d9aac4b88101aabfb1ebb3f72f824e0cbe67e Mon Sep 17 00:00:00 2001 +From: Kefu Chai +Date: Wed, 19 Sep 2018 14:17:38 +0800 +Subject: [PATCH] cmake: detect armv8 crc and crypto feature using + CHECK_C_COMPILER_FLAG + +we are using GCC7 and up for C++17 support since mimic, and per +https://gcc.gnu.org/onlinedocs/gcc-4.9.1/gcc/AArch64-Options.html , +GCC 4.9 and up should be able to support crc and crypto features if +these archs are enabled at GCC's configure-time. so we should always use +the -march for detecting the compiler's support instead of using the +inline assembly now. + +GCC 4.8 is an ancient compiler, and per +https://gcc.gnu.org/gcc-4.8/changes.html, it was the the first GCC +release which offers AArch64 support. so we don't need to cater for +this GCC version. and we can trust GCC-7 and up. + +Fixes: http://tracker.ceph.com/issues/17516 +Signed-off-by: Kefu Chai +(cherry picked from commit 010edc0f1d9c3f8a7021ecebc635bd8f51271ac3) +--- + cmake/modules/SIMDExt.cmake | 54 +++++++++---------------------------- + 1 file changed, 13 insertions(+), 41 deletions(-) + +diff --git a/cmake/modules/SIMDExt.cmake b/cmake/modules/SIMDExt.cmake +index 5330835aa16..90534386ece 100644 +--- a/cmake/modules/SIMDExt.cmake ++++ b/cmake/modules/SIMDExt.cmake +@@ -16,49 +16,21 @@ + + if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64") + set(HAVE_ARM 1) +- set(save_quiet ${CMAKE_REQUIRED_QUIET}) +- set(CMAKE_REQUIRED_QUIET true) +- include(CheckCXXSourceCompiles) +- +- check_cxx_source_compiles(" +- #define CRC32CX(crc, value) __asm__(\"crc32cx %w[c], %w[c], %x[v]\":[c]\"+r\"(crc):[v]\"r\"(value)) +- asm(\".arch_extension crc\"); +- unsigned int foo(unsigned int ret) { +- CRC32CX(ret, 0); +- return ret; +- } +- int main() { foo(0); }" HAVE_ARMV8_CRC) +- check_cxx_source_compiles(" +- asm(\".arch_extension crypto\"); +- unsigned int foo(unsigned int ret) { +- __asm__(\"pmull v2.1q, v2.1d, v1.1d\"); +- return ret; +- } +- int main() { foo(0); }" HAVE_ARMV8_CRYPTO) +- +- set(CMAKE_REQUIRED_QUIET ${save_quiet}) +- if(HAVE_ARMV8_CRC) +- message(STATUS " aarch64 crc extensions supported") +- endif() +- +- if(HAVE_ARMV8_CRYPTO) +- message(STATUS " aarch64 crypto extensions supported") +- endif() +- CHECK_C_COMPILER_FLAG(-march=armv8-a+crc+crypto HAVE_ARMV8_CRC_CRYPTO_MARCH) +- +- # don't believe only the -march support; gcc 4.8.5 on RHEL/CentOS says +- # it supports +crc but hasn't got the intrinsics or arm_acle.h. Test for +- # the actual presence of one of the intrinsic functions. +- if(HAVE_ARMV8_CRC_CRYPTO_MARCH) +- check_cxx_source_compiles(" +- #include +- int main() { uint32_t a; uint8_t b; __builtin_aarch64_crc32b(a, b); } +- " HAVE_ARMV8_CRC_CRYPTO_INTRINSICS) +- endif() ++ include(CheckCCompilerFlag) + ++ check_c_compiler_flag(-march=armv8-a+crc+crypto HAVE_ARMV8_CRC_CRYPTO_INTRINSICS) + if(HAVE_ARMV8_CRC_CRYPTO_INTRINSICS) +- message(STATUS " aarch64 crc+crypto intrinsics supported") +- set(ARMV8_CRC_COMPILE_FLAGS "${ARMV8_CRC_COMPILE_FLAGS} -march=armv8-a+crc+crypto") ++ set(ARMV8_CRC_COMPILE_FLAGS "-march=armv8-a+crc+crypto") ++ set(HAVE_ARMV8_CRC TRUE) ++ set(HAVE_ARMV8_CRYPTO TRUE) ++ else() ++ check_c_compiler_flag(-march=armv8-a+crc HAVE_ARMV8_CRC) ++ check_c_compiler_flag(-march=armv8-a+crypto HAVE_ARMV8_CRYPTO) ++ if(HAVE_ARMV8_CRC) ++ set(ARMV8_CRC_COMPILE_FLAGS "-march=armv8-a+crc") ++ elseif(HAVE_ARMV8_CRYPTO) ++ set(ARMV8_CRC_COMPILE_FLAGS "-march=armv8-a+crypto") ++ endif() + endif() + + CHECK_C_COMPILER_FLAG(-march=armv8-a+simd HAVE_ARMV8_SIMD) +-- +2.20.1 +