Commit Graph

1843 Commits

Author SHA1 Message Date
Benson Leung
852c6685ff cros-ec: Set protocol for cros-ec-usb-device
Specify "com.google.usb.crosec" to indicate support for Google's
USB endpoint updater protocol.
2020-07-09 07:44:19 +01:00
Benson Leung
8ed9f5f0a1 cros-ec: Write firmware to usb target
Write the firmware to the usb device, first finding which section to
write to, then breaking into blocks (based on maximum pdu size),
and then into chunks, which are transferred to the device using bulk transfers.
2020-07-09 07:44:19 +01:00
Benson Leung
4ed2400cab cros-ec: Store image_idx in section
Makes it a bit easier to retrieve the image later.
2020-07-09 07:44:19 +01:00
Benson Leung
9326e19118 cros-ec: Give cros-ec-firmware a get_sections
Add a getter for the sections.
2020-07-09 07:44:19 +01:00
Benson Leung
d0cd862acf cros-ec: Add fu_cros_ec_firmware_pick_sections
Add this to allow the usb-device to mark which section of the firmware
image is writeable by setting the section's ustatus to FU_CROS_EC_FW_NEEDED.
2020-07-09 07:44:19 +01:00
Benson Leung
befd9a420e cros-ec: Convert cros-ec-firmware's sections to GPtrArray 2020-07-09 07:44:19 +01:00
Benson Leung
6472742bea cros-ec: Add prepare firmware
Prepare firmware by parsing it, which will be of fu_cros_ec_firmware type.
2020-07-09 07:44:19 +01:00
Benson Leung
a989975812 cros-ec: Update documentation to reflect fmap
The file format was added last time around, so update cros-ec's
documentation to reflect that fwupd now supports fmap format
blobs.
2020-07-09 07:44:19 +01:00
Ryan Lee
ef7b7b0efd ccgx: modify installation time for hp g2 dock 2020-07-07 13:00:02 +01:00
Mario Limonciello
c90eca4787 thunderbolt: add support for retimers 2020-07-03 12:56:44 -05:00
Richard Hughes
a852254d92 trivial: Hide the UEFI DBX parsing by default 2020-07-03 12:32:06 +01:00
Ryan Lee
62618bedb6 ccgx: add extra 45% removal time for worst case 2020-07-03 10:18:57 +01:00
Richard Hughes
6269a839eb Add a security attribute for BootGuard
This information is obtained from the MEI configuration space.
2020-07-02 20:25:48 +01:00
Richard Hughes
81a12a1b17 pci-mei: Split out the HFSTS registers
The register specifications have been taken as a superset of the coreboot
documentation as different flags were documented in more detail on various
different platforms.

Having this new data allows us to add future tests and make the current tests
much easier to understand.
2020-07-02 20:25:48 +01:00
Reto Kromer
2b0a329cf1 fix alignment (in the code) 2020-07-01 21:11:17 +01:00
Richard Hughes
1de98dcd72 mei: Add extra metadata to the security attributes 2020-07-01 20:10:39 +01:00
Richard Hughes
2adeb7688a mei: Store the family in the plugin data 2020-07-01 20:10:39 +01:00
Mario Limonciello
b1cf96abe1 trivial: acpi-dmar: lower missing DMAR table to debug
If the system is missing a DMAR table, users can find out from
`fwupdtool/fwupdmgr security`.  No need to actually warn in the logs
every single time.
2020-07-01 13:42:28 -05:00
Richard Hughes
d09cf101c3 Change all instances of master/slave to initiator/target
This makes perfect sense, because the 'initiator' starts the transaction and
the 'target' is the addressee of the transaction. Even the I²C spec defines the
'master' as 'initiating' the transaction.

This is the same nomenclature now used by the Glasgow project too.
2020-07-01 15:44:30 +01:00
Ryan Lee
7ebcd06ae4 ccgx: remove verify flag in plugin 2020-07-01 14:14:10 +01:00
Mario Limonciello
6a6029f132 uefi: disable plugin if efivar is not supported
Don't even try to coldplug the device.

Fixes: #2237
2020-06-30 13:55:33 -05:00
Richard Hughes
85226fd9d1 Remove potentially problematic language
Red Hat wants to drive an initiative in correcting problematic and potentially
divisive language in open source projects. These naming conventions and
descriptive phrases are hurtful and offensive to many of our colleagues across
the open source universe.

See https://www.redhat.com/en/blog/making-open-source-more-inclusive-eradicating-problematic-language
2020-06-30 17:31:17 +01:00
Richard Hughes
d9f3bec6d0 trivial: Fix GtkDoc issue with FuFmapFirmware 2020-06-29 15:49:14 +01:00
Ryan Lee
609d0c570f ccgx: Add more hybrid dock support
Also add HPI command retry.
2020-06-25 18:30:30 +01:00
Mario Limonciello
28d51c036b trivial: tpm-eventlog: stop showing messages about secure boot
This was an overloaded use of UpdateMessage that didn't make sense.
It doesn't affect the functionality of updating, just the security.

Hints about why the TPM PCR0 reconstruction failed should go
to the wiki page not the device.
2020-06-25 11:17:47 -05:00
Mario Limonciello
b563840753 Move PCR0 reconstruction error into security command
Now that this infrastructure is built, it's a more useful location
to put the security output.
2020-06-25 11:17:47 -05:00
Mario Limonciello
4669dd590a trivial: uefi: drop secure boot check at coldplug
We'll instead check this when the user tries to run an update.  This
allows them to sign a bootloader after the daemon starts (or remove
a signed bootloader after starting)

Fixes: #2219
2020-06-24 08:18:48 -05:00
Mario Limonciello
58d6d329e8 trivial: thunderbolt: don't set update error for missing nvmem
Trying to explain why ICL thunderbolt isn't updatable doesn't help
people.  It just causes fwupdmgr and fwupdtool to show the device
front and center with a confusing message.

Instead don't populate the message and by the default device filter
it will be hidden.

See #2212 for background.
2020-06-24 06:31:58 +01:00
Mario Limonciello
bdc589884a modem-manager: add support for compiling libqmi-glib 1.26.0 and later 2020-06-23 15:21:09 -05:00
Mario Limonciello
bfd57c6ee1 trivial: modem-manager: chomp vendor string
Reading the sysfs file seemed to have also eaten the `\n` as mentioned
on a bug.

