Commit Graph

2433 Commits

Author SHA1 Message Date
Richard Hughes
c4b7f42e43 Only compress one version of the builtin-quirks
Saving the quirks in the GResource section worked well, but it made the build
system very complicated and also meant the .data section was duplicated in
both `fwupd` and `fwupdtool` -- negating a lot of the hard-fought savings.

Simplify this feature so that we just `cat` all the quirk files together, then
gzip them into a single file. This means that at startup fwupd only needs to
check the mtime of one file, and weirdly it's actually faster to load a smaller
compressed file from disk that it is to load multiple uncompressed files.
2022-09-27 12:44:04 +01:00
Richard Hughes
3195a57485 trivial: Always use g_assert_no_error() first
It's way more helpful to print the GError message than just an boolean failure.
2022-09-27 12:10:07 +01:00
Richard Hughes
0415db6f67 Revert "trivial: Use files() rather than current_source_dir()"
This reverts commit b581fa5670 as it breaks
`ninja dist` with `-Dgresource_quirks=enabled`.
2022-09-25 10:31:14 +01:00
Richard Hughes
b581fa5670 trivial: Use files() rather than current_source_dir() 2022-09-24 09:12:14 -05:00
Richard Hughes
b50ef90aa6 trivial: Fix up some internal docs to reflect reality 2022-09-23 16:39:21 +01:00
Richard Hughes
ec493527c3 trivial: Fix the Pre-boot DMA protection HSI long description
The original string is ambiguous to translate and logically incorrect.
2022-09-22 16:54:26 +01:00
Richard Hughes
c73a55faa1 Remove a potential foot-gun when saving config values
If a specific plugin calls fu_plugin_set_secure_config_value() and then
fu_plugin_set_config_value() then we'll save the file with the world-readable
permissions.

Set a plugin flag to say that 'this plugin is storing sensitive details' which
allows us to use the same entrypoint and also fix up any files at startup that
do not have the correct permissions.
2022-09-22 14:47:12 +01:00
Richard Hughes
5d38e0aeea Move the getting the ESP to the context
We now have two plugins getting the ESP values, and we only allow hardcoding
the ESP in uefi_capsule.conf.

Make all this a lot simpler by moving the ESP+BDP code to `FuContext`, which
also means we can handle the override (via the config file) in the engine,
and the override (in the command line tools) using the same mechanism.

Also, automate the migration of the `OverrideESPMountPoint` -> `EspLocation`
when loading the engine.

Fixes https://github.com/fwupd/fwupd/issues/5042
2022-09-22 14:31:06 +01:00
Richard Hughes
e72ed08b56 Always check the BDP partitions when getting all the possible ESPs
Fixes https://github.com/fwupd/fwupd/issues/5035
2022-09-17 13:41:36 +01:00
Mario Limonciello
fbe9c6444e trivial: fu-util-common: RO devices w/ FW versions are interesting
Sometimes even if fwupd can't upgrade these devices they're
interesting to end users because they may show information that
can otherwise only be obtained by tearing apart firmware or
using extra arguments.

Amend the default behavior to let these show up.
2022-09-13 09:57:29 -05:00
Richard Hughes
bfebede490 Add support for platform capability descriptors so devices can set quirks
This feature adds support for platform capability BOS descriptors which allows
the device itself to ship quirk data.

Use `sudo fwupdtool get-devices --save-backends=FILENAME` to save fake backend
devices to a file. This allows easy creation of self tests that do not require
physical hardware.
2022-09-13 12:07:35 +01:00
Richard Hughes
e8684d9f65 Check for plugin conflicts slightly quicker 2022-09-09 19:23:29 +01:00
Richard Hughes
c19d7d8b9f trivial: Workaround PVS false-positive 2022-09-09 19:23:29 +01:00
Richard Hughes
f7b4f43744 Fix checking for invalid depth requirements
PVS: It's possible that the 'device_tmp' should be checked here.
2022-09-09 19:23:29 +01:00
Richard Hughes
4b16f66948 trivial: Check for impossible NULL child before dereferencing
PVS
2022-09-09 19:23:29 +01:00
Richard Hughes
aa71485cc5 trivial: Fix a few theoretical memory leaks that can't happen in reality
PVS: The function was exited without releasing the 'str' pointer.
2022-09-09 19:23:29 +01:00
Richard Hughes
f49d5ed10c trivial: Fix invalid printf() usage
PVS: The line being passed could contain format specification.
2022-09-09 19:23:29 +01:00
Richard Hughes
76138349e2 Fix a potential critical warning when parsing firmware
PVS: The 'filename' pointer was utilized before it was verified against nullptr.
2022-09-09 19:23:29 +01:00
Richard Hughes
5e3a601da9 trivial: Remove a useless g_return_val_if_fail()
PVS: Expression 'sender != NULL' is always true.
2022-09-09 19:23:29 +01:00
Richard Hughes
aaf1f21dd3 Limit the archive size to 25% of the RAM, or 4G
PVS: Expression is always false
2022-09-09 06:12:14 -05:00
Richard Hughes
ce014ccf65 trivial: Fix a tiny memory leak when loading BIOS settings 2022-09-06 21:23:44 +01:00
Richard Hughes
39b931938f trivial: Allow parsing thunderbolt-nvm images from fwupdtool 2022-09-06 20:45:38 +01:00
Richard Hughes
1faac75aa5 Ensure the context is set for all backends
This isn't required right now, but new functionality is much easier to add if
we know the context has always been set.
2022-09-06 20:30:21 +01:00
Richard Hughes
709af2a269 Add shared functionality to get the parsed kernel cmdline 2022-09-02 14:35:48 +01:00
Mario Limonciello
ad461d504d bios-settings: Fix plugin functionality
By moving the attribute loading into udev it was loading too late
and plugins couldn't use it.  Move the loading to earlier in the
daemon and ignore add events if we already have attributes loaded.

