Commit Graph

287 Commits

Author SHA1 Message Date
Richard Hughes
5c9e9f17c5 libfwupdplugin: Export FuEfiSignatureList for plugins to use 2021-01-05 16:42:58 +00:00
Richard Hughes
cba9020eae trivial: Fix a buffer over-read when parsing invalid SMBIOS data 2021-01-05 15:59:30 +00:00
Richard Hughes
338cab9e73 libfwupdplugin: Subclass FuFirmware in FuSmbios
This allows us to get fuzzing support for free.
2021-01-05 15:59:30 +00:00
Richard Hughes
8c6bfffe2a trivial: Don't crash in the fuzzer for NULL input
The daemon already checks this, but the fuzzer just blindly flings the buffer
to each parser.
2021-01-05 15:59:30 +00:00
Richard Hughes
4bd5450c03 Fix a critical warning when parsing invalid Intel HEX firmware 2021-01-05 15:59:30 +00:00
Richard Hughes
ebb10a5c4a trivial: Fix a tiny memory leak when using fu_plugin_add_firmware_gtype() 2021-01-05 15:59:30 +00:00
Richard Hughes
364e2685ca Do not show unprintable chars from invalid firmware in the logs 2021-01-05 15:15:07 +00:00
Richard Hughes
ac927583a3 libfwupdplugin: Allow getting images by checksum value 2021-01-05 14:45:31 +00:00
Richard Hughes
eddaed0c11 Allow specifying more than one VendorID for a device
Asking the user for the UID mapping isn't working very well, as it requires lots
of manual handholding. It also doesn't work very well when the device vendor
does not actually have a PCI ID or if the vendor has split into two entities.

Just use the OUI address as an additional VendorID and match any of the device
IDs against any of the metadata-supplied values.
2021-01-04 22:30:20 +00:00
Richard Hughes
3252573ac7 synaptics-prometheus: Fix flashing a fingerprint reader that is in use
The fprint daemon only keeps the device open for 5 seconds and then releases it,
which seems like a small window to hit.

But! We're asking the user to authenticate with the same device we're about to
upgrade so a different part of the stack woke up the hardware just before we're
about to deploy an update onto it.

Just retry a few times to make sure the device is idle. Use a flag to prevent
accidentally causing regressions in other plugins.

Fixes https://github.com/fwupd/fwupd/issues/2650
2021-01-04 21:52:10 +00:00
Richard Hughes
64e9f6bd92 trivial: Fix up some NULL/FALSE confusion 2021-01-04 16:32:50 +00:00
Richard Hughes
9f71fe3dc9 Make the 'id' for fu_plugin_add_firmware_gtype() optional
We can work out the correct value automatically in all cases but one, and it's
less for the plugin author to get wrong...
2021-01-04 15:27:10 +00:00
Richard Hughes
2e5c1d15bc Do not hardcode building shared libraries
Respect the -Ddefault_library meson define.
2021-01-04 15:26:28 +00:00
Richard Hughes
6a489a9eaf trivial: Add missing calls to g_return_val_if_fail() 2021-01-04 15:24:35 +00:00
Richard Hughes
a2abc42760 libfwupdplugin: Use G_GNUC_WARN_UNUSED_RESULT for methods that should be checked 2021-01-04 15:24:35 +00:00
Mario Limonciello
ed4e9123c6 trivial: libfwupdplugin: don't fail to set up bwrap if /lib64 doesn't exist
Fixes: #2690
2020-12-16 07:56:09 +00:00
Richard Hughes
9d20bf9212 Do not trust the Block.HintSystem boolean for ESP filtering
Instead use it for preferential selection. If there is none it's okay, but if
there are 3 pick the one with the flag.

Fixes https://github.com/fwupd/fwupd/issues/2676
2020-12-15 15:42:13 +00:00
Richard Hughes
e3fb2e45cd trivial: Fix two more missing <string.h> instances 2020-12-14 20:24:04 +00:00
Richard Hughes
4ab347ec78 trivial: Do not use g_file_load_bytes() in the self tests
This is not available in older GLib versions.
2020-12-14 20:24:01 +00:00
Richard Hughes
a14de30153 trivial: Require <string.h> for strlen() and memcpy() 2020-12-14 16:49:03 +00:00
Richard Hughes
db8533f743 trivial: Don't accidentally depend on GLib 2.54.3
None of these branches are important enough to provide fallbacks for.
2020-12-14 15:33:00 +00:00
Richard Hughes
e5074cdbbb trivial: Fix compiling without GUdev 2020-12-14 11:34:43 +00:00
Richard Hughes
72df114793 fmap: Do not assume FuFmapArea.name is NUL terminated 2020-12-11 14:33:50 +00:00
Richard Hughes
fdea9336a6 fmap: Make mixed-endian safe 2020-12-11 14:33:50 +00:00
Richard Hughes
8b99d4f2ec fmap: Use fu_memcpy_safe() to prevent buffer over-read 2020-12-11 14:33:50 +00:00
Richard Hughes
531b8b417f fmap: Fix a critical warning when the FmapArea has zero size 2020-12-10 20:43:54 +00:00
Richard Hughes
f3539621ee ihex: Do not dump binary out to the terminal for corrupt files 2020-12-10 14:58:11 +00:00
Richard Hughes
976b6afe63 trivial: Allow turning off the FMAP binary search when fuzzing
This speeds up the fuzzing task from 22ms to 33us.
2020-12-09 18:08:08 +00:00
Richard Hughes
84617b6699 fmap: Allow writing and reading the image base 2020-12-09 18:02:07 +00:00
Richard Hughes
5771756f85 fmap: Allow creating test firmware from builder.xml 2020-12-09 18:02:07 +00:00
Richard Hughes
a9060f671c fmap: Correctly check minimum firmware size 2020-12-09 18:02:07 +00:00
Richard Hughes
05e3377d11 trivial: Add fu_common_bytes_new_offset()
This is a safer version of g_bytes_new_from_bytes() which returns a GError
if the offsets are invalid rather than emitting a critical warning.

This prevents a critical warning and potential crash when parsing invalid
bcm57xx firmware.
2020-12-08 20:54:25 +00:00
Richard Hughes
fa595a7334 libfwupdplugin: Do not overwrite GError when parsing invalid fmap 2020-12-08 20:32:21 +00:00
Richard Hughes
698099f643 trivial: Remove several unused variables 2020-12-08 20:06:46 +00:00
Philip Withnall
aa48b6b0e3 libfwupdplugin: Support new libxmlb query binding API
See https://github.com/hughsie/libxmlb/pull/67. This doesn’t bump the
hard version dependency.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-12-08 14:39:40 +00:00
Richard Hughes
0ec634e7db trivial: Codespell fixes 2020-12-07 20:55:18 +00:00
Richard Hughes
ab63e94107 Fall back to the misc device for serio devices 2020-12-03 10:58:38 +00:00
Richard Hughes
9d78383622 Actually implement rescan in FuUdevDevice
This allows the plugin to force a reload of the device using a new GUdevDevice
object. This is required as the values are cached in the immutable object.
2020-12-03 09:07:24 +00:00
Richard Hughes
6fca469737 trivial: Fix regression when using a custom GType
Although the fix in a21e025e46 is correct, we
also need to return TRUE higher up in the conditional.
2020-12-01 18:22:51 +00:00
Richard Hughes
d51f2ec939 trivial: Use DEVPATH for platform UDev devices 2020-12-01 14:15:33 +00:00
Richard Hughes
a21e025e46 trivial: Return with an error if the device GType is unclear
Returning TRUE means this is really hard to debug...
2020-12-01 14:15:33 +00:00
Richard Hughes
f8fc7de209 Fix a possible critical warning due to missing retval 2020-12-01 14:15:33 +00:00
Richard Hughes
3dbfc21171 trivial: Include the possible plugins in the FuDevice->to_string output 2020-12-01 14:15:33 +00:00
Richard Hughes
70aca476d7 Add the serio->firmare_id for UDev devices
If set, it is a device-specified InstanceID specifying the firmware stream.
2020-12-01 14:15:33 +00:00
Richard Hughes
7a63a4c41c Export the driver name from FuUdevDevice
We have to supply it when using fu_device_bind_driver(), so we need to get the
old value for ->attach() to avoid guessing what driver was previously loaded.
2020-12-01 14:15:33 +00:00
Richard Hughes
419c04c504 trivial: Show the subsystem when calling FuUdevDevice->to_string() 2020-12-01 14:15:33 +00:00
Richard Hughes
2bbb7d2b40 trivial: Merge some GtkDoc introspection fixes 2020-11-30 09:18:45 +00:00
Richard Hughes
4cbe99c607 Restrict loading component types of firmware
This would allow us to add other component types in the future, for instance a
'generic' type that adds information to the composite device.

Any generic components would need to have a requirement of 1.5.2 to avoid
showing a runtime warning when trying to get the local file details.
2020-11-29 07:06:29 +00:00
Richard Hughes
3a73c342ba Switch from libsoup to libcurl
The former drags on glib-networking and then gsettings-desktop-schemas, which
add over 5Mb to the minimal IoT and CoreOS composes. Everything already uses
libcurl (even NetworkManager!) and so this is an easy way to reduce image size.
2020-11-19 19:39:37 +00:00
Richard Hughes
05efd7b960 trivial: Don't assume a specific page size in the unit tests
This was found in the self tests on PPC64.

Fixes https://github.com/fwupd/fwupd/issues/2581
2020-11-15 09:17:08 +00:00