Commit Graph

1081 Commits

Author SHA1 Message Date
Richard Hughes
fd08eaefee trivial: Fix bitwise operators in last commit 2023-01-22 08:29:20 +00:00
Richard Hughes
5d6cb83d1c Add fu_context_remove_flag() for future use 2023-01-22 07:35:48 +00:00
Richard Hughes
c647d0d0f6 Parse the DT chassis-type when parsing the FDT 2023-01-18 18:20:35 +00:00
Richard Hughes
eb30233b35 Improve FDT parsing compatibility
Newer versions of dtc agressively pack the string table, using *any* matching
suffix rather than whole strings. This is specification compliant, but breaks
if you use the offset as a hash key as a [premature] optimization.

Just use the string table as a flat block of memory rather than pre-parsing it.

This fixes reading the system FDT on new OpenBMC builds.
2023-01-18 07:59:45 +00:00
Richard Hughes
2b0f92506b Refactor the hwids functionality
This refactors the code as it was getting very confusing; before FuSmbios was
reading both SMBIOS and the kernel-provided DT -- and various things were
injecting overrides in three different place. To properly support FDT remove
one layer of indirection.

This also lets us use the compatible strings to enable plugins specifying the
flag _REQUIRE_HWID -- which means we only load the plugin if it's got a chance
of working. e.g.

    [aspeed,ast2500]
2023-01-18 07:04:44 +00:00
Richard Hughes
72f5c1e01e trivial: Make the installed-tests redfish.conf secure to avoid a warning
Also, don't attempt to change the permissions if the correct one is already
set.
2023-01-17 19:29:39 +00:00
Richard Hughes
4057edb24b trivial: Add FU_PATH_KIND_SYSFSDIR_DMI for future use 2023-01-16 20:23:28 +00:00
Richard Hughes
0efc1bebce trivial: Add fu_context_get_hwids() for future use 2023-01-16 17:49:57 +00:00
Richard Hughes
2737b05cf8 trivial: Add fu_context_get_smbios() for future use 2023-01-16 17:49:57 +00:00
Richard Hughes
0e381a8666 trivial: Store the chassis kind in the context 2023-01-16 17:49:57 +00:00
Richard Hughes
8af1943142 trivial: Add FuContextHwidFlags for future usage 2023-01-16 17:49:57 +00:00
Richard Hughes
c95355b498 trivial: Add a GError parameter to fu_context_get_smbios_string()
This matches the behaviour of fu_smbios_get_string() and was probably accidental.
2023-01-16 14:05:48 +00:00
Mario Limonciello
5a24472fb4 Respect user requested paths for ESP even if they aren't volumes
These paths may be used for bind mounts, which we can't accurately
discover. Leave a message in the logs accordingly, but allow these
paths.

fixes: #5185
2023-01-11 16:26:07 +00:00
Richard Hughes
cf4f34572b Add fu_context_get_fdt() to get the Flat Device Tree
This is needed because multiple plugins will soon be consuming the system FDT,
and we don't want to either parse this multiple times, or duplicate the loading
logic.
2023-01-11 16:25:26 +00:00
Richard Hughes
37a0124b62 trivial: Create the parent directories when using fu_firmware_write_file() 2023-01-11 16:25:26 +00:00
Mario Limonciello
c2a494e871 trivial: install dmi data into installed-tests
fixes: #5402
2023-01-11 07:45:58 -06:00
Richard Hughes
91bf84f7a0 trivial: Reduce runtime RSS requirement for each device subclass
Remove the FuDeviceClass padding, as this library now loaded using an rpath
rather than a shared library with a static API. This matches what we did for
the FuFirmwareClass objects a while ago.
2023-01-10 20:43:31 +00:00
Richard Hughes
9f3a54488e trivial: Set the backend ID when added
This matches what the plugin does and means there's no critical warning when
adding to the hash table.
2023-01-10 20:34:52 +00:00
Richard Hughes
1ca3cdd4d9 Add a pefile firmware parser
This will eventually allow us to reconstruct a SBoM using a UEFI file volume.

