Your message dated Sun, 27 Mar 2016 09:51:45 +0000
with message-id <[email protected]>
and subject line Bug#816825: fixed in mcelog 134+dfsg-1
has caused the Debian Bug report #816825,
regarding mcelog --daemon keeps a long-lived mapping into /dev/mem
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
816825: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=816825
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: mcelog
Version: 128+dfsg-1
The README for mcelog claims:
It also opens /dev/mem to parse the BIOS DMI tables. It is careful
to close the file descriptor and unmap any mappings after using them.
The last part of the second sentence above is incorrect: the entries
mapping persists until closedmi() is called or mcelog exits. This exposes
the problem described in #816621.
I have developed and tested (on both versions 104-1 and 128+dfsg-1)
a simple patch (attached) to correct this problem.
Note, however, Ben Hutchings' comment to #816621 announcing that /dev/mem
is likely to go away soon. That means someone should implement alternative
code for mcelog to look up DMI data through the sysfs interface, preferably
in time for stretch.
Make a private copy of DMI data and munmap() /dev/mem without delay.
It was observed that on some systems mcelog, when running as a daemon,
would cause read failures on /sys/firmware/dmi/entries/*/raw due to
conflicting page cache modes.
To avoid this, only hold on to the memory mapping for the time it takes to
make a private copy of the data.
A better approach might be for mcelog to get the DMI information from
/sys/firmware/dmi/entries/ instead of /dev/mem whenever possible, but
this requires more code.
--- a/dmi.c
+++ b/dmi.c
@@ -55,7 +55,6 @@
} __attribute__((packed));
static struct dmi_entry *entries;
-static int entrieslen;
static int numentries;
static int dmi_length;
static struct dmi_entry **handle_to_entry;
@@ -190,6 +189,9 @@
int opendmi(void)
{
struct anchor *a, *abase;
+ void *ebase;
+ size_t entrieslen;
+ off_t eoffset;
void *p, *q;
int pagesize = getpagesize();
int memfd;
@@ -262,18 +264,18 @@
if (verbose)
printf("DMI tables at %x, %u bytes, %u entries\n",
a->table, a->length, a->numentries);
- corr = a->table - round_down(a->table, pagesize);
- entrieslen = round_up(a->table + a->length, pagesize) -
- round_down(a->table, pagesize);
- entries = mmap(NULL, entrieslen,
- PROT_READ, MAP_SHARED, memfd,
- round_down(a->table, pagesize));
- if (entries == (struct dmi_entry *)-1) {
+ eoffset = round_down(a->table, pagesize);
+ corr = a->table - eoffset;
+ entrieslen = round_up(a->table + a->length, pagesize) - eoffset;
+ ebase = mmap(NULL, entrieslen,
+ PROT_READ, MAP_SHARED, memfd, eoffset);
+ if (ebase == MAP_FAILED) {
Eprintf("Cannot mmap SMBIOS tables at %x", a->table);
- entries = NULL;
goto out_mmap;
}
- entries = (struct dmi_entry *)(((char *)entries) + corr);
+ entries = xalloc(a->length);
+ memcpy(entries, ebase+corr, a->length);
+ munmap(ebase, entrieslen);
numentries = a->numentries;
dmi_length = a->length;
fill_handles();
@@ -624,11 +626,10 @@
{
if (!entries)
return;
- munmap(entries, entrieslen);
- entries = NULL;
FREE(dmi_dimms);
FREE(dmi_arrays);
FREE(dmi_ranges);
FREE(dmi_array_ranges);
FREE(handle_to_entry);
+ FREE(entries);
}
--- End Message ---
--- Begin Message ---
Source: mcelog
Source-Version: 134+dfsg-1
We believe that the bug you reported is fixed in the latest version of
mcelog, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Andrey Rahmatullin <[email protected]> (supplier of updated mcelog package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Format: 1.8
Date: Sun, 27 Mar 2016 13:49:32 +0500
Source: mcelog
Binary: mcelog
Architecture: source
Version: 134+dfsg-1
Distribution: unstable
Urgency: medium
Maintainer: Andrey Rahmatullin <[email protected]>
Changed-By: Andrey Rahmatullin <[email protected]>
Description:
mcelog - x86 Machine Check Exceptions collector and decoder
Closes: 816825
Changes:
mcelog (134+dfsg-1) unstable; urgency=medium
.
* New upstream version
+ use /sys/firmware/dmi instead of /dev/mem if available, fix handling
/dev/mem fd (Closes: #816825)
* Bump Standards-Version to 3.9.7 (no change needed)
* Update Vcs-* fields to use HTTPS
* Fix spelling errors in code and manpages
Checksums-Sha1:
ca725fbb331292b575b08b917acbae6631e767b9 1835 mcelog_134+dfsg-1.dsc
5d1d7b152db34a40bb0121bb5655bf655d8c51ad 96738 mcelog_134+dfsg.orig.tar.gz
6a3bc46d7c3cce1644683cff7fe9a875f5fa97a2 10064 mcelog_134+dfsg-1.debian.tar.xz
Checksums-Sha256:
33563eac88ef84ffad5a3dc3e3923a7e3c0c4c145c9aa2528eb2fe4e69e152ad 1835
mcelog_134+dfsg-1.dsc
a96838a1e1dbae44d94665c3bedc6d49f0c2faf32fe0305061d2d2c309f777be 96738
mcelog_134+dfsg.orig.tar.gz
e98195e57d3dbfa92c516da3bb728e1618130f4f83a8ea06d12d3f6db3ec2939 10064
mcelog_134+dfsg-1.debian.tar.xz
Files:
502b1150a2e73d91d906be6a59f851b8 1835 admin optional mcelog_134+dfsg-1.dsc
976f98b5d19fa920bfbaabaf894732af 96738 admin optional
mcelog_134+dfsg.orig.tar.gz
68e05939631fbf9fcfd0b8c19d07b1cb 10064 admin optional
mcelog_134+dfsg-1.debian.tar.xz
-----BEGIN PGP SIGNATURE-----
iQIcBAEBCgAGBQJW95+7AAoJEDNi9wMaSZLh/oMP/3KAkqASEvrkmz31gEHxbR5y
ZMal59o5Em1bdazA8K3aJb0ghL4aQ97z5UMPw1buNfVoA8VSZ9YOO9S/H65ScNa+
D1P74N1n8uDMzio1b+RGdhgl6ygbZxb0fcRfs9OXeNI1o77F/VxEgZXqZ8iimFRn
AbU7XSY9fShMDCnUZStOx0JjLrp5tt+TPaTM64WbiSesajsk6FYCev1wbe7TE0g7
2gortVlrtz1HS4dse4XI0tlHbQA5jfSk5lWBjQ9Ci3im9fiOpNnljC+73cG+YNPl
XBk7yRTqoAYudGV/lhX5yK/CwH8NPWbEbfsMEcMd99GTdU7Im7oYqmAu/3tXFfWV
Y3VDiKOl5clBDBM4TPvILn5BU8gfiSWWi5YuSFhXBVXFaxZXmQSo+NYkKWudmZH0
qcU+9/Ef337To26D84LWI8ZT3bTqojJp2XeBX9FWLp8k+aIySy5NwEoUPi/lnM10
X+qJanjrWB0jj+hCtLwAzxFRAWNU3qZKJLNKKGCkavhuSdrFpSJbRZOcXL5ky3p2
kvCB0mudUppNNG/uXwmOsfXpt6LElOZRitDo0tFmVmztI23G/NhD9lf5S7zEovqN
cfaWKhySeSLqSCeW76FXh5jUXisuCViSkPg+jDPb+tsPTk5rOfrkXhYYLS7rvFz6
jshPZNGMNi8XLUqffF0J
=/9I4
-----END PGP SIGNATURE-----
--- End Message ---