bugdmidecode - Bugs: bug #46176, Unexpected end of file error

 
 

bug #46176: Unexpected end of file error

Submitter:  Gokcen <gokcen>
Submitted:  Sun 11 Oct 2015 11:51:48 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  khali
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 15 Jan 2016 12:41:31 PM UTC, comment #8: 

Seems working now, thanks a lot!

Gokcen <gokcen>
Mon 02 Nov 2015 08:52:17 AM UTC, comment #7: 
Jean Delvare <khali>
Group administrator
Sat 17 Oct 2015 05:13:27 PM UTC, comment #6: 

I've attached a fix, please give it a try if possible.

Jean Delvare <khali>
Group administrator
Wed 14 Oct 2015 06:05:35 PM UTC, comment #5: 

Thanks a lot for your thorough investigation. I will check if any further updates from Apple fix the DMI table.

Gokcen <gokcen>
Wed 14 Oct 2015 01:21:52 PM UTC, comment #4: 

Thanks for attaching all the files. I have looked at the binary dump and it turns out that DMI records 0x0029, 0x002A and 0x002B in your DMI table are corrupted. They have too many zeroes at the end, that does not comply with the SMBIOS specification. After fixing them manually, dmidecode can decode the whole table. However the right way to address the problem is to fix the table itself in your system's firmware. You should look for an update from the vendor. If you can't find any, you should report the problem and ask them for one.

When reading the table directly through /dev/mem, dmidecode will decode as much as possible, and will give up at the first corruption. However, when reading from sysfs, the kernel has already attempted to parse the table and will only export the part that was successfully decoded. While questionable, this approach ensures that no unrelated data is leaked to user-space after the DMI table if the length mentioned in the entry point was too large.

I believe that the proper fix (besides getting your system's firmware fixed, of course) would be to not let dmidecode assume that the sysfs DMI file size will always match the length announced in the entry point. Instead, it should always read the file, and simply complain if the actual size doesn't match the expected size. That way, dmidecode would behave the same with and without --no-sysfs, which I believe is desirable.

I'll prepare a patch.

Jean Delvare <khali>
Group administrator
Tue 13 Oct 2015 04:32:29 PM UTC, comment #3: 

dmidecode --no-sysfs seems to be working, although it gives "Invalid entry length(0) DMI table is broken" in the end.

I am using kernel 4.2.2 by the way.

Gokcen <gokcen>
Tue 13 Oct 2015 07:25:09 AM UTC, comment #2: 

Thanks for the report.

The actual DMI table length is inconsistent with the table length encoded in the SMBIOS entry point. The entry point says the table should be 2597 byte long, but the DMI file in sysfs is only 2379 byte long. Either the structure count or the table length is wrong in the entry point, and that causes the kernel to truncate the DMI file in sysfs.

Which exact kernel version are you running?

Please try "dmidecode --no-sysfs" and report if it makes a difference.

Please attach the contents of file /sys/firmware/dmi/tables/smbios_entry_point as well as the file generated by "dmidecode --dump-bin".

Jean Delvare <khali>
Group administrator
Sun 11 Oct 2015 11:53:58 AM UTC, comment #1: 

/sys/firmware/dmi/tables/DMI file is attached. I am using a macbook pro, and OS X 10.11 is installed alongside Linux.

Gokcen <gokcen>
Sun 11 Oct 2015 11:51:48 AM UTC, original submission:  

dmidecode command gives the following error:


$ sudo dmidecode
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.4 present.
45 structures occupying 2597 bytes.
Table at 0x7AD14000.

/sys/firmware/dmi/tables/DMI: Unexpected end of file
Table is unreachable, sorry.

Gokcen <gokcen>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #35221:  dmidecode-46176.patch added by khali (4KiB - text/x-patch - Candidate fix)
file #35181:  dmidecode-dump-bin added by gokcen (31B - application/octet-stream - dmidecode --dump-bin, dmidecode --no-sysfs, dmidecode --nosysfs --dump-bin and smbios_entry_point files attached)
file #35182:  dmi-nosysfs.dump added by gokcen (13KiB - application/octet-stream - dmidecode --dump-bin, dmidecode --no-sysfs, dmidecode --nosysfs --dump-bin and smbios_entry_point files attached)
file #35183:  dmidecode-nosysfs-dumpbin added by gokcen (3KiB - application/octet-stream - dmidecode --dump-bin, dmidecode --no-sysfs, dmidecode --nosysfs --dump-bin and smbios_entry_point files attached)
file #35184:  smbios_entry_point added by gokcen (31B - application/octet-stream - dmidecode --dump-bin, dmidecode --no-sysfs, dmidecode --nosysfs --dump-bin and smbios_entry_point files attached)
file #35145:  DMI added by gokcen (2KiB - application/octet-stream - DMI file)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by khali (Posted a comment)
  • -email is unavailable- added by gokcen (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-11-02 khali Open/ClosedOpen Closed
    2015-11-02 khali StatusConfirmed Fixed
    2015-10-17 khali Attached File- Added dmidecode-46176.patch, #35221
    2015-10-14 khali StatusNeed Info Confirmed
    2015-10-13 gokcen Attached File- Added dmidecode-dump-bin, #35181
        Attached File- Added dmi-nosysfs.dump, #35182
        Attached File- Added dmidecode-nosysfs-dumpbin, #35183
        Attached File- Added smbios_entry_point, #35184
    2015-10-13 khali StatusNone Need Info
        Assigned toNone khali
    2015-10-11 gokcen Attached File- Added DMI, #35145

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code