diff -Nru util-linux-2.27.1/debian/changelog util-linux-2.27.1/debian/changelog --- util-linux-2.27.1/debian/changelog 2016-12-16 14:49:14.000000000 +0000 +++ util-linux-2.27.1/debian/changelog 2017-05-18 02:49:34.000000000 +0000 @@ -1,3 +1,10 @@ +util-linux (2.27.1-6ubuntu3.3) xenial; urgency=medium + + * Cherrypick upstream fix to prevent lscpu crash on arm64 by + accessing DMI in sysfs instead of /dev/mem. LP: #1674258 + + -- Ike Panhc Thu, 18 May 2017 10:49:34 +0800 + util-linux (2.27.1-6ubuntu3.2) xenial; urgency=medium * Cherrypick upstream fix to prevent segfaults in getopt by ensuring diff -Nru util-linux-2.27.1/debian/patches/lscpu-use-sysfs-for-tables-access-if-available.patch util-linux-2.27.1/debian/patches/lscpu-use-sysfs-for-tables-access-if-available.patch --- util-linux-2.27.1/debian/patches/lscpu-use-sysfs-for-tables-access-if-available.patch 1970-01-01 00:00:00.000000000 +0000 +++ util-linux-2.27.1/debian/patches/lscpu-use-sysfs-for-tables-access-if-available.patch 2017-05-18 02:43:35.000000000 +0000 @@ -0,0 +1,64 @@ +From 92a6392c41c11bcb49af9f129dfbd1fed651f044 Mon Sep 17 00:00:00 2001 +From: Ard Biesheuvel +Date: Wed, 12 Apr 2017 10:11:29 +0100 +Subject: lscpu: use sysfs for table access if available + +On ARM systems, accessing SMBIOS tables via /dev/mem using read() +calls is not supported. The reason is that such tables are usually +located in EFI_RUNTIME_SERVICE_DATA memory, which is not covered +by the linear mapping on those systems, and so read() calls will +fail. + +So instead, use the /sys/firmware/dmi/tables/DMI sysfs file, which +contains the entire structure table array, and will be available +on any recent Linux system, even on ones that only export the rev3 +SMBIOS entry point, which is currently ignored by lscpu. + +Note that the max 'num' value is inferred from the size. This is not +a limitation of the sysfs interface, but a limitation of the rev3 +entry point, which no longer carries a number of array elements. + +Signed-off-by: Ard Biesheuvel +Tested-by: Alexander Graf +Reviewed-by: Alexander Graf +--- + sys-utils/lscpu-dmi.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/sys-utils/lscpu-dmi.c b/sys-utils/lscpu-dmi.c +index 0e497d1..a8298ff 100644 +--- a/sys-utils/lscpu-dmi.c ++++ b/sys-utils/lscpu-dmi.c +@@ -192,6 +192,18 @@ static int hypervisor_decode_smbios(uint8_t *buf, const char *devmem) + devmem); + } + ++static int hypervisor_decode_sysfw(void) ++{ ++ static char const sys_fw_dmi_tables[] = "/sys/firmware/dmi/tables/DMI"; ++ struct stat st; ++ ++ if (stat(sys_fw_dmi_tables, &st)) ++ return -1; ++ ++ return hypervisor_from_dmi_table(0, st.st_size, st.st_size / 4, ++ sys_fw_dmi_tables); ++} ++ + /* + * Probe for EFI interface + */ +@@ -242,6 +254,10 @@ int read_hypervisor_dmi(void) + || '\0' != 0) + return rc; + ++ rc = hypervisor_decode_sysfw(); ++ if (rc >= 0) ++ return rc; ++ + /* First try EFI (ia64, Intel-based Mac) */ + switch (address_from_efi(&fp)) { + case EFI_NOT_FOUND: +-- +cgit v1.1 + diff -Nru util-linux-2.27.1/debian/patches/series util-linux-2.27.1/debian/patches/series --- util-linux-2.27.1/debian/patches/series 2016-12-16 14:48:50.000000000 +0000 +++ util-linux-2.27.1/debian/patches/series 2017-05-18 02:49:34.000000000 +0000 @@ -10,3 +10,4 @@ sulogin-lockedpwd.patch git_hybrid_cds.patch e1164591f7927402af8d73d340e75dbfeb06a288.patch +lscpu-use-sysfs-for-tables-access-if-available.patch