|
|
Subscribe / Log in / New account

LVFS tames firmware updates

By John Coggeshall
September 30, 2020

Keeping device firmware up-to-date can be a challenge for end users. Firmware updates are often important for correct behavior, and they can have security implications as well. The Linux Vendor Firmware Service (LVFS) project is playing an increasing role in making firmware updates more straightforward for both end users and vendors; LVFS just announced its 20-millionth firmware download. Since even a wireless mouse dongle can pose a security threat, the importance of simple, reliable, and easily applied firmware updates is hard to overstate.

Red Hat's Richard Hughes started LVFS in 2016, and in 2019 the Linux Foundation took the project under its wing. Since its inception, LVFS has grown to provide firmware updates for over 2,000 devices from approximately 100 different vendors.

In a 2019 presentation [YouTube] (slides [PDF]), Hughes discussed firmware updates in terms of human, organizational, and technical complexity. As he explained, end users generally don't know what exact hardware they have in their machines, whether its firmware can be updated, if that firmware needs to be updated, where to get that update, or how to apply it. Additionally, users often do not understand the importance of these updates; as Hughes pointed out, "updating your mouse firmware when your mouse is working fine seems ridiculous."

Further, one vendor's hardware often contains updatable components from another vendor, and each only provides firmware for the hardware that it is directly responsible for. Taken together, as Hughes said, "users have no chance of getting this right." LVFS addresses this complexity by providing a centralized repository of firmware and the associated metadata, bringing vendors and end users together. LVFS, however, is more than a centralized firmware distribution site; in the words of Hughes, the LVFS provides "a pipeline right from the firmware author, all the way to the end user."

The project consists of two open-source components: the LVFS web site, which allows vendors to manage their respective firmware (GitHub repository), and the fwupd project (GitHub repository), which provides the command-line fwupdmgr tool and the fwupd daemon to interact with the LVFS web site. A separate project, GNOME Software, provides a user-friendly graphical interface to perform updates; it and fwupd are available by default in most distributions that support GNOME.

At the core of the LVFS project are the binary firmware blobs, provided by vendors as Cabinet files. It is an odd choice for a Linux-focused project, but Hughes explained that it "allows vendors to use the same deliverable for Windows Update as they do for LVFS." Inside the Cabinet file is a cryptographically signed binary blob containing the firmware and metadata in formats consumable by both LVFS and Windows Update. After processing, these Cabinet files are re-signed by LVFS to ensure fwupd clients can verify the integrity of the firmware. LVFS public keys that are used for this verification are distributed as part of fwupd.

Hughes described the LVFS web site, which provides the vendor interface, as "just a Python Flask project." It serves as the central firmware repository and management portal for vendors. Cabinet files uploaded by vendors to the web site are processed and, once validated, added to a master XML document called AppStream, signed by the site. This master list provides the data fwupd needs to notify users of any firmware updates available for their system. For security, Cabinet files are served over SSL by the site directly; the AppStream document, however, is distributed via a content distribution network.

The web site can also be hosted locally, giving organizations privacy and complete control over the update process. For a local instance, the same workflow described above is applied using an organization's own keys, signatures, and firmware packages; the fwupd installations for the organization's machines would then be configured to use the local instance. Hughes said there are a number of undisclosed organizations that use LVFS behind their firewalls for various reasons.

Firmware processing

The processing that is done on firmware provided to LVFS is extensive. In a private email, Hughes explained that the site can process various firmware payload formats into a collection of individual executables and resources. Two types, Pre-EFI Initialization modules (PEIM) and Driver Execution Environments (DXE) are extracted, hashed, and stored in the LVFS database; the project calls them "shards." These shards can be common across firmware when, as Hughes explained, a hardware vendor gives two OEMs the same driver. By collecting and hashing them, they can later be queried against. For example, a query to determine which hardware is the most popular across OEMs by looking for the same hash value in firmware blobs.

