I'm trying to get the ESRT system table from /dev/efi but sometimes it returns ENODEV. The only case where that's returned is here: https://github.com/freebsd/freebsd-src/blob/7a8d05ba19b7762596c0ff22e668e4d50bac81cf/sys/dev/efidev/efirt.c#L386 lwhsu added a print to that block and found that buf->fw_resource_version sometimes contains garbage. In the UEFI spec it's specified that it must always be 1. So we assume there is some memory corruption happening somewhere.
Getting the ESRT is important to outd out the firmware version of devices in the system. Here is how FWUPD calls that ioctl: https://github.com/fwupd/fwupd/blob/5f221172736fcd460441abc62ea1c399f41512c1/plugins/uefi-capsule/fu-uefi-backend-freebsd.c#L112 I'm doing the same in Rust: https://github.com/FrameworkComputer/framework-system/pull/50/files