This can be used like this `fwupdtool firmware-parse efi/fwupdx64.efi pefile`
to produce:

    <firmware gtype="FuPefileFirmware">
      <data size="0xef59">MZ.</data>
      <firmware>
        <id>.text</id>
        <offset>0x2d0</offset>
        <size>0x7bab</size>
        <data size="0x7bab">H...QRH.=....H.5</data>
      </firmware>
      ...
      <firmware gtype="FuCoswidFirmware">
        <id>fwupd-efi:fwupdx64</id>
        <idx>0x7</idx>
        <version>1.4</version>
        <offset>0xc4e0</offset>
        <size>0xce</size>
        <data size="0xce">..een-US</data>
        <version_scheme>semver</version_scheme>
        <product>fwupdx64</product>
        <summary>EFI helpers to install system firmware</summary>
        <colloquial_version>1.3-7-g881a508</colloquial_version>
        <link>
          <href>https://spdx.org/licenses/LGPL-2.0.html</href>
          <rel>license</rel>
        </link>
        <entity>
          <name>Richard Hughes</name>
          <regid>hughsie.com</regid>
          <role>maintainer</role>
          <role>tag-creator</role>
        </entity>
      </firmware>
    </firmware>
2023-01-06 17:32:59 +00:00
Richard Hughes
10e8f0559b Always search for uSWID data in the image 2023-01-06 14:23:13 +00:00
Richard Hughes
e73f7d019c Do not allow LZX compressed cabinet archives
The GCab decompression code is *scary* low level C that has not had any security
auditing other than by the fuzzer (which found plenty of memory-safety bugs).

Supporting LZX is useless at best, and could be a security exploit at worst.
2023-01-04 16:06:00 +00:00
Josh Soref
67deecde31
Lots of spelling fixes
Fixes:

* activate
* active
* additional
* and
* approaches
* attestation
* bootloader
* calculate
* capability
* children
* close
* compatible
* continuous
* convenience
* critical
* data
* delivery
* disabled
* disambiguate
* documented
* elapse
* emergency
* erasable
* expectations
* filesystem
* from
* haptic
* ignorable
* images
* infinity
* information
* information
* inhibited
* insufficient
* interrupt
* into
* limited
* management
* manifest
* maximum
* memory
* metadata
* mismatch
* model
* nonexistent
* not
* objects
* offset
* omissions
* ota
* past
* perform
* peripherals
* predictable
* product
* quarterly
* quirk
* quirks
* recognize
* release
* requests
* revocation
* sanitized
* sector
* status
* the
* the update
* timeout
* transfer
* transfers
* typically
* unspecified
* upgrade
* which
* will
* wireless
2022-12-29 13:57:31 +00:00
Richard Hughes
de5b2adaab Never allow using SHA-1 for checksum validation 2022-12-29 10:55:08 +00:00
Richard Hughes
427e5cec7a trivial: Add new convenience API to make plugins simpler 2022-12-20 20:54:12 +00:00
Mario Limonciello
2e7355955a trivial: add missing colon in function docs 2022-12-17 07:23:09 -06:00
Richard Hughes
069fa56f1a Add fu_archive_firmware_get_image_fnmatch() for future use
It's useful to get images from archives by a specific filename extension.
2022-12-17 07:44:27 +00:00
Richard Hughes
08e3eaafe0 uefi-dbx: Ignore failure to mount the ESP if unsupported
I think this is only possible when a raw partition with no filesystem has the
ESP or BDP UEFI GUID set in the partition table.
2022-12-16 14:58:03 +00:00
Richard Hughes
ce340e549d trivial: Do not use a GError for a critical problem 2022-12-15 17:27:22 +00:00
Richard Hughes
23cc1ba495 trivial: Fix reading from garbage when getting the pending reboot
Fix the confusion by using a tmp variable.
2022-12-15 17:27:22 +00:00
Richard Hughes
2c5ee07340 trivial: Fix debugging with FU_HID_DEVICE_VERBOSE 2022-12-15 16:41:55 +00:00
Richard Hughes
87ffda474b Allow getting the ESP when there is a block device with no filesystem
Fixes https://github.com/fwupd/fwupd/issues/5313
2022-12-15 08:38:25 +00:00
Richard Hughes
4ef8854618 trivial: Add convenience API for future use 2022-12-13 20:38:49 +00:00
Richard Hughes
83c90262d1 Remove plugin and device GRWLocks
This only have any protective effect if we're using multiple threads -- which
we're not. Removing these unused locks does not affect startup speed, but does
drop the idle RSS by ~10kB.
2022-12-12 17:29:38 +00:00
Richard Hughes
ef6c399a64 Fix a tiny memory leak when probing MEI devices 2022-12-12 17:29:17 +00:00
Richard Hughes
38dfdfd42e Convert FuProgress to a FINAL object
We're not going to subclass this, and making it final saves during startup:

 * 300K calls of fu_progress_get_instance_private()
 * 280K calls of fu_progress_get_step_weighting()
