Commit Graph

1698 Commits

Author SHA1 Message Date
Mario Limonciello
abfc72d6c0 trivial: add a missing assertion in self test 2020-08-10 10:33:31 -05:00
Mario Limonciello
0ebddc9fcf trivial: fix some unused variables found by clang-10 2020-08-10 10:33:31 -05:00
Richard Hughes
1a58062be9 Refresh the handle to device before testing ANOTHER_WRITE_REQUIRED
fu_engine_install_blob may result in the device being reset during attach or
detach and needing to be replugged.
The device handle we're holding may be stale, but it is still used by the do
while loop itself for the ANOTHER_WRITE_REQUIRED test.

Similar to the other functions in the loop, let's get the device handle by id
in case that happened.

Original patch by Benson Leung <bleung@chromium.org>, many thanks.

Fixes https://github.com/fwupd/fwupd/issues/2297
2020-08-03 19:30:01 +01:00
Benson Leung
8b9f9ab47a Save custom flags on device replace
New instances of a device may be interested in custom flags. Copy them
over on fu_device_list_replace.

fixes #2298
2020-08-03 18:02:43 +01:00
Richard Hughes
cad96542e2 Check if CET is actually being used on the runtime system
With thanks to H.J. Lu <hjl.tools@gmail.com> for the initial code.
2020-07-27 15:53:38 +01:00
Richard Hughes
fa34c319da trivial: Translate the FwupdSecurityAttrFlags suffix 2020-07-27 11:00:11 +01:00
Torsten Hilbrich
9b819e634c fu-util: Allow get-updates without download remotes
If a system is configured without any downloadable remotes (e.g. with
a remote pointing to a local directory) the call of

fwupdmgr get-updates

fails by outputting "No remotes enabled." even though the call
"get-remotes" clearly shows the configured remote.

I found the following commit:

commit 991c95697e
Author: Mario Limonciello <mario.limonciello@dell.com>
Date:   Wed Jun 17 15:23:13 2020 -0500

    trivial: fu-util: correct an assertion when no remotes configured

introduced the problem. In the call chain:

fu_util_get_updates
-> fu_util_perhaps_refresh_remotes
-> fu_util_check_oldest_remote

the function fu_util_check_oldest_remote now returns FALSE if no
remote of kind FWUPD_REMOTE_KIND_DOWNLOAD is found.

The function fu_util_perhaps_refresh_remotes then returns FALSE
indicating failure even though without a downloadable remote the
concept of refreshing is not useful.

I think, we should return TRUE in this case, as no refresh is needed
and the operation can continue.

As the failure of fu_util_check_oldest_remote is ignored we also need
to pass NULL as error pointer here.

The use-case of this scenario without downloadable remote is by
distributing firmware updates through software updates where the
vendor directory with the capsule file is provided.
2020-07-22 22:06:55 -05:00
Richard Hughes
30f7ffbdbd pci-mei: Split up the bootguard HSI checks into multiple entries
Additionally, demote the error policy to HSI-3 and do not show the other
failures if BootGuard is disabled.

Fixes https://github.com/fwupd/fwupd/issues/2265
2020-07-20 22:50:31 +01:00
Richard Hughes
f8c10c2b11 Use --plugins for the fwupdtool argument name
This is much more obvious than --plugin-enable=foo,bar,baz ever was.
2020-07-20 22:50:31 +01:00
Richard Hughes
9a04ce8f29 msr: Add a new plugin to detect the Intel DCI state 2020-07-16 20:13:06 +01:00
Richard Hughes
f4c55d888e libfwupd: Add fwupd_client_install_release()
This allows us to remove a lot of copy-and-paste code in GNOME Software.
2020-07-09 20:57:00 +01:00
Richard Hughes
d528571971 libfwupd: Add fwupd_client_refresh_remote()
This takes care of downloading the correct files and allows remotes to be
refreshed from other CLI and GUI tools without copying large chunks of code.

This also allows us to download the metadata without writing two temp files
to the users cache directory. Although not security sensitive, it's probably
not a good idea if we can avoid it.
2020-07-09 20:57:00 +01:00
Richard Hughes
cc93f7c336 trivial: Allow the uset to set the ApprovalRequired remote value
This allows the local user with appropriate permissions to do:

    fwupdmgr modify-remote lvfs ApprovalRequired true
2020-07-09 12:52:38 +01:00
Richard Hughes
907fd15e55 trivial: Fix two hard to translate strings 2020-07-08 21:08:46 +01:00
Richard Hughes
9b6d616383 fwupd: Export fwupd_client_download_bytes() into the client library
The logic here is that we can use one central session for all client actions.