That's not the end of the project's firmware analysis, either; Hughes says that DXE shards are analyzed as well. He explained that the project looks for expired certificates, private keys, and other indicators that shouldn't exist in a production firmware like the strings "DO NOT SHIP" or "To Be Filled by O.E.M."

The process of extracting shards is something Hughes says helps "keep vendors honest." Sometimes, vendors will upload firmware described in the release notes as a "low-priority enhancement-only update" that turns out to also include security updates. While there is a limit to the information one can glean from binaries in firmware blobs, enhancement-only updates don't typically need to interact with (for example) the UEFI Secure Boot, explained Hughes; when a discovery like that is made, it allows him to reach out to the vendor to discuss it.

The ability to break firmware blobs down into base, traceable binaries is a significant benefit of the project; especially when it comes to security. For example, LVFS provides a means to block a shard with known security issues, and in his presentation, Hughes showed an example of a rule to block an object known to contain "the Dual EC backdoor for the NSA [National Security Agency]". Hughes said in my correspondence with him that it was "trivial" to query the shard database for firmware that includes the compromised Computrace module. Blocklist rules are defined in the blocklist plugin for the LVFS website. It is also worth noting that security researchers can get a free account on LVFS to issue YARA queries against the available (public) shard data.

As LVFS has gained more support from the industry, the project is imposing increasingly strict restrictions and expectations on vendors in order to participate. In a discussion during Hughes's presentation of firmware signatures, he told the audience that the project had a requirement that "the signature couldn't be more than three years out of date, and half the firmware failed. Over the last few months, we have been increasing the number of checks and making them more and more strict." While the checks can be ignored by vendors, Hughes points out "it's way less work" to do things correctly.

There is information that is only available to vendors on the LVFS web site, including firmware statistics such as installation success and failure rates. These statistics are enabled by another feature Hughes described as "very interesting," a bidirectional feedback mechanism to communicate with users applying updates. According to Hughes, "traditionally when you have a firmware update on an FTP site, you don't get any information back from the end user themselves." fwupdmgr, however, can provide the history of firmware updates made on a system to LVFS. This feedback mechanism can be used by users via the report-history sub-command of fwupdmgr; it is not accessible from GNOME Software. Limiting access to the feature is intentional; Hughes argues that users upgrading via the command line "understand the ramifications of uploading things like your kernel version" to a third party. Hughes has a blog post that details what is transmitted as part of the feedback mechanism.

The feedback not only helps vendors identify who is experiencing a problem with their firmware so they can respond accordingly, but is also valuable to the LVFS. For example, firmware updates that have a high failure rate can be removed from distribution automatically until the issue is fixed.

Working with vendors

While the most common firmware-update protocols are already available in fwupd (39 are currently supported), some vendors use proprietary protocols with implementations that they are unwilling to release under the LGPLv2+, as required by the project. Hughes described vendor secrecy concerns as "an order of magnitude more paranoid" than he experienced working for national defense contractors. Working with those vendors can be a challenge, one that the project is still trying to overcome. In his presentation, Hughes described how Logitech would not share the code for its flashing protocol. Still, the developers were able to answer any questions he had about it. To create the protocol implementation, Hughes engaged in what amounts to a game of Twenty Questions with them. Hughes says that most vendors can be convinced to release their protocols without such games, once it is explained to them that the intellectual property at question has little value; fundamentally, all flashing protocols operate identically.

Wrapping up

LVFS looks to be a useful project and service which is working to push hardware vendors in the right direction. GitHub reports around 120 contributors for the two projects. Of the two, fwupd is the more active project — it has 85 releases and near-daily commits. The LVFS web site only has nine releases with bi-weekly commits. Hughes made it clear that more contributors are welcome; he doesn't have enough time to do all of the things he'd love the project to take on.