2022-12-11 20:26:15 +00:00
Richard Hughes
a157e3d19d Add fu_version_from_uint24() for future usage 2022-12-11 20:25:52 +00:00
Richard Hughes
c7ab395ff4 Return a more useful error if USB recovery() failed 2022-12-11 20:25:36 +00:00
Richard Hughes
baef005a3c trivial: Add compiler hint that fu_device_build_instance_id() must end in NULL 2022-12-10 14:43:03 +00:00
Richard Hughes
4a29b831fb Mark all MEI devices as internal 2022-12-06 15:10:45 +00:00
Richard Hughes
b521924b00 Make fu_device_get_release_default() match the parent semantics
In various places the code was checking if a release was set, but this would
always be false as the release was being auto-created. This was masking valid
bugs, and was confusing to have the superclass have different semantics to the
baseclass.
2022-11-29 09:05:16 +00:00
Richard Hughes
e02a094ca3 trivial: Fix memory leak when incorporating FuMeiDevice 2022-11-19 12:59:30 +00:00
Mario Limonciello
5d25661727 Add security attribute for OEM specific implementations of BIOS rollback protection 2022-11-18 14:28:13 +00:00
Mario Limonciello
daac8b31da Move AMD platform rollback protection into level 4
This was expected to be used more prevalently than it is being used
in practice.

Link: https://github.com/fwupd/fwupd/issues/5261
2022-11-18 14:28:13 +00:00
Sanjay Sheth
8e32b6a353 New plugin for Logitech Whiteboard camera 2022-11-17 16:42:04 +00:00
Richard Hughes
c79e14d63d Flip around the FuDeviceInstanceFlags logic
Opt-ing 'in' to each both behaviours requires less mental gymnastics compared
to having one flag inverted.
2022-11-04 13:44:23 +00:00
Richard Hughes
32e3241578 Do not add duplicate quirk instance IDs
It's pointless, and just wastes RSS.
2022-11-04 13:44:23 +00:00
Richard Hughes
26e1b7c49b Never hang in g_udev_device_get_parent() if there is never a busnum
Spotted by Coverity.
2022-11-03 23:51:00 -05:00
Richard Hughes
e79f0f23cb trivial: Do not show a critical warning without a request ID
If using old metadata (or when the device does not hard-require an update
message) just use something generic that cannot be replaced client-side.
2022-11-03 15:33:46 +00:00
Richard Hughes
1fafa92218 Ignored root partitions when getting the list of ESPs
Fixes the other half of https://github.com/fwupd/fwupd/issues/5211
2022-11-02 12:27:21 +00:00
Richard Hughes
3e1ce58560 Do not follow symlinks when uing fu_path_get_files()
Fixes half of https://github.com/fwupd/fwupd/issues/5211
2022-11-02 12:27:21 +00:00