dmidecode causing system crash

Bug #1821632 reported by James Glenn
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
dmidecode (Debian)
Fix Released
Unknown
dmidecode (Ubuntu)
Fix Released
Undecided
Unassigned

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)

Revision history for this message
James Glenn (jglenn-nvidia) wrote :
Revision history for this message
Ninad (ninadm) wrote :

We could see the random crashes while using ubiquity plugins when dmidecode (arm64) is installed on the system. If dmidecode package is removed the system is stable and no crash is observed.

Revision history for this message
Ninad (ninadm) wrote :

We are using Ubuntu 18.04 (Bionic) Arm64 variant of distro

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in dmidecode (Ubuntu):
status: New → Confirmed
Revision history for this message
Stefan Weil (ubuntu-weilnetz) wrote :

This problem seems to occur with kernels provided by NVIDIA for their Jetson T2 and Xavier boards. I got it when programs like cfengine or ocs-inventory-agent periodically called dmidecode. This crashed a Xavier board.

See also https://devtalk.nvidia.com/default/topic/1003952/jetson-tx2/dmidecode-crashes-r27-1-on-tx2/.

Although NVIDIA blames the application (dmidecode), I consider this a kernel bug. Reading illegal memory should not crash the system, but simply fail with an error status.

Revision history for this message
Stephen Warren (srwarren) wrote :

> 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.

Revision history for this message
Stephen Warren (srwarren) wrote :

This bug is actually fixed in the dmidecode source code:
(links removed in case that's why launchpad won't let me save this comment).

Can we please back-port this fix into Ubuntu 18.04 AArch64? Thanks.

Revision history for this message
Stephen Warren (srwarren) wrote :
Revision history for this message
Stephen Warren (srwarren) wrote :

The upstream bug report is:
savannah.nongnu.org dmidecode bug 109697
(launchpad won't let me paste the whole link)

Revision history for this message
Stephen Warren (srwarren) wrote :

The upstream patch (which was made after upstream release 3.2) back-ported to upstream 3.1 release (Ubuntu 18.04 contains dmidecode 3.1); it should presumably apply cleanly to Ubuntu's dmidecode-3.1 source.

Revision history for this message
Stephen Warren (srwarren) wrote :

Oops. Ubuntu 18.04 has dmidecode 3.0 not 3.1; this patch should work with that version (at least, it applies against unpatched upstream 3.0 anyway).

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "0001-dmidecode-Only-scan-dev-mem-for-entry-point-on-x86.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Stephen Warren (srwarren) wrote :

Is there any chance of taking this patch into Ubuntu 18.04? Thanks.

Changed in dmidecode (Debian):
status: Unknown → New
Changed in dmidecode (Debian):
status: New → Fix Released
Revision history for this message
Stephen Warren (srwarren) wrote :

Is there any chance of importing the fix from Debian?

Changed in dmidecode (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Stephen Warren (srwarren) wrote :

https://bugs.launchpad.net/ubuntu/+source/dmidecode/+bug/1858615 contains the comments indicating which git commit fixed this in the Ubuntu packages.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.