Also, set the user agent for the *runtime* version of fwupd -- it's the runtime
version we use when checking capabilities, rather than the built-against
version. This would also explain why there are so many very obsolete versions
of fwupd being recorded on the LVFS...
2020-07-08 19:00:42 +01:00
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
eb7be16bf0 fu-util/fu-tool: Group devices in get-updates/update calls
Fixes: #1840
2020-07-03 11:58:34 -05: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
b99df2ef93 Use the security attributes to construct a better name
Fixes https://github.com/fwupd/fwupd/issues/2184
2020-07-01 20:10:39 +01: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
Mario Limonciello
4b69830e1c trivial: minor optimization for no timestamp case 2020-06-30 10:46:49 -05:00
Mario Limonciello
eaf7f0b529 trivial: convert log warnings to ASCII
Fixes: #2234
2020-06-30 10:46:49 -05:00
Richard Hughes
df89cd566e Allow firmware to require specific features from front-end clients
At the moment we just blindly assume the capabilities of the front-end client
when installing firmware. We can somewhat work around by requiring a new enough
fwupd daemon version, but the client software may be older or just incomplete.

This would allow, for instance, the firmware to specify that it requries the
client to be able to show a detach image. This would not be set by a command
line tool using FwupdClient, but would be set by a GUI client that is capable
of downloading a URL and showing a PNG image.

Clients that do not register features are assumed to be dumb.
2020-06-27 15:43:57 +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
c5710d91bd Be more defensive when remotes are missing required keys
Fixes half of https://github.com/fwupd/fwupd/issues/2223
2020-06-26 12:29:08 +01:00
Richard Hughes
890dd12d70 trivial: Fix GetDetails with libxmlb 0.2.x 2020-06-25 22:49:44 +01:00
Mario Limonciello
c2721c8695 fu-util: Only show UpdateMessage when state is success
This will show it only when an update was sucessful.
Fixes: #2212
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
a11eab61e1 trivial: fu-util: show a better error for non-responsive daemon
See #2212 for more context.
2020-06-24 08:19:15 -05:00
Richard Hughes
35ac0727d3 Use libxmlb bound parameters to speed up te device verification
This means we only parse the complicated xpath query once, rather than for
every GUID the device has.

The code flow is also simplified and split out into two functions.
2020-06-23 17:30:00 +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
Richard Hughes
4a4377fab0 Disable the SQLite lookaside cache
This saves ~45Kb of RSS and has no measurable slowdown when reading from the
pending database.
2020-06-23 15:01:50 +01: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
1d900f7d60 libfwupdplugin: Make FuPlugin::report_metadata lazy loaded 2020-06-22 21:55:50 +01:00
Richard Hughes
3444cf629b Lazy load FuEngine::approved_firmware
The common case is no approved list, and an empty hash table.
2020-06-22 21:55:50 +01:00
Richard Hughes
d63cedc444 Check all AppStream components when verifying
Additionally, ignore the 'not found' error codes so we drop down to the release
missing error.

Fixes https://github.com/fwupd/fwupd/issues/2196
2020-06-21 15:14:28 +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
Mario Limonciello
5164e713f6 trivial: fix issue with agent on but man off
Fixes: #2192
2020-06-18 13:37:12 -05:00
Mario Limonciello
1b8047be1d trivial: fu-util: correct an assertion when no remotes configured
```
(fwupdmgr:185983): FuMain-CRITICAL **: 15:20:57.044: fu_util_time_to_str: assertion 'tmp != 0' failed
```
2020-06-17 15:49:39 -05:00
Richard Hughes
6d9ae625ed trivial: Move the report success report to common code
This would allow us to use it from fwupdagent in the future.
2020-06-16 15:49:28 +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
e012513bed trivial: Allow modifying the historical device metadata 2020-06-16 15:49:28 +01:00
Richard Hughes
4837ab5a22 trivial: Simplify marking devices as reported 2020-06-16 15:49:28 +01:00
Richard Hughes
589270a7c4 trivial: Simplify some reporting code
This is not a fast path, so make getting the FwupdRemote simpler.
2020-06-16 15:49:28 +01:00
Richard Hughes
e261bb6fa0 Record the UEFI failure in more cases
Ensure the historical error is set for failed NEEDS_REBOOT UEFI devices that do
not set LastAttemptStatus.
2020-06-15 16:16:37 +01:00
Richard Hughes
7f7f0aed1f trivial: Add more items to the kernel command line checker
This data is from Pascal Ernster, many thanks.
2020-06-15 12:11:00 +01:00
Richard Hughes
d94ce34d56 trivial: Add more items to the kernel command line checker
This data is from Pascal Ernster, many thanks.
2020-06-12 20:56:17 -05:00
Richard Hughes
afda962cba Fix regression when checking for downgraded metadata
When verifying a signature the valid results are ordered by timestamp. The
CHECKSUM results have a zero timestamp and should have been ordered last.
The sorting callback was wrong, which explains the odd result where we could
downgrade Jcat signatures before we fixed 64ebf9, and nicely explains why we
ignored a timestamp of zero in the first place.

When getting the timestamp, ensure we actually get the newest _signature_ not
just the newest result in case checksums start having timestamps in the future
for some reason. Use new API from libjcat where available, else fall back to
sneaking it out using GObject properties and magic values.
2020-06-10 15:21:54 +01:00