> Reading illegal memory should not crash the system I think this depends on what the memory is.
I agree 100% for any application-level memory (stuff from regular APIs like sbrk() or mmap() etc.). In this case, the application opens /dev/mem, which allows it to access arbitrary physical memory without restriction. It assumes that a certain physical memory region can be accessed (the DMI region) and does so. The HW triggers an SError in this case since no device exists at that location in memory, since this platform doesn't support DMI. This is correct HW response to the request. The solution is to prevent SW from accessing this location. This issue happens identically if you were to use an upstream kernel (which does support the HW), or the Ubuntu kernel (assuming it supports this HW model). Whether this SW access prevention is implemented in the kernel or the application may be open for debate. I believe the definition of the /dev/mem device is such that it does not intend to filter addresses to prevent applications from accessing invalid HW. As such, I believe it's up to the application to fix the issue; it should determine whether the platform supports DMI before explicitly using low-level primitives (/dev/mem) to attempt to access it. -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to dmidecode in Ubuntu. https://bugs.launchpad.net/bugs/1821632 Title: dmidecode causing system crash Status in dmidecode package in Ubuntu: Confirmed Bug description: Please let me know what other information I can provide. Some basic info I've captured below. root@jetson-0423318029481:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic root@jetson-0423318029481:~# uname -a Linux jetson-0423318029481 4.9.108-tegra #1 SMP PREEMPT Wed Oct 31 15:17:21 PDT 2018 aarch64 aarch64 aarch64 GNU/Linux root@jetson-0423318029481:~# apt-cache madison dmidecode dmidecode | 3.1-1 | http://ports.ubuntu.com/ubuntu-ports bionic/main arm64 Packages root@jetson-0423318029481:~# dmidecode -V 3.1 root@jetson-0423318029481:~# strace dmidecode execve("/usr/sbin/dmidecode", ["dmidecode"], 0x7fdc753060 /* 15 vars */) = 0 brk(NULL) = 0x559651a000 faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=130516, ...}) = 0 mmap(NULL, 130516, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f804c2000 close(3) = 0 faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0 \10\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1341080, ...}) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8050a000 mmap(NULL, 1409880, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f80369000 mprotect(0x7f804a9000, 61440, PROT_NONE) = 0 mmap(0x7f804b8000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13f000) = 0x7f804b8000 mmap(0x7f804be000, 13144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f804be000 close(3) = 0 mprotect(0x7f804b8000, 16384, PROT_READ) = 0 mprotect(0x55932d9000, 12288, PROT_READ) = 0 mprotect(0x7f8050e000, 4096, PROT_READ) = 0 munmap(0x7f804c2000, 130516) = 0 fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0 brk(NULL) = 0x559651a000 brk(0x559653b000) = 0x559653b000 write(1, "# dmidecode 3.1\n", 16# dmidecode 3.1 ) = 16 openat(AT_FDCWD, "/sys/firmware/dmi/tables/smbios_entry_point", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/sys/firmware/efi/systab", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/proc/efi/systab", O_RDONLY) = -1 ENOENT (No such file or directory) write(1, "Scanning /dev/mem for entry poin"..., 35Scanning /dev/mem for entry point. ) = 35 openat(AT_FDCWD, "/dev/mem", O_RDONLY) = 3 fstat(3, # System hangs and reboots here. ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: dmidecode 3.1-1 ProcVersionSignature: Ubuntu 4.18.0-16.17~18.04.1-generic 4.18.20 Uname: Linux 4.18.0-16-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.6 Architecture: amd64 CurrentDesktop: ubuntu:GNOME Date: Mon Mar 25 12:15:53 2019 Dependencies: gcc-8-base 8.2.0-1ubuntu2~18.04 libc6 2.27-3ubuntu1 libgcc1 1:8.2.0-1ubuntu2~18.04 InstallationDate: Installed on 2019-02-28 (24 days ago) InstallationMedia: Ubuntu 18.04.2 LTS "Bionic Beaver" - Release amd64 (20190210) ProcEnviron: PATH=(custom, no user) XDG_RUNTIME_DIR=<set> LANG=en_US.UTF-8 SHELL=/bin/bash SourcePackage: dmidecode UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/dmidecode/+bug/1821632/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp