Commit Graph

649 Commits

Author SHA1 Message Date
Richard Hughes
0e175181ea Do not leak when calling fu_firmware_parse() multiple times 2021-11-24 15:46:18 +00:00
Richard Hughes
019a210c94 Show an error when loading XML with multiple <component> tags
Fixes https://github.com/fwupd/fwupd/issues/4022, but requires a newer
libxmlb to be installed.
2021-11-24 15:44:56 +00:00
Mario Limonciello
b70d3a73e8 trivial: Fix style for fu-fuzzer-firmware.c
This was skipped because pre-commit identified c.in as text not C.
2021-11-17 16:19:41 +00:00
Richard Hughes
40c7f7ba21 Show a daemon warning if quirk flags are malformed 2021-11-17 15:14:13 +00:00
Richard Hughes
fedce9e077 trivial: Crash the fuzzer on critical warning
We want to abort early rather than relying on other problems like segfault or OOM.
2021-11-17 15:13:56 +00:00
Richard Hughes
2958586d50 trivial: Add some debugging when a private flag does not match 2021-11-15 16:40:27 +00:00
Richard Hughes
60612294f5 trivial: Use the device GType as the debugging root
We never show the fu_device_to_string() output to the user in normal
circumstances, and it's super useful for it to match the FuFirmware
format.
2021-11-15 14:59:52 +00:00
Richard Hughes
fca20c0722 trivial: Fix the progress status when required
When the child has completed we rely on the next fu_progress_step_done()
call to set the status value back to the parent-defined value. In the
case where there is a delay until the next step is done (e.g. waiting
for hardware to re-enumerate) the child status persisted incorrectly.
2021-11-15 14:59:37 +00:00
Richard Hughes
4f3e2c3a57 Allow overriding HwId data from the config file
To use this on a immutable system like ChromeOS you can create a file
in /var/lib/fwupd/daemon.conf which is used as an override.
2021-11-10 17:59:52 +00:00
Richard Hughes
c1f7ac47e8 tpm: Actually add the v1.2 device
Also, add end-to-end tests for this so it can never happen again.

Fixes https://github.com/fwupd/fwupd/issues/3972
2021-11-10 14:08:08 +00:00
Yehezkel Bernat
86286c3efd trivial: remove outdated comment
This comment became outdated with #3940, where the `NULL` check for `priv->ctx` that followed by early return was removed
2021-11-09 20:20:03 +00:00
Richard Hughes
ae278e1b80 Be case insensitive when fixing the device model 2021-11-09 16:09:16 +00:00
Richard Hughes
e87fc05ab9 Speed up the daemon startup by ~2% by doing dlsym much less
We were calling g_module_symbol() 2703 times, which is actually more
expensive than you'd think.

It also means the plugins are actually what we tell people they are:
A set of vfuncs that get run. The reality before that they were dlsym'd
functions that get called at pretty random times.
2021-11-09 12:02:07 +00:00
Richard Hughes
eb508129a8 trivial: Remove devices already added on failed coldplug
Calling into the now-disabled makes things very tricky to debug.
2021-11-09 07:42:05 +00:00
Richard Hughes
764df76d34 Allow overriding the firmware GType from a quirk file
This also allows us to remove quite a lot of boilerplate from plugins.
2021-11-08 15:53:41 +00:00
Richard Hughes
36d7077f65 Add a new plugin to handle MTD devices 2021-11-05 20:01:51 +00:00
Richard Hughes
ed419416d5 Allow setting the FuUdevDevice bind-id at runtime 2021-11-05 15:00:10 +00:00
Richard Hughes
1507055849 trivial: Use GObject notify when modifying the proxy 2021-11-05 12:00:48 +00:00
Richard Hughes
02222a58c8 trivial: Add FU_UDEV_DEVICE_FLAG_OPEN_SYNC for future code 2021-11-05 08:01:25 +00:00
Richard Hughes
0fb2ef3aae trivial: Add fu_udev_device_seek() for future code 2021-11-05 08:01:25 +00:00
Richard Hughes
fe180cbf5d trivial: Add fu_udev_device_get_sysfs_attr_uint64() for future code 2021-11-05 08:01:25 +00:00
Richard Hughes
a32773efab Use indexes with the XPath query to speed up startup by 2% 2021-11-04 10:09:17 +00:00
Richard Hughes
04d9f8c722 Use prepared queries for quirk lookup to speed up startup by 5%
We were already using xb_value_bindings_bind_str(), but recreating the
query object each time -- which kinda defeats the purpose...
2021-11-04 10:09:17 +00:00
Richard Hughes
1a077289bc Speed up daemon startup by 15%
During my fwupd startup fu_plugin_has_custom_flag gets called 21 times
which causes all HWIDs to be enumerated with 346 calls to the quite
expensive fu_context_lookup_quirk_by_id() function.

Move the flag to a private hashset and enumerate the HWIDs only during
startup. There's nothing plugin specific about them anyway...
2021-11-03 07:14:37 +00:00
Richard Hughes
74cb7a23d1 Fix 'fwupdmgr security' on a fresh install
If there are no HSI events then don't throw a critical warning when the
variant array type is unknown.
2021-11-01 10:14:43 +00:00
Richard Hughes
196dbec5ae trivial: Add fu_security_attrs_append_internal() for future code 2021-10-29 13:11:21 +01:00
Richard Hughes
5bb250846d trivial: Fix recently introduced gtkdoc warning 2021-10-29 11:38:04 +01:00
Richard Hughes
7453d59ccf trivial: Fix a small memory leak in the self tests 2021-10-27 15:57:53 +01:00
Richard Hughes
0d64780093 trivial: Fix a small memory leak when getting volumes 2021-10-27 15:57:53 +01:00
Richard Hughes
b3e7f07716 trivial: Use ->dispose() to remove a ref-loop at exit 2021-10-27 15:57:53 +01:00
Jason Gerecke
835975d66c trivial: Add "full" CRC8 function
The CRC32 and CRC16 algorithms have "full" functions that allow callers to
provide their own polynomial and initial CRC value. Provide the same ability
to users of the CRC8 algorithm.
2021-10-26 18:15:23 +01:00
Richard Hughes
28678235cd Move the fuzzing files into the plugin directories
We only had to pile everything into the src/fuzzing/firmware directory
because honggfuzz could not cope with more than one input path.

This way each plugin is self contained and easy to copy.
Also, install the fuzzing builder objects as this fixes the installed
tests when srcdir does not exist.

Based on a patch by Jan Tojnar <jtojnar@gmail.com>, many thanks.
2021-10-22 15:24:05 +01:00
Richard Hughes
3a63f5bd9b trivial: Make the SREC parser more spec compliant
Only upgrade S5 into S6 when there are over 0xFFFF records.
2021-10-22 14:58:24 +01:00
Richard Hughes
2d00cda464 Remove PLUGINBUILDDIR and use G_TEST_SRCDIR and G_TEST_BUILDDIR instead
This allows us to override the location we load data files from, which
allows us to do more kinds of installed tests in the future.

Also, move the global data/tests content into the place that it is used
as it was getting impossible to manage.
2021-10-21 18:36:22 +01:00
Mario Limonciello
3709dcd104 trivial: fix URL for fwupdagent security command
fixes: #3893
2021-10-21 09:34:04 -05:00
Richard Hughes
6235a8222a Share the Common Flash Memory Interface quirks between plugins
Now two plugins are using hardcoded SPI constants for various CFI chips,
and it makes sense to have some common quirk data that can be used by
both.

Add a FuSpiChip helper object that can be used by FuDevice subclasses
to get the specific SPI commands to use for each flash ID.
2021-10-20 12:19:39 +01:00
Richard Hughes
27e40c3025 trivial: Add more fuzzing alignment checks
In reality these are not super interesting as they only happen on
`->write()` and not `->parse()`.

In other news, the fuzzer now appreciates how critical the alignment
is, which is probably a good thing generally.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40088
2021-10-18 20:02:03 +01:00
Richard Hughes
e99dd242e9 Strip inner XML text when loading metainfo.xml files
This allows us to do the right thing if given an XML file with leading
or trailing space in the entry, e.g.

    <value key=LVFS::UpdateProtocol> org.uefi.capsule </value>
2021-10-18 14:43:57 +01:00
Richard Hughes
15bf534e3f Set the verfmt of the returned device when the daemon device is unset
This regressed in 1.5.5 when we migrated FWUPD_DEVICE_FLAG_MD_SET_VERFMT
into FU_DEVICE_INTERNAL_FLAG_MD_SET_VERFMT and forgot to copy the system
device internal flags.
2021-10-18 06:57:09 +01:00
Richard Hughes
9c7939dae3 trivial: Fix a fuzzing crash for a corrupt IFD image
Sanity check the alignment so we do not write gigabytes of 0xFF's.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39982
2021-10-15 20:05:55 +01:00
Richard Hughes
bd43647554 Add fu_usb_device_new_with_context() helpers
This means the context is set at construction time, which is much less
fragile than setting the context manually.
2021-10-15 15:59:34 +01:00
Richard Hughes
ccc0f9b0c6 trivial: Assign the context of incorporated devices early
This means we can use GObject->constructed() to copy the context over
to FuDevice helpers that also require the context.
2021-10-15 15:57:57 +01:00
Richard Hughes
dbf92be359 trivial: Add fu_device_add_string() for future use 2021-10-14 15:49:58 +01:00
Gaël PORTAY
918006f8d5 trivial: Codespell fixes 2021-10-14 09:09:54 -05:00
Gaël PORTAY
21b470c1a1 trivial: Codespell fixes 2021-10-14 09:09:54 -05:00
Richard Hughes
852a6dbdc2 redfish: Handle EPERM when testing devices with a IPMI device
Fixes https://github.com/fwupd/fwupd/issues/3849
2021-10-12 19:12:57 -05:00
Richard Hughes
357d7ff396 trivial: Fix up a docgen comment typo 2021-10-09 16:22:35 +01:00
Richard Hughes
d3706e0e0b Show the user a warning if updating may affect full-disk-encryption
Additionally, if the client does not set the feature flag `fde-warning`,
add an extra paragraph into the update description.

Fixes https://github.com/fwupd/fwupd/issues/3829
2021-10-09 08:09:38 +01:00
Richard Hughes
3f82205062 Support loading remotes from /var/lib/fwupd/remotes.d
This allows us to add remotes on /etc immutable systems.
2021-10-08 17:22:24 +01:00
Richard Hughes
1669f532be trivial: Move the metadata directory
This moves the cached metadata location from /var/lib/fwupd/remotes.d
to /var/lib/fwupd/metadata

The former was a bad name as it wasn't a list of remotes, and .d is the
suffix for directories the user can install files into, rather than for
binary content managed entirely by the daemon.
2021-10-08 17:22:24 +01:00