```
├DW5821e Snapdragon X20 LTE:
│     Device ID:           fa707b9af86ff44bc17316b6c3e5ea82aab3ce86
│     Summary:             Mobile broadband device
│     Current version:     T77W968.F1.0.0.4.2.GC.010
│     Vendor:              Dell Inc. (USB:0x413c
│     )
│     GUIDs:               64da2d58-8d1b-5e5b-b793-f88ba5a25a8f
│                          761d6124-0002-5185-b767-9adf67bf1a5e
│                          795e079d-093b-5503-aa59-35b832480e95
│     Device Flags:        • Updatable
```
2020-06-23 14:12:08 -05:00
Mario Limonciello
f7d83a2f45 trivial: modem-manager: fix a logic error 2020-06-23 08:44:21 -05:00
Mario Limonciello
752dc715ea Revert "trivial: add Vendor ID into Modem manager devices"
This reverts commit 5521e47511.
2020-06-23 07:57:22 +01:00
Mario Limonciello
50638657cc modem-manager: read the vendor ID directly from sysfs attribute
Fixes: #2209
2020-06-23 07:57:22 +01:00
Mario Limonciello
e2a77fc10b trivial: modem-manager: add a protocol for updating the devices 2020-06-23 07:57:22 +01:00
Mario Limonciello
834b28009d Add support for a delayed activation flow for Thunderbolt
This allows delaying the activation of Thunderbolt firmware until
shutdown/reboot or when the dock is unplugged.

This functionality requires features in the kernel:
https://lore.kernel.org/linux-usb/20200622143035.25327-1-mario.limonciello@dell.com/T/#t

Matrix of cases to support:

* Distro Old Linux kernel (doesn't support authenticate on disconnect)

  - WD19TB: Should have `skips-restart` flag set
    No flush or activate features called in `thunderbolt` plugin.
    `dell_dock` plugin will activate at end of composite update

  - All other devices: Shouldn't have flags set
    Should authenticate in Thunderbolt plugin.
    `1 > nvm_authenticate`

* Distro New Linux kernel (supports authenticate on disconnect)

  - WD19TB: Should have `usable-during-update` flag set but not `skips-restart`
    Should flush image to SPI in `thunderbolt` plugin
    `2 > nvm_authenticate_on_disconnect`
    Should configure TBT device for authenticate on disconnect
    `1 > nvm_authenticate_on_disconnect`
    `dell_dock` plugin will configure dock for authenticate on disconnect

  - All other devices: Shouldn't have flags set
    Should authenticate in `thunderbolt` plugin.
    `1 > nvm_authenticate`

* ChromeOS (supports authenticate on disconnect)

  - `thunerbolt.conf` will have `DelayedActivation=true`.

  - WD19TB: Should have `usable-during-update` flag set but not `skips-restart`
    Should flush image to SPI in `thunderbolt` plugin
    `2 > nvm_authenticate_on_disconnect`
    Should configure device for authenticate on disconnect
    `1 > nvm_authenticate_on_disconnect`
    `dell_dock` plugin will configure dock for authenticate on disconnect

  - All other devices: Should have both `usable-during-update` and `skips-restart` set
    Should flush image to SPI in `thunderbolt` plugin
    `2 > nvm_authenticate`
    Will activate upon logout/shutdown/reboot
    `1 > nvm_authenticate`
2020-06-22 16:09:10 -05:00
Mario Limonciello
5521e47511 trivial: add Vendor ID into Modem manager devices
Fixes: #2200
2020-06-22 15:57:10 -05:00
Richard Hughes
b1ae0dcbbc logind: Fix trivial memory leak at startup
The g_dbus_proxy_get_name_owner() function is (return full).
2020-06-22 15:55:02 +01:00
Richard Hughes
b0426f8a24 tpm-eventlog: Fix memory leak when reading file
The file contents were literally just read four lines above.
2020-06-22 15:55:02 +01:00
Ryan Lee
4c177ad540 ccgx: add new protocol for dmc dock 2020-06-22 12:57:43 +01:00
Mario Limonciello
91e27e145a Add a new plugin for legacy BIOS
This plugin is only enabled when coreboot isn't detected.
It intentionally does not check for EFI to be disabled at startup
since it can also notify the user that UEFI capsule updates are
disabled on the system even if running in UEFI mode.
2020-06-22 11:22:18 +01:00
Richard Hughes
5a831fa7ab vli: Set the i2c instance IDs in probe()
They do not need to query the device, so ->setup() is not required.
2020-06-22 10:42:05 +01:00
Benson Leung
53fad4cd6c trivial: cros-ec: Use fu-memcpy-safe 2020-06-20 07:24:32 +01:00
Benson Leung
3a02ad5129 cros-ec: Add cros-ec-firmware
cros-ec firmware are in fmap layout, and have two sections
that this plugin will look for, the EC_RO, and EC_RW sections.

Tested using a servo_micro firmware:
$ fwupdtool firmware-parse servo_micro_v2.4.17-df61092c3.bin
<select fmap option>
FuCrosEcFirmware:
Version:                 2.4.17
  FuFirmwareImage:
  ID:                    EC_RO
  Index:                 0x1
  Version:               servo_micro_v2.4.17-df61092c3
  Data:                  0xf000
  FuFirmwareImage:
  ID:                    FR_MAIN
  Index:                 0x2
  Data:                  0xf000
  FuFirmwareImage:
  ID:                    RO_FRID
  Index:                 0x3
  Address:               0xc4
  Data:                  0x20
  FuFirmwareImage:
  ID:                    FMAP
  Index:                 0x4
  Address:               0x9a40
  Version:               1.0
  Data:                  0x15e
  FuFirmwareImage:
  ID:                    WP_RO
  Index:                 0x5
  Data:                  0x10000
  FuFirmwareImage:
  ID:                    EC_RW
  Index:                 0x6
  Address:               0x10000
  Version:               servo_micro_v2.4.17-df61092c3
  Data:                  0x10000
  FuFirmwareImage:
  ID:                    RW_FWID
  Index:                 0x7
  Address:               0x100c4
  Data:                  0x20
2020-06-20 07:24:32 +01:00
Richard Hughes
0164141f9b trivial: Fix incorrect comment text 2020-06-19 10:59:16 +01:00
Richard Hughes
e5a4d52ea1 trivial: Spelling fixes from codespell 2020-06-18 20:49:12 +01:00
Mario Limonciello
7d5f6b0232 dell-dock: Add more module types to the enum
Unfortunately module type has more than I previously realized.
The meanings that previously were applied fortunately worked for
the most important case (130-180W TBT) but didn't for single C, dual
C or small power (45W) cases.

Since composite_prepare was trying to read and interpret these, it
causes failures when these other ones are encountered.

I reproduced this on a 130W adapter plugged into a single C (type 0x4).
This meant the update wouldn't install since NULL was returned for the
type.

In case a new module ID is added later, also return an "unknown" for
the metadata.
2020-06-17 17:10:05 -05:00
Mario Limonciello
f412227415 trivial: don't show reconstruction errors if uefi device is missing
The system must support UEFI capsule updates in order to measure
this. (Fixes: #2181)
2020-06-17 15:01:34 -05:00
Mario Limonciello
28bcecc028 trivial: fwupdtpmevlog: make clearer which algorithm is used 2020-06-17 15:01:34 -05:00
Mario Limonciello
9122999bfb tpm-eventlog: verify all algorithms, not just one of them
This will help to suss out any problems that are specific to sha1
or sha256 eventlog calculation.
2020-06-17 15:01:34 -05:00
Mario Limonciello
fe862a1d1b tpm-eventlog: Always look at all supported algorithms
This will effectively mean that both sha1 and sha256 results are
sent back to uefi plugin for analysis.
2020-06-17 15:01:34 -05:00
Richard Hughes
87143298cd pci-mei: Set the security attr result for a passed version 2020-06-17 18:37:27 +01:00
Mario Limonciello
8012fb3c8d trivial: dell-dock: clarify the pending update message (#2185)
To a user it's not obvious if being unplugged means host or AC adapter.
Unplugging from AC adapter will prevent the dock from completing an
update.
2020-06-17 11:49:33 -05:00
Richard Hughes
33b0f48b6f vli: Wait for the root device to be replugged when updating the MSP430
The MSP device is a virtual child of the USB hub.
2020-06-17 17:29:34 +01:00
Richard Hughes
a8610c3027 vli: Do not use GUID matching for the MSP device
Not strictly required, but it makes the FuDeviceList operation much simpler.
2020-06-17 17:29:34 +01:00
Richard Hughes
b114661a25 Collect per-device report metadata for the history database
Add two new vfuncs that can be used to collect report metadata from devices
both before and after the update has run. This means we can remove the hacks
where we set add 'global' metadata entries and just hope that there is only one
device from the same plugin that is updated.

This also allows us to collect debugging metadata from devices after an offline
update has been run.
2020-06-16 15:49:28 +01:00
Mario Limonciello
5b63015c19 tpm-eventlog: fix PCR0 calculation
One of the core problems is that systems with both sha1 and sha256
were miscalculating.

Fixes: #2181
2020-06-15 16:17:29 -05:00
Mario Limonciello
2caea54202 uefi: check for free space after cleaning up ESP
In a very small ESP situation it's possible that the amount of free
space is insufficient until it's actually been cleaned.

Fixes: #2179
2020-06-15 10:21:18 -05:00
Richard Hughes
4fd61e4756 vli: Use the GPIOB reset for the MiniDock VL103 2020-06-11 07:03:23 +01:00
Richard Hughes
6cd6e2adb6 vli: Set FuQuirks on the shared SPI object 2020-06-11 07:03:23 +01:00
Richard Hughes
92072b4239 vli: Add the project ID shared SPI PD controllers
The Mini-Dock and Travel-Hub accidentally share the same VID:PID and this is the
only way to tell them apart.
2020-06-11 07:03:23 +01:00
Richard Hughes
83a21cb7cd vli: Allow chained usb hub devices where the parent needs GPIOB reset
As both hub devices share a FuVliUsbhubDeviceClass instance we cannot 'hijack'
the vfuncs depending on object type. This allows the downstream hub to proxy to
the upstream hub where a GPIOB reset can be performed.
2020-06-09 11:56:30 +01:00
Richard Hughes
09950a13ce vli: Do not modify the class vfuncs depending on device type
We can have multiple FuVliPdDevice objects registered with the daemon, but they
will all share the FuVliPdDeviceClass instance. If one device requries a
silicon workaround, do not 'hijack' the vfunc for all devices of this type.

This means we do the right thing when updating both the one that requires the
workaround, and the 'normal' one.
2020-06-09 11:30:49 +01:00
Ryan Lee
59bb497a3e ccgx: modify install duration for dmc device 2020-06-09 10:37:26 +01:00
Ryan Lee
0942dcc413 ccgx: Add support for HP DMC dock devices 2020-06-05 13:35:54 +01:00
Mario Limonciello
c0a2798fb5 trivial: logitech_hidpp: set the protocol properly when bootloader unknown
This appears to be a regression from c6ae0d998b
where the case of bootloader version 0 didn't get protocol set.

Fixes: #2156
2020-06-02 10:27:13 -05:00
Richard Hughes
0f6d754d5a Detect if the MEI device has known security issues
If it has, fail HSI-1.
2020-06-01 22:49:39 +01:00
Richard Hughes
bb228cbe53 pci-mei: Check the HFS register for the override strap 2020-05-29 17:34:18 +01:00
Mario Limonciello
d5d496b62a trivial: uefi: fix dell TPM updates
Adding an extra header makes the firmware reject the GUID in the real
header.
2020-05-29 07:31:15 -05:00
Benson Leung
a22310374e cros-ec: Provide device metadata as a part of to_string
Provide the following metadata:

"Dirty firmware" bit
Protocol version
Header type
Maximum PDU Size
Flash protection status
Raw version string
Key Version
Minimum rollback
2020-05-29 06:55:40 +01:00
Benson Leung
092f87ae0c cros-ec: Add board name as a instance id and hash as metadata
These couple of extra things in the CrOS EC version string
were split off of the triplet, so give them a home.
2020-05-29 06:55:40 +01:00
Benson Leung
086d0c0eb6 cros-ec: Parse version number into triplet
Add fu_cros_ec_parse_version to common, as this will be used to
parse the firmware bundle's version string too.
2020-05-29 06:55:40 +01:00
Benson Leung
00bb3341d2 cros-ec: Add enough infrastructure for setup connection
This should do the bulk transfers using protocol 6.

The output here is now equivalent to the output of
usb_updater2 -d 18d1:501a -f

fwupdtool --plugin-whitelist cros_ec get-devices --verbose
Servo Micro
  DeviceId:             84d0e3f2a0f8b2328f7995767b23ebb40494723f
  Guid:                 8e2f7625-a164-55d7-8f09-f193c8ec33f1 <- USB\VID_18D1&PID_501A&REV_0100
  Guid:                 13564257-c649-586d-b4e4-4f048d480f36 <- USB\VID_18D1&PID_501A
  Serial:               CMO653-00166-040491U00771
  Summary:              Servo Micro (aka "uServo") Debug Board
  Plugin:               cros_ec_usb
  Flags:                registered
  Vendor:               Google Inc.
  VendorId:             USB:0x18D1
  Version:              servo_micro_v2.4.17-df61092c3
  VersionFormat:        plain
  Created:              2020-05-20
  PhysicalId:            usb:03:00:02
2020-05-29 06:55:40 +01:00
Benson Leung
7aa00f6ee8 cros-ec: Add usb_findit functionality
Find the interface and endpoint used for firmware updates.
Note: this change now requires libgusb 0.3.3 or later.
2020-05-29 06:55:40 +01:00
Benson Leung
b483044a8d cros-ec: Initial skeleton
Set it up as a USB device plugin, with the initial device in quirks
being Servo Micro debug board.
2020-05-29 06:55:40 +01:00
Mario Limonciello
838ae163e3 dell-dock: prevent updates to occur via synaptics-mst plugin
Although they normally work, some failures have been reported in the field
related to the MST hub not responding in the MST plugin.

When these failures have occurred the dell_dock plugin also fails to
enumerate.

So rather than allow some people who don't have dell_dock compiled to
update their MST hub using synaptics_mst, perform ALL updates for
mst hub via dell_dock.

```
18:06:24:0324 FuPluginSynapticsMST no device found on drm_dp_aux1: VMM5331 inside Dell dock is only supported by dell_dock
```
2020-05-28 08:59:07 -05:00
Richard Hughes
862ec5c65b Skip module unloading only if we are actually running under valgrind
See also: https://github.com/fwupd/fwupd/issues/2119
Reported-by: Anton Farygin <rider@altlinux.org>

Based on a patch by Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
2020-05-28 06:56:45 -05:00
Mario Limonciello
d39bcee29d trivial: detect cpuid.h and also look for host architecture
Fixes cross compilation for arm with clang which provides cpuid.h
but helpfully has this error:
```
 #if !(__x86_64__ || __i386__)
 #error this header is for x86 only
 #endif
```

Fixes: #2131
2020-05-26 15:06:08 -05:00
Mario Limonciello
a42daefb9e dell-dock: Capture the dock SKU in metadata
Should be helpful in reproducing failure reports.
2020-05-26 10:22:58 -05:00
Richard Hughes
4b16642dc5 ccgx: Fix a potential division by zero
Spotted by Coverity.
2020-05-22 15:34:16 +01:00
Richard Hughes
e3091c394b trivial: Move the SecureBoot attr to a runtime issue 2020-05-22 15:15:09 +01:00
Mario Limonciello
bb6b1a8693 Revert "amt: Add a security attestation for provisioning"
This reverts commit f160e6b7fc.
2020-05-22 15:13:19 +01:00
Richard Hughes
c821923668 Add an HSI attribute for Intel SMAP
See https://en.wikipedia.org/wiki/Supervisor_Mode_Access_Prevention for details.
2020-05-22 07:26:47 +01:00
Richard Hughes
0abba6cbb0 ata: A OUI quirk for Kingston
Fixes https://github.com/fwupd/fwupd/issues/2121
2020-05-21 11:16:08 +01:00
Vincent Huang
0a11350396 synaptics-prometheus: Force the minor version from 0x02 to 0x01 to make
sure the devices can be updated back to 0x01.
2020-05-19 15:12:10 +01:00
Mario Limonciello
7c8e9cf316 trivial: pci-mei: use driver to detect which plugin to use instead of a list
Let the kernel keep track of all the supported devices instead.
2020-05-19 09:05:52 -05:00
Richard Hughes
f6b48edebf pci-bcr: Read the ISA bridge BCR from the PCI device class
The SPI controllers are always identified with one of two device classes.
2020-05-18 21:16:59 -05:00
Richard Hughes
de8d40d602 tpm-eventlog: Do not return a security attr if there is no TPM device
There is literally no point in showing two TPM failures.
2020-05-18 15:43:23 -05:00
Richard Hughes
2157468709 pcr-bpc: Don't show the 'Not found' message for BLE and SMM_BWP
If we did not find the device for BIOSWP it is completely useless.
2020-05-18 15:43:23 -05:00
Richard Hughes
b246bcaecb Allow client tools to translate the HSI attributes and results
To do this, rely on the AppStream ID to map to a translated string (providing a
fallback for clients that do not care) and switch the free-form result string
into a set of enumerated values that can be translated.

This fixes some of the problems where some things have to be enabled to "pass"
and other attributes have to be some other state. For cases where we want the
user to "do" something, provide a URL to a wiki page that we update out-of-band
of fwupd releases.
2020-05-18 17:03:49 +01:00
Mario Limonciello
d67a77cb9d trivial: fix TME support
On a CPU that does support it the security check was still failing.
2020-05-16 06:16:57 +01:00
Richard Hughes
63fa4effd3 pci-mei: Check the ME device is not in manufacturing mode 2020-05-15 21:28:27 -05:00
Mario Limonciello
8b5bcbb9e3 Add a new plugin for IOMMU support 2020-05-15 11:32:51 -05:00
Mario Limonciello
6ecf511d52 trivial: pci-bcr: request pci udev subsystem
If another plugin didn't do this, the pci-bcr plugin doesn't work.
It's noticable by --plugin-whitelist=pci_bcr
2020-05-15 11:32:51 -05:00
Mario Limonciello
921c22725a trivial: acpi-dmar: Correct platform-opt in flag 2020-05-15 11:32:51 -05:00
Richard Hughes
8a71bd128f vli: Add no-guid-matching for all VLI devices
We need to detect different USB 3.x hubs on the ThinkPad Basic, Pro and Ultra
docking stations.
2020-05-15 16:38:18 +01:00
Richard Hughes
71d6fe5ffa vli: Remove a copy-and-paste mistake
This is not a PD device, it's a USB hub.
2020-05-15 16:38:18 +01:00
Richard Hughes
cae111d1de Save the plugin that created the FwupdSecurityAttr
This is really useful for debugging.
2020-05-15 16:17:27 +01:00
Richard Hughes
43451d458b pci-bcr: Fail HSI:1 if the BCR register cannot be loaded
Add obsoletes to attributes added by linux-spi-lpc if we're using the kernel
support for hidden PCI devices.
2020-05-15 09:17:33 -05:00
Mario Limonciello
983263bc8d cpu: Add support for a security attribute related to Intel TME
This only checks that it was available from the CPU.
To be complete an additional check should be made to show that it
was actually enabled from the firmware.

This will require a kernel modification though because MSR access
will be forbidden from userland while in kernel lockdown.
2020-05-15 07:16:17 -05:00
Richard Hughes
730e2bd6e3 linux-spi-lpc: Disable by default
The kernel patches are a log way from being upstreamed, so disable this until
there is even a chance the user might be running it.

This removes the obsoletes line from *every* system running 'fwupdmgr security'.
2020-05-15 10:21:07 +01:00
Richard Hughes
8fdefd459b pci-bcr: Read the PCI BCR config register from userspace
We can read this from userspace even when SB is turned on and with the kernel
locked down. The kernel securityfs patches are still in-progress, but will take
significant time to get upstream.

The kernel patches are needed when the PCI device is hidden from userspace.
2020-05-15 10:21:07 +01:00
Richard Hughes
fd732d219d trivial: Fix a -Wnull-dereference false positive 2020-05-14 16:45:45 -05:00
Mario Limonciello
05b9eb5936 trivial: remove an extra colon at the end of uefi-dbx error 2020-05-14 15:40:24 -05:00
HROMANO
7180536c69 Add two OUI quirks
Two OUI quirks outputed by 'fwupdtool get-updates' on my computer.
2020-05-14 15:19:54 -05:00
Michael
9d07b7c23c ata: Add WD OUI quirk 000cca 2020-05-14 13:21:20 -05:00
Mario Limonciello
d617d9e287 trivial: downgrade CET to HSI:3
This is not actually a system protection, but rather a theoretical
protection
2020-05-14 13:15:40 -05:00
Richard Hughes
5b24547197 synaptics-rmi: Essentially blacklist Dell K12A
Fixes https://github.com/fwupd/fwupd/issues/2052
2020-05-14 13:14:39 +01:00
Ilya Guterman
92da8a894d dfu: Avoid communicating when bitManifestationTolerant is off 2020-05-13 20:30:04 +01:00
Mario Limonciello
f160e6b7fc amt: Add a security attestation for provisioning 2020-05-13 11:58:19 -05:00
Mario Limonciello
66bab9d8f4 trivial: reword the security cases for a few plugins
On a system that is not at all locked down running an old kernel several
of the items are a bit confusing.

```
Runtime Suffix -!
✔  fwupd plugins: OK
✔  Linux Kernel: OK
✘  Linux Kernel: Could not open file
✘  Linux Swap: Not encrypted
```
2020-05-12 15:45:00 -05:00
Richard Hughes
c1eda7d516 Add many new plugins to support for the Host Security ID
The HSI specification is currently incomplete and in active development.

Sample output for my Lenovo P50 Laptop:

    Host Security ID: HSI:2+UA!

    HSI-1
    ✔  UEFI dbx: OK
    ✔  TPM: v2.0
    ✔  SPI: Write disabled
    ✔  SPI: Lock enabled
    ✔  SPI: SMM required
    ✔  UEFI Secure Boot: Enabled

    HSI-2
    ✔  TPM Reconstruction: Matched PCR0 reading

    HSI-3
    ✘  Linux Kernel S3 Sleep: Deep sleep available

    HSI-4
    ✘  Intel CET: Unavailable

    Runtime Suffix -U
    ✔  Firmware Updates: Newest release is 8 months old

    Runtime Suffix -A
    ✔  Firmware Attestation: OK

    Runtime Suffix -!
    ✔  fwupd plugins: OK
    ✔  Linux Kernel: OK
    ✔  Linux Kernel: Locked down
    ✘  Linux Swap: Not encrypted
2020-05-12 21:20:18 +01:00
Richard Hughes
f58ac7316c hsi: Abstract out the list of FwupdSecurityAttr objects for plugins
This exports FuSecurityAttrs into libfwupdplugin so that we can pass the plugins
this object rather than a 'bare' GPtrArray. This greatly simplifies the object
ownership, and also allows us to check the object type before adding.

In the future we could also check for duplicate appstream IDs or missing
properties at insertion time.

This change also changes the fu_plugin_add_security_attrs() to not return an
error. This forces the plugin to handle the error, storing the failure in the
attribute itself.

Only the plugin know if a missing file it needs to read indicates a runtime
problem or a simple failure to obtain a specific HSI level.
2020-05-12 16:47:24 +01:00
Richard Hughes
99cc658a75 tpm-eventlog: Add an HSI attr for reconstruction failure 2020-05-12 12:29:42 +01:00
Subhendu Ghosh
d1d83c083e ata: Add OUI quirk for Western Digital 2020-05-11 08:15:43 +01:00
Ilya Guterman
46f5415eda dfu: Support MATEKF722SE quirk
MATEKF722SE has unconvetional behavior for dfu protocol, where the sector size
isn't specified and sector type is shiffted left by 1. This happens only for
one sector.

Sector parsing from MATEKF722SE:

 * `016Kg`
 * `64Kg`
 * `128Kg`
 * `048 e`
 * `528e`
 * `004 e`
2020-05-09 20:19:57 +01:00
Mario Limonciello
cb6ec2b18e trivial: uefi-dbx: correct error message on missing file
```
unset error in plugin uefi_dbx for add_security_attrs()
```
2020-05-07 13:02:57 -05:00
Richard Hughes
b9640a28ec uefi-dbx: Add a plugin that analyses the UEFI dbx variable
This will be used for future functionality.
2020-05-07 16:59:36 +01:00
Richard Hughes
9ed79ae644 Fix various build issues with -Wdiscarded-qualifiers
Fixes https://github.com/fwupd/fwupd/issues/2068
2020-05-07 16:15:30 +01:00
Richard Hughes
d744fe8b67 linux-swap: Rename the plugin as it is Linux specific
We'll be adding other linux-foo plugins in the future, so it makes sense to get
the namespace correct now.
2020-05-07 12:42:34 +01:00
Mario Limonciello
768a2680a6 Introduce a new flag skips-restart
This flag is used internally by plugins to indicate that they will
skip the phase of firmware installation that power cycles a device.

It is intended to be set by quirks or other environment settings.
2020-05-06 15:13:40 -05:00
Richard Hughes
2d6456e019 cpu: Parse the CPU flags to detect the CET status
New enough hardware to have this feature isn't going to be in the marketplace
for a while. To use that newer hardware requires a very recent kernel (5.6 at
least, although it will probably be at least 5.9 by the time the hardware is
released).

The CET status will be used in future functionality.
2020-05-06 18:15:28 +01:00
Mario Limonciello
0cd2f10711 trivial: dell-dock: delay activation of the thunderbolt updates
There was some regression between 1.4.0 and now that prevented updates
containing a Thunderbolt controller from finishing.  They would just
sit pending Thunderbolt replug without ever finishing.

Remove the old hack for replug and instead push activation to the end
of the composite steps.

This is to avoid the device tree from changing significantly during
the update process.

This still isn't really ideal, we want to be able to add the flag
usable-during-update to the thunderbolt controller, but this requires
some extra work in the kernel.
2020-05-06 11:13:51 -05:00
Mario Limonciello
94874cd067 thunderbolt: Add a new subclassed thunderbolt firmware update type
Thunderbolt images brought in from the SPI don't have a FARB header.
Thunderbolt update images do.

So these two types of images need to be handled separately from the
firmware parser.
2020-05-06 11:13:51 -05:00
Richard Hughes
c368958518 swap: Add a plugin that parses /proc/swaps
This will be used for future functionality.
2020-05-06 15:09:59 +01:00
Jakob
f4b843db43 Add OUI quirk for SanDisk 2020-05-02 08:51:53 +01:00
Richard Hughes
0258c12af3 uefi: Manually call fu_device_setup() during coldplug
This forces the daemon to convert the main-system-firmware instance ID to a
GUID, which allows us to find it using fu_device_list_get_by_guid()
2020-05-01 19:26:52 +01:00
Richard Hughes
af917f558b vli: Add two standard USB instance IDs for shared-PD devices 2020-04-30 11:06:28 +01:00
Richard Hughes
cbc65bc071 vli: Use GPIOB to reset the VL817 found in two Lenovo products 2020-04-30 11:06:28 +01:00
Mario Limonciello
825c04df73 trivial: tpm-eventlog: Modify -p argument behavior
If using this argument, only display the final calculated value.
2020-04-29 13:18:53 -05:00
Mario Limonciello
38c80baff5 tpm-eventlog: Disambiguate the output at the end of fwupdtpmevlog
It's not obvious to users if this is the same value as tpm2-tools or the reconstructed value.
2020-04-29 13:18:53 -05:00
Mario Limonciello
e1c8c018a5 tpm-eventlog: Correct the display of final calculated PCRs
Although the calculation matched on my machine the actual numbers didn't
match PCR0 values from the tpm2-tools.  This was a display error.
2020-04-29 13:18:53 -05:00
Mario Limonciello
16a96fbbe7 thunderbolt: Allow quirks to skip the authentication step
This will allow being able to PoC some future kernel work to split
up steps.
2020-04-29 13:15:45 -05:00
Mario Limonciello
6358e23490 thunderbolt: drop support for force power
The kernel interface for force power doesn't support tracking the state
of the device, and so this had to be tracked by fwupd.

Unfortunately due to system and thunderbolt controller firmware behavior
on some systems the thunderbolt controller /still/ didn't return even
when force power state was accurately tracked.

The device model for the uevent related to the device removal being ignored
doesn't really fit into the current fwupd architecture anymore either.

Lastly this is a very legacy feature at this point.  Thunderbolt3 controllers
distributed in the last 3 years all operate in 'native' mode meaning that
they will always be powered and use runtime power management.

USB4 controllers won't have a concept of being force powered.
USB4 reimers will have this concept, but the state will be tracked by the
kernel and obfuscated from userspace.

So with all that said, tear out all of the force power related code.
2020-04-29 13:15:45 -05:00
Mario Limonciello
ec44dd3353 Modernize the thunderbolt plugin.
Remove it's references to it's own GUdevclient and instead use
FuUdevDevice.

Some intentional casualties of the move:
* Plugin metadata around native and safe mode dropped.
  - These haven't been useful in debugging anything and aren't relevant
    on new hardware
* Extra GUID for 2 host controllers in same system dropped
  - Although this was normally static information BIOS operations like
    turning off PCI-E SD card reader or LAN controller changed things.
* The NVM version is parsed directly instead of through gudev to prevent
  cached data breaking change events.

Remaining TODO:
* Force power w/ thunderbolt-power doesn't work
2020-04-29 13:15:45 -05:00
Mario Limonciello
767c29e2cc trivial: make building plugins without gudev more obvious failures 2020-04-29 13:15:45 -05:00
Crag Wang
e010c606e4 wacom-raw: fixup switching to bootloader mode 2020-04-28 10:19:38 -05:00
Richard Hughes
02930f1f23 trivial: Fix DFU debug output 2020-04-28 13:38:48 +01:00
Richard Hughes
4eaf882911 trivial: Fix a potential NULL deref spotted by Coverity 2020-04-27 16:12:55 +01:00
Mario Limonciello
55a42ddcbb thunderbolt: Don't show safe mode errors for USB4 host controllers
USB4 Controllers were showing up like this:

USB4 Controller:
     Device ID:           3df660bc4bdb67fd6fc101b34c6fd8cd235e3f97
     Summary:             Unmatched performance for high-speed I/O
     Current version:     00.00
     Update Error:        Device is in safe mode
     GUID:                4d86f168-e1cc-5995-afd3-ae9df6a14f5e -> TBT-safemode
     Device Flags:         Internal device
                           Requires AC power
2020-04-23 14:13:38 -05:00
jf049
f0a3bf0436 trivial: Add OUI quirk for ADATA 2020-04-23 06:47:19 +01:00
Daniel Peukert
3cebd5aa89 trivial: Add OUI quirk for LITE-ON 2020-04-22 12:43:39 -05:00
Daniel Peukert
8a4b32f699 trivial: Reorder OUI quirks by OUI ID 2020-04-22 12:43:39 -05:00
Richard Hughes
c92a2caf16 ep963x: Various changes to make the plugin actually work on real hardware 2020-04-22 12:27:44 +01:00
Richard Hughes
0d4e2ca4c5 Make tss2-esys conditional
This is not provided in RHEL 8 in the default build root.
2020-04-22 09:36:14 +01:00
Richard Hughes
7b0023de7f ep963x: Remove some dead code spotted by Coverity 2020-04-21 16:45:31 +01:00
Richard Hughes
b74db0618c ccgx: Only update the FW2 partition of the ThinkPad USB-C Dock Gen2 2020-04-21 14:34:03 +01:00
Richard Hughes
6adbcd2e62 ccgx: Expand the FWImageType for future hardware
This is needed to handle devices that do need the bootloader updated before the
actual firmware image.
2020-04-21 14:34:03 +01:00
Richard Hughes
53e22ed0c1 wacom-usb: Fix a theoretical buffer over-read to make GCC happy 2020-04-20 15:50:10 +01:00
Richard Hughes
36f3218da9 vli: Only show the i2c devices on the USB3 hub
If the hub is running in degraded USB2 recovery mode do not enumerate the
easy-to-brick MSP430 device.
2020-04-18 14:52:50 +01:00
Richard Hughes
ec279f161c ccgx: Always report 100% when finished writing 2020-04-17 21:49:15 +01:00
Richard Hughes
da645fe912 ccgx: Set the device name and summary from quirk files
Based on a patch by Ryan Lee <ryle@cypress.com>, many thanks.
2020-04-17 21:48:02 +01:00
Richard Hughes
cacf14e54f trivial: Add OUI quirk for Toshiba 2020-04-17 18:48:35 +01:00
Richard Hughes
518712ac09 vli: Only do the APP5 FW bug fix on affected hardware 2020-04-17 16:09:32 +01:00
Richard Hughes
5997f2a7da vli: Show all the buffer when debugging with FWUPD_VLI_USBHUB_VERBOSE 2020-04-17 14:15:50 +01:00
Richard Hughes
08d5caa758 ccgx: Split out a trivial helper to set the instance IDs
As a consequence, the version number is also set in the event that the silicon
or firmware app-id is not set, which also seems like the right thing to do.
2020-04-16 15:52:55 +01:00
Richard Hughes
919d90e941 ccgx: Set the device name to be more useful
Based on a patch by Ryan Lee <ryle@cypress.com>, many thanks.
2020-04-16 15:52:55 +01:00
Richard Hughes
e419792c61 ccgx: Set the logical ID as the FwMode 2020-04-16 15:52:55 +01:00
Richard Hughes
d41e8254ca ccgx: Split out a trivial function to set the version 2020-04-16 15:52:55 +01:00
Richard Hughes
71f5eaa371 ccgx: Do not reboot the device write after installing
Since a8c6c0 we do not conditionalize the attach on the BOOTLOADER flag, and so
attach gets run once manually, and then again automatically.
2020-04-16 15:52:55 +01:00
Richard Hughes
54e3feae12 ccgx: Do no show the flash parameters when unknown 2020-04-16 15:52:55 +01:00
Richard Hughes
1283c2696d Do not skip attach() if the device is marked _WILL_DISAPPEAR
The idea here is that the device would not come back after it was restarted,
and skipping the attach in the engine was only working around the fact that the
ebitdo did not split out an ->attach() function.

We can't really blame it; we only decoupled the _IS_BOOTLOADER requirement
for ->attach() recently...
2020-04-16 08:43:45 -05:00
Richard Hughes
a1ef52e5f9 dell-dock: Port to using fu_device_get_proxy()
This also cleans up the memory handling to prevent a ref-cycle loop that
prevented the dock devices from being finalized if the dock was removed.
2020-04-15 20:34:31 +01:00
Richard Hughes
e95613f670 vli: Do not show the USB 2 recovery devices for USB 3 hubs
The USB 2.0 controller is used as a 'backup' in case the USB 3.0 firmware fails
to start. Set USB 3 hubs as a greater priority so that the USB 2 ones do not
not get added if the USB 3 firmware is working.
2020-04-15 14:11:06 +01:00
Richard Hughes
95c3bf2617 vli: Add metadata to identify which is the same physical device 2020-04-15 14:11:06 +01:00
Sam Morris
6a161aa1d1 uefi: correctly format firmware version of Dynabook (né Toshiba) X30, X40 and probably others
Fixes #1998
2020-04-15 13:00:26 +01:00
Richard Hughes
a86b08f27c synaptics-cxaudio: Use the ->attach() device vfunc
This allows us to test the device reset using fwupdtool.
2020-04-15 12:36:11 +01:00
Richard Hughes
f23a906cfb synaptics-cxaudio: Wait for the device to reboot after writing firmware
Fixes an error where we get:

    failed to reload device: USB error on device 17ef:a396 : No such device
2020-04-15 12:36:11 +01:00
Mario Limonciello
de60e04481 logitech_hidpp: decrease verbosity of messages that hid++ ID is missing
These are a regression of 9e755e2a5 when devices are asleep.
However due to the current kernel and daemon architecture, logitech devices
are not checked again at any time so if the device isn't awake when
fwupd is started or the unifying dongle is plugged in it won't be present.

This will be changed in the future when the kernel has change events
associated with devices waking up.

Fixes: #1973
2020-04-14 11:26:22 -05:00
Richard Hughes
cf0a7678b8 Allow removing device flags from quirk files
This also means we do the right thing when plugins call fu_device_add_flag()
directly, instead of just from a quirk file.

For instance, now `Flags = ~updatable` is a valid and useful thing to have and
allows us to remove the `Flags = None` hack.
2020-04-13 23:18:19 +01:00
Richard Hughes
fe11927eef Use black to format python source in a consistent manner
No code changes.
2020-04-13 23:06:30 +01:00
Richard Hughes
a8c6c02459 Do not conditionalize attach() and detach() on IS_BOOTLOADER
This is nice in theory, until you need to look at the bootloader status of the
parent, or of a different device entirely. Handle this in plugins for the few
cases we care about and stop setting or clearing IS_BOOTLOADER manually just to
get the vfuncs to be run.

Note: I do not think we want to use cleanup() for attaching devices not in
bootloader states -- as cleanup is only run at the end of the composite update.
2020-04-09 09:55:30 +01:00
Richard Hughes
508fb380d0 wacom-usb: Add more sanity checks in case the daemon goes crazy 2020-04-08 16:30:15 +01:00
Richard Hughes
385b3b29b4 wacom-usb: Use a per-device cleanup function
We never had this when the plugin was created and it makes bluetooth updates
without main firmware updates reboot the device correctly.
2020-04-08 16:30:15 +01:00
Richard Hughes
3fc550e9ed wacom-usb: Add a lot of missing metadata about the devices 2020-04-08 13:55:39 +01:00
Richard Hughes
46eefe72c1 wacom-usb: Hide a lot of debugging behind FWUPD_WACOM_VERBOSE 2020-04-08 13:55:39 +01:00
Richard Hughes
cddf5b5b89 Only auto-add counterpart GUIDs when required
Doing this unconditionally means we accidentally 'bleed' one device mode into
another in a non-obvious way. For instance, a device might have two operating
modes with different GUIDs. If firmware is supplied for both modes in the same
cabinet archive then we might accidentally match the 'wrong' firmware when
the daemon has observed a mode switch and added the counterpart GUIDs.

We only really need the counterpart GUIDs when switching between Jabra, 8bitdo
and DFU devices where the DFU bootloader VID:PID is not manually tagged with
`CounterpartGuid` in a quirk file. In the general case lets keep it simple to
avoid difficult to find bugs.
2020-04-08 13:55:39 +01:00
Ryan Lee
ac58360be7 ccgx: remove update message 2020-04-08 13:27:37 +01:00
Ryan Lee
d3fe478168 ccgx: add parent guid for hybrid dock 2020-04-08 09:09:54 +01:00
Richard Hughes
d38baba712 ccgx: Use a smaller timeout for i2c read and write operations 2020-04-07 19:50:43 +01:00
Richard Hughes
ebaa488b64 ccgx: Retry the register read and write with a i2c reset
Based on a patch by Ryan Lee <ryle@cypress.com>, many thanks.
2020-04-07 19:50:43 +01:00
Richard Hughes
2e0954f5c9 ccgx: Fix buffer overflow when reading out i2c status
Based on a patch by Ryan Lee <ryle@cypress.com>, many thanks.
2020-04-07 19:50:43 +01:00
Richard Hughes
1ae10f1016 Revert "ccgx: Reset the i2c bridge on status failure"
This reverts commit 49797d7de4.
2020-04-07 19:50:43 +01:00
Richard Hughes
5a7095dee4 ccgx: Retry the HID disconnect up to 5 times
Based on a patch by  Ryan Lee <ryle@cypress.com>, many thanks.
2020-04-07 19:50:43 +01:00
Richard Hughes
920713245d ccgx: Show a better error message on failure 2020-04-07 12:50:28 -05:00
Richard Hughes
481b01046b ccgx: Allow forcing firmware of the wrong app_type with fwupdtool
If we corrupt the flash, the app_type is 0x0 and we need to force this with a
known-good image to recover the hardware. Ask me how I know.
2020-04-07 18:43:31 +01:00
Ryan Lee
b9fecc4b9c ccgx: Fix critical warning on i2c write failure 2020-04-07 10:47:01 +01:00
Richard Hughes
9e755e2a5c logitech-hidpp: Do not add peripheral devices for receiver in BL mode
This should fix flashing firmware when there are >= 2 receivers plugged in.

Fixes https://github.com/fwupd/fwupd/issues/1951
2020-04-06 14:20:46 -05:00
Richard Hughes
ca03290a12 vli: Only reboot the USB hub once
The cleanup action for the FuVliUsbhubPdDevice is correct, but was not
conditionalized in the composite cleanup, which meant we would reboot twice
for a normal USB hub update.

Move the parent reboot into the right place, although this does mean we might
reboot twice in the rare event of scheduing a FuVliUsbhubPdDevice *and*
FuVliUsbhubDevice update in the same transaction -- but resetting the device
state between updates is arguably correct anyway...
2020-04-02 13:23:40 +01:00
Richard Hughes
2671aaceb2 synaptics-cxaudio: Only use the PATCH2 address when the patch level is 2 2020-04-02 13:23:16 +01:00
Ilya Guterman
257df03f58 add STM32F745 stm dfuse quirk 2020-04-02 13:22:53 +01:00
Richard Hughes
5af1dc69d4 dfu: Add a way to set the timeout from a quirk 2020-04-02 13:22:28 +01:00
Richard Hughes
b951a18fae ccgx: Do not add the HID device that will disconnect 2020-04-01 10:38:50 +01:00
ChangHee (Ryan) Lee
60103e2207 ccgx: Use Silicon ID and Application type to set flash parameters
Also remove unused instance id and fix application type matching as we now get
the image type from the quirk file.
2020-04-01 10:38:50 +01:00
Mario Limonciello
61f74077ed trivial: dfu: drop quirk to hide DW1820A
This can't actually damage the device, it was just showing the wrong flags.
The device is also EOL, so it won't even be seen on most modern machines.
2020-03-31 13:05:57 -05:00
Mario Limonciello
80d9b7450c logitech_hidpp: set the bootloader protocol 2020-03-31 13:05:42 -05:00
Richard Hughes
6fa43550fc vli: Wait for the VL103 to timeout to fix detach
The default re-enumeration delay is not sufficient.
2020-03-31 09:34:15 +01:00
Richard Hughes
61d9449d31 ccgx: Show the UpdateMessage in the correct device mode 2020-03-31 08:59:27 +01:00
Richard Hughes
be12af78f0 ccgx: Add extra instance IDs to match specific firmware
The VID:PID of the device in HPI mode is shared between multiple vendors, and
so we need to use both the silicon ID and the application ID to match specific
firmware updates.
2020-03-31 08:59:27 +01:00
Mario Limonciello
97acc2bf74 thunderbolt: Rather than hardcoding to PCI slot numbers, use domain in GUID
This allows the PCI topology to change, but assumes that thunderbolt host controllers
are enumerated in the same order every time.
It won't matter if the first controller jumped from bus 5 to 7 and consequently the
second from 65 to 71, but rather that the first was enumerated followed by the second.
2020-03-28 09:52:38 -05:00
Mario Limonciello
e6d76a594c Revert "thunderbolt: Create a unique GUID including Thunderbolt controller path"
This reverts commit 7e38dffdcb.
2020-03-28 09:52:38 -05:00