As for what is next, Hughes hopes to further build the automated firmware analysis tooling, add more features to the LVFS web site to support vendors, and get more industry players like ASUS and Microsoft to participate. For readers who would like to keep informed on the project, the announcement mailing list is a good way to do so. The project also provides a developer page with information on the process of contributing or opening issues. With more vendors, support for additional update protocols, and so on, LVFS seems poised to strengthen the firmware-update landscape for years to come.



to post comments

LVFS tames firmware updates

Posted Oct 1, 2020 13:26 UTC (Thu) by nathan (subscriber, #3559) [Link]

I am so glad lvfs is a thing. it used to be so hard to impossible to update firmware.

thank you!

LVFS tames firmware updates

Posted Oct 1, 2020 14:04 UTC (Thu) by LtWorf (subscriber, #124958) [Link] (2 responses)

> once it is explained to them that the intellectual property at question has little value; fundamentally, all flashing protocols operate identically.

Legal department: over my dead body!

Financial department: part of our value is our IP, we can't give it out.

LVFS tames firmware updates

Posted Oct 1, 2020 16:51 UTC (Thu) by iabervon (subscriber, #722) [Link]

That's why you're much more likely to get protocols described in datasheets or supplemental manuals than sample code. Businesses have IP that they don't give out, IP that they give to customers, IP that they give to anyone, and IP that they pay people to take (e.g., ads), and the departments responsible for making sure the right thing happens tend to categorize based on the form of the IP rather than trying to understand its purpose.

LVFS tames firmware updates

Posted Oct 1, 2020 18:35 UTC (Thu) by hughsient (subscriber, #52199) [Link]

Sales department: we're not going to hit our numbers this quarter because of the missing LVFS thing...

LVFS tames firmware updates

Posted Oct 1, 2020 17:05 UTC (Thu) by dowdle (subscriber, #659) [Link] (10 responses)

It is my understanding that LVFS doesn't does provide any updates on Legacy BIOS systems and requires UEFI. What's the deal with that?

LVFS tames firmware updates

Posted Oct 1, 2020 18:34 UTC (Thu) by hughsient (subscriber, #52199) [Link] (4 responses)

Because there's no way of scheduling a legacy bios update. You can't even boot into a random update mode to run anything with CSM.

LVFS tames firmware updates

Posted Oct 1, 2020 21:29 UTC (Thu) by dowdle (subscriber, #659) [Link] (3 responses)

I have little to no understanding about the constraints of Legacy BIOS... but I can tell you Dell Command Update (Microsoft Windows on most Dell end-user systems) on a Legacy BIOS system works just fine. I also use their DSU on Linux systems in Legacy BIOS mode. Various other vendors provide tools that work in both modes... Lenovo, HP, etc.

Granted, a single tool for Linux that works with a wide range of multi-vendor hardware doesn't really compare to a single vendor product. I realize there are most likely a wide range of differences between the various vendor Legacy BIOS setups... whereas UEFI is a tome of standards with a single reference implementation that most vendors only slightly customize? Yeah, I made that a question. :)

It would be helpful if fwupdmgr when run on a Legacy BIOS system would inform the user that they are simply wasting their time and that no matter how many times one reads the man page, it isn't going to help.

LVFS tames firmware updates

Posted Oct 2, 2020 9:20 UTC (Fri) by hughsient (subscriber, #52199) [Link] (2 responses)

> inform the user that they are simply wasting their time

We do, but you have to be running a very new fwupd version: https://github.com/fwupd/fwupd/blob/master/plugins/bios/f...

LVFS tames firmware updates

Posted Oct 2, 2020 11:07 UTC (Fri) by dowdle (subscriber, #659) [Link] (1 responses)

Are there instructions for converting a Red Hat / Fedora Legacy BIOS install to a UEFI boot install? Microsoft Windows has such a tool and I've used it on a few occasions. It works most of the time.

If there isn't a standard / reliable way to do it for Linux then, "Firmware can not be updated in legacy BIOS mode, switch to UEFI mode" practically means... change your system's boot method and re-install your OS... so you can update your firmware. I guess one could temporarily boot live media in UEFI mode and update from that... and switch back again.

I look forward to using fwupdmgr on the UEFI systems and think it is really a benefit to the entire Linux ecosystem. Thanks for all of the hard work.

LVFS tames firmware updates

Posted Oct 11, 2020 21:33 UTC (Sun) by HelloWorld (guest, #56129) [Link]

I have recently done that, and basically you have a ๐Ÿ” and๐Ÿฅš problem. Installing a UEFI bootloader is only possible if you already booted via UEFI, and to do that, you need a UEFI bootloader. Commands like grub-install won't work in UEFI mode if you booted with the CSM. So you indeed have to boot from a live media and set it up from there.

LVFS tames firmware updates

Posted Oct 2, 2020 1:51 UTC (Fri) by pabs (subscriber, #43278) [Link] (4 responses)

There are some docs available from Linux distros about non-fwupd ways to update firmware:

https://wiki.debian.org/Firmware/Updates
https://help.ubuntu.com/community/BIOSUpdate
https://wiki.gentoo.org/wiki/BIOS_Update
https://wiki.archlinux.org/index.php/Flashing_BIOS_from_L...

Probably at this point all updates for BIOS based systems have completely ended though, so even if it were possible to update BIOS systems with fwupd it would be pointless to implement it as there would be no updates available.

LVFS tames firmware updates

Posted Oct 2, 2020 9:18 UTC (Fri) by hughsient (subscriber, #52199) [Link]

> as there would be no updates available

Every single OEM I've talked to has zero interest in legacy BIOS or CSM-based update methods. Some are even going to be removing CSM as a user-option in the future.

LVFS tames firmware updates

Posted Oct 2, 2020 11:21 UTC (Fri) by dowdle (subscriber, #659) [Link] (2 responses)

I'm not sure what you mean. I'm mostly familiar with Dell systems... and on most of those with the latest gen-Intel processors they seem to have removed the option to switch to Legacy BIOS mode... but on all previous systems containing such an option (which is probably tens of millions+ of systems ranging from laptops to desktops to servers) Dell continues to offer BIOS updates. They are really UEFI with a BIOS Legacy mode... but hey, on their downloads pages you still pick "BIOS" from the drop-down menu to see the updates.

How many of those systems have users actually put into Legacy BIOS mode? I have no idea. Obviously anything with a 2TB or greater boot drive is in UEFI mode... and all pre-installed systems for the last few years have been using UEFI. I'd hazard a guess that the bulk of Legacy BIOS users are people who install their own OSes... especially anyone using Linux distros that don't offer a secure boot mode... and yes I realize you can still use UEFI without secure boot.

The point is though, Dell will be offering updates for their systems with a Legacy BIOS mode for as long as those systems are supported... which is probably a few more years.

LVFS tames firmware updates

Posted Oct 7, 2020 0:22 UTC (Wed) by pjones (subscriber, #31722) [Link]

They don't have an interest in implementing /APIs/ to do it in BIOS mode.

LVFS tames firmware updates

Posted Oct 7, 2020 1:20 UTC (Wed) by pabs (subscriber, #43278) [Link]

I was referring to systems that never had UEFI, only BIOS. I personally have never owned a system capable of UEFI and all the systems I do own are way past the end of available BIOS updates and also predate the existence of fwupd.

LVFS tames firmware updates

Posted Oct 2, 2020 22:59 UTC (Fri) by jmm (subscriber, #34596) [Link]

Given that Dell supports IOT and consumer products already, are there plans to also support their server lines/PowerEdge at some point?

What about firmware mods?

Posted Oct 11, 2020 21:41 UTC (Sun) by HelloWorld (guest, #56129) [Link]

I recently had to mod my UEFI firmware to get the Mainboard to boot from an NVMe drive. Is there any possibility that LVFS might allow such mods to be obtained by users? Legal issues notwithstanding...


Copyright © 2020, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds