Package: librocksdb6.11 Version: 6.11.4-3 Followup-For: Bug #1015224 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Attached is a possible debdiff. - -- System Information: Debian Release: bookworm/sid APT prefers unstable-debug APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'stable-security'), (500, 'stable-debug'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 5.18.0-4-amd64 (SMP w/8 CPU threads; PREEMPT) Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages librocksdb6.11 depends on: ii libbz2-1.0 1.0.8-5 ii libc6 2.34-4 ii libgcc-s1 12.1.0-8 pn libgflags2.2 <none> ii liblz4-1 1.9.3-2 ii libsnappy1v5 1.1.9-2 ii libstdc++6 12.1.0-8 ii libzstd1 1.5.2+dfsg-1 ii zlib1g 1:1.2.11.dfsg-4.1 librocksdb6.11 recommends no packages. librocksdb6.11 suggests no packages. -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEvu1N7VVEpMA+KD3HS80FZ8KW0F0FAmMDoyQACgkQS80FZ8KW 0F007w//dKCqzbe+82TIHobnj18BEq0ilHiTwkh6vkP7pFEsJJE/fqrOzQfgaAV/ 77jGf8sZDDn0tpetdAvIGXuQFRQqjNlahNLCepX40sxfUpLl04wlMhs5PnQw4hX3 +NK6k3KTWR2k+ViAGL6VeAzmVuqe5l7BcWluf6y3tQbTYNCIWy+qmcybshR/Azn3 j0e/xHoJA9PQ3r3+WFsElXw1Cm8mqHSKq5XMld4cMYlq6S9BZxNBlQ5Lzk7lPILA Q44aTcKCAjAGUW9pRYZCvcRca9LGoIWckWTvmSvEyjodbqJwXgFAp4Z794o2UIp4 MYnYvVGEn/LmHhi0TrPTiFvyH3K3Zs+Du1ZDMZwE+Sdl7DDiPvvXRa5Qo4j/16jw qMp3MDL4CQc82nNWKHqZ8uh1rGz8EMyAAlkj/DoM21ygrQ04ZhexyrT8bBWXjBcm 1I3bADg97GoxQLA5b8pycgKTKGqM1U/SxnMVzocacbOOaOdeskiCKTtg5PJJM4Zt 9qz90H6tyXbNn9NnofRgfiok70dItamDSKsYWavaAsp3wO4ikoydc3guKIzasTJp l+BNqUPmnym7fI90r93LFvxlxhTTYnzoJ+98Rkp8WzMRXRUfIaxPF0ls8k6W7ZZP CCFRNJdm8T5fECoXf0eURwpKyGxtqy2VON7J34FRaFdBieACUqk= =U1bp -----END PGP SIGNATURE-----
diff -Nru rocksdb-6.11.4/debian/changelog rocksdb-6.11.4/debian/changelog --- rocksdb-6.11.4/debian/changelog 2020-12-10 17:13:16.000000000 +0000 +++ rocksdb-6.11.4/debian/changelog 2022-07-18 21:51:17.000000000 +0000 @@ -1,3 +1,10 @@ +rocksdb (6.11.4-3.1) bullseye; urgency=medium + + * Non-maintainer upload. + * Fix illegal instruction (closes: #1015224). + + -- Daniel Leidert <dleid...@amdahl.debian.org> Mon, 18 Jul 2022 21:51:17 +0000 + rocksdb (6.11.4-3) unstable; urgency=medium * Explicitly link shared library with dynamic linking library diff -Nru rocksdb-6.11.4/debian/patches/fix_illegal_instruction.patch rocksdb-6.11.4/debian/patches/fix_illegal_instruction.patch --- rocksdb-6.11.4/debian/patches/fix_illegal_instruction.patch 1970-01-01 00:00:00.000000000 +0000 +++ rocksdb-6.11.4/debian/patches/fix_illegal_instruction.patch 2022-07-18 21:48:42.000000000 +0000 @@ -0,0 +1,225 @@ +From 29f7bbef995bdf83098963799c66af742e95373f Mon Sep 17 00:00:00 2001 +From: Yuqi Gu <yuqi...@arm.com> +Date: Tue, 22 Sep 2020 10:39:54 -0700 +Subject: [PATCH] Fix RocksDB SIGILL error on Raspberry PI 4 (#7233) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Summary: +Issue:https://github.com/facebook/rocksdb/issues/7042 + +No PMULL runtime check will lead to SIGILL on a Raspberry pi 4. + +Leverage 'getauxval' to get Hardware-Cap to detect whether target +platform does support PMULL or not in runtime. + +Consider the condition that the target platform does support crc32 but not support PMULL. +In this condition, the code should leverage the crc32 instruction +rather than skip all hardware crc32 instruction. + +Pull Request resolved: https://github.com/facebook/rocksdb/pull/7233 + +Reviewed By: jay-zhuang + +Differential Revision: D23790116 + +fbshipit-source-id: a3ebd821fbd4a38dd2f59064adbb7c3013ee8140 +--- + util/crc32c.cc | 6 +++ + util/crc32c_arm64.cc | 111 ++++++++++++++++++++++++++----------------- + util/crc32c_arm64.h | 1 + + 3 files changed, 74 insertions(+), 44 deletions(-) + +Index: rocksdb-6.11.4/util/crc32c.cc +=================================================================== +--- rocksdb-6.11.4.orig/util/crc32c.cc ++++ rocksdb-6.11.4/util/crc32c.cc +@@ -41,6 +41,10 @@ + + #endif + ++#if defined(__linux__) && defined(HAVE_ARM64_CRC) ++bool pmull_runtime_flag = false; ++#endif ++ + namespace ROCKSDB_NAMESPACE { + namespace crc32c { + +@@ -494,6 +498,7 @@ std::string IsFastCrc32Supported() { + if (crc32c_runtime_check()) { + has_fast_crc = true; + arch = "Arm64"; ++ pmull_runtime_flag = crc32c_pmull_runtime_check(); + } else { + has_fast_crc = false; + arch = "Arm64"; +@@ -1224,6 +1229,7 @@ static inline Function Choose_Extend() { + return isAltiVec() ? ExtendPPCImpl : ExtendImpl<Slow_CRC32>; + #elif defined(__linux__) && defined(HAVE_ARM64_CRC) + if(crc32c_runtime_check()) { ++ pmull_runtime_flag = crc32c_pmull_runtime_check(); + return ExtendARMImpl; + } else { + return ExtendImpl<Slow_CRC32>; +Index: rocksdb-6.11.4/util/crc32c_arm64.cc +=================================================================== +--- rocksdb-6.11.4.orig/util/crc32c_arm64.cc ++++ rocksdb-6.11.4/util/crc32c_arm64.cc +@@ -14,6 +14,9 @@ + #ifndef HWCAP_CRC32 + #define HWCAP_CRC32 (1 << 7) + #endif ++#ifndef HWCAP_PMULL ++#define HWCAP_PMULL (1 << 4) ++#endif + + #ifdef HAVE_ARM64_CRYPTO + /* unfolding to compute 8 * 3 = 24 bytes parallelly */ +@@ -35,6 +38,8 @@ + } while (0) + #endif + ++extern bool pmull_runtime_flag; ++ + uint32_t crc32c_runtime_check(void) { + #ifdef ROCKSDB_AUXV_GETAUXVAL_PRESENT + uint64_t auxv = getauxval(AT_HWCAP); +@@ -44,6 +49,15 @@ uint32_t crc32c_runtime_check(void) { + #endif + } + ++bool crc32c_pmull_runtime_check(void) { ++#ifdef ROCKSDB_AUXV_GETAUXVAL_PRESENT ++ uint64_t auxv = getauxval(AT_HWCAP); ++ return (auxv & HWCAP_PMULL) != 0; ++#else ++ return false; ++#endif ++} ++ + #ifdef ROCKSDB_UBSAN_RUN + #if defined(__clang__) + __attribute__((__no_sanitize__("alignment"))) +@@ -58,6 +72,13 @@ uint32_t crc32c_arm64(uint32_t crc, unsi + int length = (int)len; + crc ^= 0xffffffff; + ++ /* ++ * Pmull runtime check here. ++ * Raspberry Pi supports crc32 but doesn't support pmull. ++ * Skip Crc32c Parallel computation if no crypto extension available. ++ */ ++ if (pmull_runtime_flag) { ++/* Macro (HAVE_ARM64_CRYPTO) is used for compiling check */ + #ifdef HAVE_ARM64_CRYPTO + /* Crc32c Parallel computation + * Algorithm comes from Intel whitepaper: +@@ -68,51 +89,53 @@ uint32_t crc32c_arm64(uint32_t crc, unsi + * One Block: 42(BLK_LENGTH) * 8(step length: crc32c_u64) bytes + */ + #define BLK_LENGTH 42 +- while (length >= 1024) { +- uint64_t t0, t1; +- uint32_t crc0 = 0, crc1 = 0, crc2 = 0; +- +- /* Parallel Param: +- * k0 = CRC32(x ^ (42 * 8 * 8 * 2 - 1)); +- * k1 = CRC32(x ^ (42 * 8 * 8 - 1)); +- */ +- uint32_t k0 = 0xe417f38a, k1 = 0x8f158014; +- +- /* Prefetch data for following block to avoid cache miss */ +- PREF1KL1((uint8_t *)buf64, 1024); +- +- /* First 8 byte for better pipelining */ +- crc0 = crc32c_u64(crc, *buf64++); +- +- /* 3 blocks crc32c parallel computation +- * Macro unfolding to compute parallelly +- * 168 * 6 = 1008 (bytes) +- */ +- CRC32C7X24BYTES(0); +- CRC32C7X24BYTES(1); +- CRC32C7X24BYTES(2); +- CRC32C7X24BYTES(3); +- CRC32C7X24BYTES(4); +- CRC32C7X24BYTES(5); +- buf64 += (BLK_LENGTH * 3); +- +- /* Last 8 bytes */ +- crc = crc32c_u64(crc2, *buf64++); +- +- t0 = (uint64_t)vmull_p64(crc0, k0); +- t1 = (uint64_t)vmull_p64(crc1, k1); +- +- /* Merge (crc0, crc1, crc2) -> crc */ +- crc1 = crc32c_u64(0, t1); +- crc ^= crc1; +- crc0 = crc32c_u64(0, t0); +- crc ^= crc0; ++ while (length >= 1024) { ++ uint64_t t0, t1; ++ uint32_t crc0 = 0, crc1 = 0, crc2 = 0; ++ ++ /* Parallel Param: ++ * k0 = CRC32(x ^ (42 * 8 * 8 * 2 - 1)); ++ * k1 = CRC32(x ^ (42 * 8 * 8 - 1)); ++ */ ++ uint32_t k0 = 0xe417f38a, k1 = 0x8f158014; ++ ++ /* Prefetch data for following block to avoid cache miss */ ++ PREF1KL1((uint8_t *)buf64, 1024); ++ ++ /* First 8 byte for better pipelining */ ++ crc0 = crc32c_u64(crc, *buf64++); ++ ++ /* 3 blocks crc32c parallel computation ++ * Macro unfolding to compute parallelly ++ * 168 * 6 = 1008 (bytes) ++ */ ++ CRC32C7X24BYTES(0); ++ CRC32C7X24BYTES(1); ++ CRC32C7X24BYTES(2); ++ CRC32C7X24BYTES(3); ++ CRC32C7X24BYTES(4); ++ CRC32C7X24BYTES(5); ++ buf64 += (BLK_LENGTH * 3); ++ ++ /* Last 8 bytes */ ++ crc = crc32c_u64(crc2, *buf64++); ++ ++ t0 = (uint64_t)vmull_p64(crc0, k0); ++ t1 = (uint64_t)vmull_p64(crc1, k1); ++ ++ /* Merge (crc0, crc1, crc2) -> crc */ ++ crc1 = crc32c_u64(0, t1); ++ crc ^= crc1; ++ crc0 = crc32c_u64(0, t0); ++ crc ^= crc0; + +- length -= 1024; +- } ++ length -= 1024; ++ } + +- if (length == 0) return crc ^ (0xffffffffU); ++ if (length == 0) return crc ^ (0xffffffffU); + #endif ++ } // if Pmull runtime check here ++ + buf8 = (const uint8_t *)buf64; + while (length >= 8) { + crc = crc32c_u64(crc, *(const uint64_t *)buf8); +Index: rocksdb-6.11.4/util/crc32c_arm64.h +=================================================================== +--- rocksdb-6.11.4.orig/util/crc32c_arm64.h ++++ rocksdb-6.11.4/util/crc32c_arm64.h +@@ -35,6 +35,7 @@ + + extern uint32_t crc32c_arm64(uint32_t crc, unsigned char const *data, unsigned len); + extern uint32_t crc32c_runtime_check(void); ++extern bool crc32c_pmull_runtime_check(void); + + #ifdef __ARM_FEATURE_CRYPTO + #define HAVE_ARM64_CRYPTO diff -Nru rocksdb-6.11.4/debian/patches/series rocksdb-6.11.4/debian/patches/series --- rocksdb-6.11.4/debian/patches/series 2020-12-10 01:15:09.000000000 +0000 +++ rocksdb-6.11.4/debian/patches/series 2022-07-18 21:49:07.000000000 +0000 @@ -3,3 +3,4 @@ verbose_build.patch fix_db_test.patch link_with_dl.patch +fix_illegal_instruction.patch