Commit Graph

2002 Commits

Author SHA1 Message Date
Richard Hughes
925f2e914b logitech-hidpp: Read from the device in a more safe way 2021-02-10 16:29:57 +00:00
Richard Hughes
4ae9aa87df csr: Be more safe when reading firmware from the device 2021-02-10 16:29:57 +00:00
Richard Hughes
d4dbb29a6e goodix-moc: Fix several places where the plugin code might crash
Fixes https://github.com/fwupd/fwupd/issues/2850
2021-02-10 16:29:21 +00:00
Richard Hughes
53de58f06d optionrom: Do not parse the image
The only real value of the optionrom plugin is the ability to store and verify
the ROM checksum; parsing the image is not actually required and is a source of
anxiety for various security teams.
2021-02-10 16:23:16 +00:00
Richard Hughes
a45d807a08 synaptics-rmi: Limit the number of containers to a sane value
Using hongfuzz we managed to build a valid firmware with 246625043 containers,
which took over 60 seconds to parse.
2021-02-10 15:27:42 +00:00
Richard Hughes
84176c9e1a synaptics-rmi: Be more careful when parsing invalid firmware 2021-02-10 15:27:42 +00:00
Richard Hughes
b0cf709f9b synaptics-rmi: Fix a memory leak when parsing invalid firmware 2021-02-10 15:27:42 +00:00
Richard Hughes
525f71f54b Merge the _udev_device() and _usb_device() vfuncs
There are now two 'backends' of device plug/unplug events, and there is about
to become three. Rather than just adding two more vfuncs for every backend type
define common ones that all providers can use.

Also fix up the existing in-tree plugins to use the new vfunc names and filter
on the correct GType.
2021-02-10 12:04:05 +00:00
Richard Hughes
2efa948b54 trivial: Add hailuck fuzzer to oss-fuzz 2021-02-09 16:37:25 +00:00
Richard Hughes
2e73bef923 Be more paranoid when parsing from ASCII buffers 2021-02-09 16:37:25 +00:00
Richard Hughes
67dda6b2e9 wacom-usb: Fix a buffer-overread spotted by AddressSanitizer 2021-02-09 13:05:46 +00:00
Richard Hughes
0cde61dd4d bcm57xx: Fix -Wcast-align issues spotted by clang 2021-02-08 13:26:27 +00:00
Richard Hughes
01a30aa6de Add support for oss-fuzz 2021-02-08 09:17:03 +00:00
Richard Hughes
3a30c1257c wacom-usb: Fix a crash detected by AddressSanitizer 2021-02-07 16:59:57 +00:00
Richard Hughes
8887b9128b uefi-capsule: Use an integer for EfivarNvramUsed
This is much easier to parse on the LVFS.

Fixes https://github.com/fwupd/fwupd/issues/2834
2021-02-06 14:23:09 +00:00
Richard Hughes
9b11af985f Add fu_memdup_safe()
See https://mail.gnome.org/archives/desktop-devel-list/2021-February/msg00000.html
for more details.
2021-02-04 21:01:00 +00:00
Javier Martinez Canillas
fde4b1676a uefi: Rewrite generate_binary.sh script in Python
The generate_binary.sh is a script that calls the objcopy tool and
genpeimg in the case of Windows, to generate a PE binary file.

But doesn't have to be a shell script and could be rewritten as a
python script. This will make this code to generate a PE binary
easier to extend if needed.

Also, the only reason that's a template is to define the objcopy
tool used, but this can also be passed as a positional argument.
2021-02-04 12:51:05 +00:00
Richard Hughes
f4a1592830 jabra: Ensure the protocol is set to avoid a daemon warning 2021-02-01 19:34:28 +00:00
Richard Hughes
f849a76766 trivial: Remove 'dfu-tool watch'
It's been broken for a long time, and nobody has noticed.
2021-02-01 19:34:28 +00:00
Richard Hughes
98972f4a34 libfwupdplugin: Promote DfuFirmware to FuDfuseFirmware
Port the DFU plugin to use the new objects to make it act the same as all the
other plugins.
2021-02-01 19:34:28 +00:00
Richard Hughes
ed4b8e28db dfu: Use FuChunk rather than defining DfuElement 2021-02-01 19:34:28 +00:00
Richard Hughes
7ccbd61f5d thunderbolt: Remove unused variable 2021-01-30 15:48:47 +00:00
Richard Hughes
6ceffbb585 system76-launch: Remove unused variable 2021-01-30 15:48:36 +00:00
Richard Hughes
27cb155dcf cros-ec: Make _do_xfer() outbuf const
The g_usb_device_bulk_transfer() function requires a mutable 'data' buffer, but
fwupd is sending file data and never wants the buffers modified.
2021-01-29 16:30:28 +00:00
Richard Hughes
9a241be490 trivial: Add fu_chunk_array_mutable_new()
This allows us to check that the plugin is writing into a mutable buffer. Also
fix up the plugins that are currently 'wrong' and use the new function for the
plugins doing the right thing.
2021-01-29 14:22:20 +00:00
Richard Hughes
d99f86023f trivial: Add getters to FuChunk
At the moment FuChunks are sometimes mutable, and sometimes immutable, and it's
all a bit too low level for comfort.

Before we can do any kind of optimisation or verification we need plugins to
stop reading directly from the C structure. The aim here is to make FuChunk
optionally mutable without making assumptions about the memory model, and also
to be able to introspect it for the docs.
2021-01-28 16:42:54 +00:00
Richard Hughes
382524d82f trivial: Fix potential crash when doing crazy things
Fix the asan crash when feeding the value back into itself, e.g

    fu_firmware_set_version (firmware, fu_firmware_get_version (firmware));
2021-01-28 14:13:59 +00:00
Richard Hughes
fed68479c0 dfu: Add support for GD32VF103 as found in the Longan Nano
This bootloader is *weird* -- the chip ID is the first two bytes of the serial
number and the data is offset and encoded in UTF-8, not UTF-16.

The sector information is also wrong. Gah!
2021-01-27 16:27:34 +00:00
Richard Hughes
5d7fb6ad88 uefi-capsule: Check if the fwupd BootXXXX entry exists on failure
Some systems remove the BootXXXX entry we add (so we can run fwupdx64.efi) and
thus the firmware update does not run. Most commonly this failure is seen with
Lenovo systems that call the helpful option 'Boot Order Lock'.

Hopefully when we depend on the new kernel bios interface sysfs API in we can
check in ->prepare(), not after reboot, but until that we can mark the update
failure as transient as the user can actually fix the problem themselves.

Fixes https://github.com/fwupd/fwupd/issues/2801
2021-01-27 14:49:57 +00:00
Richard Hughes
af75522a5e dfu: Show the DfuTargets when calling DfuDevice->to_string()
This is a much more standard way of doing this.
2021-01-27 09:18:44 +00:00
Jeremy Soller
fb3b349f16 system76-launch: Add a plugin for the System76 Launch Configurable Keyboard
This plugin supports reading the keyboard firmware version at runtime and
rebooting the keyboard to USB DFU mode. Tested with firmware uploaded to
embargo-system76.
2021-01-23 20:28:16 +00:00
Mario Limonciello
75835b4a0b Use FWUPD_COMPILATION define to indicate an in tree build
When this is done, include:
* Including the hash
* Including anything that is not ABI stable in plugins yet

Suggested-by: Simon McVittie <smcv@debian.org>
2021-01-22 14:01:25 -06:00
Richard Hughes
8ca69364af dfu: Allow quirking the target transfer size 2021-01-21 09:18:38 +00:00
Richard Hughes
11603b3e06 Install the UX data into a single .tar.xz file
This allows much better compression (-60%) than gziping them individually and
also allows us to build the capsule UX images as part of the build stage.

Also add more popular screen resolutions for laptops you can buy in 2021.
2021-01-20 11:03:20 +00:00
Richard Hughes
6101067f03 coreboot: Remove plugin and instead add metadata to flashrom devices
The coreboot plugin never actually gained the ability to write. As it stands a
coreboot system now adds *two* system-firmware devices (from both flashrom and
coreboot) which isn't ideal.

Just allow flashrom to enumerate quirked devices and add coreboot-specific
metadata as required. If we require some kind of cbfs parsing then we can do
that in FuFlashromDevice->prepare_firmware().
2021-01-19 21:32:59 +00:00
Richard Hughes
0155ad6f9b Add the PCR0 to the report metadata
Although we could reconstruct the PCR0 value on the LVFS from the (already
included) event log, it's much more scalable if the client just provides the
data that we want to filter by.
2021-01-19 14:57:48 +00:00
Richard Hughes
a512d91d43 Report the lockdown status from UEFI and SuperIO plugins
I was asked the other day how many machines would support a /dev/mem mmap'd
update mechanism, and I had to say that I didn't know. We use direct port IO in
the SuperIO plugin too, and it would be good to know how quickly we need to
port this to something else.
2021-01-19 14:57:10 +00:00
Richard Hughes
8bafffa5f3 Read the kernel lockdown status at startup 2021-01-19 14:57:10 +00:00
Richard Hughes
9a81d63add pci-bcr: Only mark the device non-updatable if WPD unset and BLE set
It's unusual, but if BIOS lock enable is enabled (so we cannot *change* the
value of BIOSWE) but the BIOS is already WE then we can write to the hardware
just fine.
2021-01-19 14:44:51 +00:00
Richard Hughes
4a19138026 trivial: Use argparse for make-images.py 2021-01-19 11:56:55 +00:00
Richard Hughes
51f7bde2b7 trivial: Move the make-images script to the consumer 2021-01-19 11:56:55 +00:00
Richard Hughes
70ded56f8a synaptics-rmi: Add some support for PS2 devices
With much help from David Chiu <david.chiu@tw.synaptics.com>, many thanks.
2021-01-18 21:18:02 +00:00
Richard Hughes
a5deffb184 synaptics-rmi: Allow the device to enter a firmware mode that allows programming 2021-01-18 21:18:02 +00:00
Richard Hughes
1974adaa04 synaptics-rmi: Query the build ID and ProjectID to work around a HW bug
The build ID is set and the product ID is parsed in a different way for a PS/2 device.
2021-01-18 21:18:02 +00:00
Richard Hughes
8b1ca08332 synaptics-rmi: Write bus select zero when detaching
This has no effect for HID devices.
2021-01-18 21:18:02 +00:00
Richard Hughes
ff82d005d7 synaptics-rmi: Use the correct delay when erasing v5 firmware 2021-01-18 21:18:02 +00:00
Richard Hughes
a0dd0e2be2 synaptics-rmi: Split out the HID specific parts to FuSynapticsRmiDevice 2021-01-18 21:18:02 +00:00
Richard Hughes
edc0c08065 synaptics-rmi: Support parsing and writing signed firmware
Validate the firmware signature if provided
2021-01-18 21:18:02 +00:00
Richard Hughes
643d7b16b1 synaptics-rmi: Do not assign the class vfuncs during setup
We fixed this problem in logitech-hidpp and this plugin will suffer the same bug.
2021-01-18 21:18:02 +00:00
Richard Hughes
a2798213ee synaptics-rmi: Do not set the page to the existing value 2021-01-18 21:18:02 +00:00