Fixes: #4979
2022-08-31 09:21:07 -05:00
Mario Limonciello
ae135e7d0a trivial: add a better message on Windows for failing service 2022-08-30 12:06:16 -05:00
Mario Limonciello
e26be40490 trivial: disable security arg when HSI disabled
There is no point to offering the security argument to the tools if HSI was disabled
at compile time.
2022-08-30 11:42:58 -05:00
Richard Hughes
16b463334e Export the generic Intel Thunderbolt firmware format
This is being used for other products, e.g. USB4 docks.

If non-Intel firmware is being used (e.g. ASMedia) then the explicit
calls to `fu_intel_thunderbolt_nvm_new()` can be changed to something
like `fu_firmware_new_from_gtypes()` with all the formats listed.
2022-08-30 14:20:14 +01:00
Mario Limonciello
75fa5c3128 trivial: Use meson 0.61 feature for natively installing symlinks 2022-08-30 08:36:24 +01:00
Mario Limonciello
a56b5b2d36 trivial: in the not enough information case show an URL 2022-08-29 18:20:46 -05:00
Mario Limonciello
5777f37191 trivial: Move recommendations from the wiki to HSI spec
We publish the HSI spec at fwupd.github.io. We should make this
the first landing area for HSI content, going out to the wiki page
only as necessary.
2022-08-29 20:44:20 +01:00
Richard Hughes
7f930a41dc trivial: Fix one -Wunused-variable warning 2022-08-26 21:18:25 +01:00
Mario Limonciello
273a363a71 trivial: bios-settings: don't show error for nothing to do
After policy applies for the first time, you don't want to show
messaging to users that the policy can't apply the next time.
2022-08-25 14:40:09 -05:00
Mario Limonciello
df07318f36 Move FwupdBiosSetting description database into libfwupdplugin
This needs to be handled by the daemon so that all GUI clients will
be able to load translations as well.

The translations will be distributed with fwupd, and any GUI client
should look up the translations.
2022-08-25 14:05:24 -05:00
Richard Hughes
e12b46b991 Force the chassis type to be valid if emulating
The logic being that if we're emulating another system we're possibly
on a VM, and that's possibly going to report that it isn't a desktop.

I also think it makes sense to serialize out the FuSmbios object
to-and-from JSON, but that's a patch for another day.
2022-08-25 13:56:41 +01:00
Richard Hughes
50f0953b32 trivial: Fix a Coverity issue which is really a false positive 2022-08-25 12:15:23 +01:00
Richard Hughes
afb56d4286 trivial: Fix one -Wunused-variable warning 2022-08-25 12:08:33 +01:00
Mario Limonciello
9391deb2d7 trivial: only accept bios settings ending in .json 2022-08-25 10:08:39 +01:00
Mario Limonciello
0e9ea45d27 trivial: fu-util/fu-tool: fix json mode for programming bios settings 2022-08-24 14:10:11 -05:00
Mario Limonciello
b48710aac7 trivial: fu-util: make JSON mode silent
We don't want to be emitting errors in JSON mode, we should only use
return codes.
2022-08-24 14:10:11 -05:00
Mario Limonciello
04c2186edc Add support for loading default BIOS settings policy
A user can place a JSON file in /etc/fwupd/bios-settings.d/ with
the default desired policy for the machine.

fwupd will load this policy on startup to ensure BIOS settings
are set as desired by the system administrator.
2022-08-24 12:59:42 -05:00
Mario Limonciello
2f9cb74c59 trivial: don't assume we know about pending_reboot
The `pending_reboot` variable is tracked by the kernel, make sure
that it is updated from the kernel when BIOS settings are changed.
2022-08-24 12:59:42 -05:00
Mario Limonciello
e49c64553d trivial: return FWUPD_ERRROR_NOTHING_TO_DO if BIOS settings already set
This will prevent setting `pending_reboot` if the settings already match
those desired by the client.
2022-08-24 10:58:25 -05:00
kate
3d199058bb fu-engine: HSI prefix fixing for invalid chassis
The invalid HSI prefix should be "HSI:INVALID" not "HSI-INVALID".

Signed-off-by: Kate Hsuan <hpa@redhat.com>
2022-08-24 16:27:02 +01:00
Mario Limonciello
b7b0ce533d trivial: Unify ambiguity between bios-attrs and bios-settings
These are currently used interchangeably since there was indecisiveness
which to use as the feature was being developed.

As outward facing it will be named with "settings", change all uses
in the code to match this.
2022-08-24 07:20:01 -05:00
Richard Hughes
8b63023aaf Only show *changed* events in the fwupdmgr security output
We do not want to show added or removed HSI tests in this UI.
2022-08-24 13:19:17 +01:00
Mario Limonciello
826983b8a7 Add support to set BIOS settings using a JSON payload
The JSON payload is ideally generated from `fwupdmgr get-bios-settings --json`
with all attributes expected to be included as additional arguments.
2022-08-24 09:51:46 +01:00
Richard Hughes
2a5c27a094 Do not assert when running with no plugins
Fixes https://github.com/fwupd/fwupd/issues/4932
2022-08-22 11:50:56 +01:00
Richard Hughes
4af448af1a Actually parse AppStream issues
These are saved on the <release>, not the <component>.

Fixes half of https://github.com/fwupd/fwupd/issues/4929
2022-08-22 11:06:40 +01:00
hugh chao(hugh712)
8b0c057f8f Install all devices with the same composite id in fwupdtool 2022-08-18 09:32:40 -05:00