chantra / rpms / libdnf

Forked from rpms/libdnf 2 years ago
Clone
Blob Blame History Raw
From 6c4f7462b3004e39e82c4ec186175ea4a56035b4 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Fri, 9 Aug 2019 09:54:49 +0200
Subject: [PATCH] hy_detect_arch(): detect crypto only on arm version >= 8

Before patch:
It detected armv7 with crypto extension on some "qemu-arm"
configurations. New architecture string "armv7hcnl" was generated.

After patch:
It detect crypto extension only if arm version >= 8.

https://bugzilla.redhat.com/show_bug.cgi?id=1691430

Closes: #771
Approved by: dmach
---
 libdnf/hy-util.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libdnf/hy-util.cpp b/libdnf/hy-util.cpp
index 61838cc36..f6de87d33 100644
--- a/libdnf/hy-util.cpp
+++ b/libdnf/hy-util.cpp
@@ -118,7 +118,8 @@ hy_detect_arch(char **arch)
             modifier++;
         if (getauxval(AT_HWCAP) & HWCAP_ARM_VFP)
             *modifier++ = 'h';
-        if (getauxval(AT_HWCAP2) & HWCAP2_AES)
+        // arm version >= 8 can have crypto extension
+        if ((atoi(un.machine+4) >= 8) && (getauxval(AT_HWCAP2) & HWCAP2_AES))
             *modifier++ = 'c';
         if (getauxval(AT_HWCAP) & HWCAP_ARM_NEON)
             *modifier++ = 'n';