Commit Graph

142 Commits

Author SHA1 Message Date
Richard Hughes
4d2c0f8047 trivial: Fall back to the HSI ID if the name is not available
This fixes a crash if you 'ninja install' with a newer fwupd version and then
run fwupdtool from an older version.
2020-07-07 12:02:35 +01:00
Richard Hughes
fb0a938f6c Cache the FuSecurityAttrs in the daemon
At the moment at startup we're calculating the attrs so we can export the HSI
string property on the D-Bus interface. Running `fwupdtool security` actually
gets all the security attributes at least twice!
2020-07-03 20:47:28 +01:00
Mario Limonciello
a2431e07ff trivial: fu-udev-device: add support for exporting the udev device type
This is useful in some plugins that will behave differently for
multiple device types.
2020-07-03 12:56:44 -05:00
Mario Limonciello
89a11acdaa trivial: update various symbols to 1.4.5
See https://github.com/fwupd/fwupd/pull/2235 for details
2020-06-30 11:52:26 -05:00
Richard Hughes
d9f3bec6d0 trivial: Fix GtkDoc issue with FuFmapFirmware 2020-06-29 15:49:14 +01:00
Richard Hughes
4fd4b982ac Support LVFS::UpdateImage in GUI clients
The idea here is that we can show the user both a string and an optional
line-art image when the update has completed. The line art is often more well
understood for non-English speakers.
2020-06-26 12:29:54 +01:00
Richard Hughes
664b8aa9ad Add XB_QUERY_FLAG_FORCE_NODE_CACHE
Newer versions of libxmlb do not auto-cache XbNodes, and we have to opt-into
this beahviour for the _set_data() and _get_data() to work.

Although this is a behaviour change which also increases complexity, it lowers
our RSS usage by 200kB which is about a quarter of the total RSS used...
2020-06-23 16:30:38 +01:00
Mario Limonciello
412e170b26 trivial: libfwupdplugin: add a new method to write strings to sysfs files 2020-06-22 16:09:10 -05:00
Richard Hughes
aae22e4df5 trivial: Always clear the mutex before clearing the thing it protects 2020-06-22 21:55:50 +01:00
Richard Hughes
11c5941f23 libfwupdplugin: Make FuPlugin::rules lazy loaded 2020-06-22 21:55:50 +01:00
Richard Hughes
ea327fc13f libfwupdplugin: Make FuPlugin::udev_subsystems lazy loaded
In most cases except tests the engine uses fu_plugin_set_udev_subsystems()...
2020-06-22 21:55:50 +01:00
Richard Hughes
371f6b2bfa libfwupdplugin: Make FuPlugin::devices lazy loaded
Most plugins don't actually use the per-plugin cache...
2020-06-22 21:55:50 +01:00
Richard Hughes
1d900f7d60 libfwupdplugin: Make FuPlugin::report_metadata lazy loaded 2020-06-22 21:55:50 +01:00
Richard Hughes
4d7edc65b0 libfwupdplugin: Lazy load FuDevice::metadata 2020-06-22 21:55:50 +01:00
Richard Hughes
5bb537c214 libfwupdplugin: Fix trivial memory leak when using fu_udev_device_incorporate()
This also adds two missing property notify events.
2020-06-22 15:55:02 +01:00
Benson Leung
23ca19acf8 fmap-firmware: Parse flashmap format into images
Implements a search for the fmap, and follow the map to break the firmware
into the constituent images.

Tested using a servo_micro firmware:
$ fwupdtool firmware-parse servo_micro_v2.4.17-df61092c3.bin
<select fmap option>
FuFmapFirmware:
  FuFirmwareImage:
  ID:                    EC_RO
  Index:                 0x1
  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
  Data:                  0x10000
  FuFirmwareImage:
  ID:                    RW_FWID
  Index:                 0x7
  Address:               0x100c4
  Data:                  0x20
2020-06-20 07:24:32 +01:00
Benson Leung
acba98bd50 fmap-firmware: Add initial skeleton for fmap
fmap is a Google flash layout format that is used in several of Google's
firmware projects, including Chrome OS Embedded Controller and the Chrome OS
coreboot firmwares. Introduce it as a firmware format in libfwupdplugin.
2020-06-20 07:24:32 +01:00
Richard Hughes
1ec96e31f5 Allow plugins to set remove delay only on the child
Force the FuDevice parent to have the largest of the child removal delays.
This avoids each plugin enumerating the children (which may not even be added
yet) to increase the length of the allowed parent delay.
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
Richard Hughes
2e3605ffdc trivial: Add RemoveDelay as a standard FuDevice quirk 2020-06-05 12:17:52 +01:00
Richard Hughes
bdfccdf097 Allow multi-byte FuUdevDevice preads and writes 2020-05-29 17:34:18 +01: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
Richard Hughes
bd44432240 trivial: Fix a build failure on aarch64
It seems cpuid.h isn't available everywhere, which make sense in retrospect.
2020-05-21 12:05:05 +01:00
Richard Hughes
3ecd22c764 trivial: Fix fu_plugin_runner_add_security_attrs() gtk-doc header 2020-05-19 20:13:47 +01:00
Richard Hughes
e56fe2a0ca trivial: Fix fu_efivar_set_data() gtk-doc header 2020-05-19 20:13:26 +01:00
Mario Limonciello
e36d3e3faa trivial: fu-udev-device: create another instance ID for the driver 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
Mario Limonciello
b0e1e5ec12 Add daemon version into the HSI string 2020-05-18 15:41:51 -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
Richard Hughes
63fa4effd3 pci-mei: Check the ME device is not in manufacturing mode 2020-05-15 21:28:27 -05: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
Mario Limonciello
0f68c29908 trivial: Sort the HSI attribute list in the daemon
Sort by level, success/fail/obsoleted, then by name.
2020-05-15 10:21:07 +01:00
Richard Hughes
4661cc52d7 trivial: Set a log domain for the obsoleted message 2020-05-15 10:21:07 +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
399859e48b trivial: Allow plugins to signal that the security status has changed 2020-05-11 22:11:49 +01:00
Richard Hughes
196c6c69db Add support for the Host Security ID
The HSI specification assigns a simple text ID to the current state of firmware
security. As new vulnerabilities are found, and as protection measures are
updated, new requirements will be added to the required firmware behaviours for
each HSI value.

The HSI specification is currently incomplete and in active development, and
so the --force flag is required in all command line tools. The current ID value
will probably change on a given platform so please do not start using the result
for any kind of compliance requirements.
2020-05-11 22:11:49 +01:00
Richard Hughes
a715791707 Add a new path enum of FU_PATH_KIND_ACPI_TABLES 2020-05-11 17:53:50 +01:00
Richard Hughes
6a07870fa2 Add a vfunc that gets run after the device has been added
This allows per-plugin actions after the device has been open()ed and started.
2020-05-10 20:34:56 +01:00
Richard Hughes
9223c89019 trivial: Add a helper method to check for an Intel CPU
Some plugins will be Intel specific.
2020-05-10 17:49:13 +01: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
a84d7a7e2a trivial: Add fu_common_filename_glob() for future use 2020-05-07 16:59:36 +01: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
Richard Hughes
748a65f3c7 trivial: Post branch version bump
We're planning to ship fwupd 1.4.x in RHEL 8 and so it makes sense to have a
stable branch to do point releases. I don't intend to release versions 1.5.x
any time soon, so moderately-agressive backporting to 1_4_X is okay.
2020-05-05 11:34:17 +01: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
096e3cfbb6 fu-plugin: add a new udev_device_changed function that calls rescan 2020-04-29 13:15:45 -05:00
Mario Limonciello
0d207d8dea fu-udev-device: add fu_udev_device_get_parent_name
This will fetch the name from parent device
2020-04-29 13:15:45 -05:00
Mario Limonciello
224b685fae fu-udev-device: Add support for reading arbitrary sysfs attributes
Some devices provide 'non-standard' attributes that are relevant
for use.
2020-04-29 13:15:45 -05:00
Richard Hughes
1bde4fdd29 Fix the DeviceID set by GetDetails
The returned ID is the result of the SHA1 hash of the actual device ID. This
does not match anything found by the client, and so the install fails.

The symbol is exported as I think the device ID is an important identifier and
used in various fwupd tools.

When backported to the stable branch the verification should just be a static
function in src/fu-engine.c rather than a new symbol.
2020-04-20 17:42:22 +01:00
Richard Hughes
6f6f1161a9 trivial: Set the quirk object automatically from the parent
This means we do not have to manually set the quirks for each child, and means
we get the quirk set at object construction before any instance IDs are set.
2020-04-17 17:47:40 +01:00
Richard Hughes
f9b9af5fca trivial: Allow setting device parents using GObject properties
Fix copy-paste accidental regression introduced in cafcc4.
2020-04-17 14:01:28 +01:00