Your message dated Wed, 03 Dec 2025 02:00:13 +0000
with message-id <[email protected]>
and subject line Bug#1121761: fixed in virt-firmware 25.10-2
has caused the Debian Bug report #1121761,
regarding virt/firmware/varstore/edk2.py: wrong endiannes when reading varstore
images?
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
1121761: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1121761
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python3-virt-firmware
Version: 24.11-2
Severity: normal
Tags: upstream, patch
X-Debbugs-Cc: [email protected]
There's a bug in virt/firmware/varstore/edk2.py when
reading varstore images, - it uses native endiannes
instead of little-endian.
def parse_volume(self):
...
(vlen, sig, attr, hlen, csum, xoff, rev, blocks, blksize) = \
struct.unpack_from("=QLLHHHxBLL", self.filedata, offset + 32)
logging.debug('vol=%s vlen=0x%x rev=%d blocks=%d*%d (0x%x)',
guids.name(guid), vlen, rev,
blocks, blksize, blocks * blksize)
if sig != 0x4856465f:
logging.error('%s: not a firmware volume', self.filename)
sys.exit(1)
When reading AAVMF_VARS.fd, on a little-endian system, this results in:
DEBUG:root:vol=guid:NvData vlen=0xc0000 rev=2 blocks=3*262144 (0xc0000)
The same code and input, when run on s390x, results in:
DEBUG:root:vol=guid:NvData vlen=0xc0000000000 rev=2 blocks=50331648*1024
(0xc00000000)
ERROR:root:AAVMF_VARS.fd: not a firmware volume
The unpack_from() call should have "<" (little-endian) as the first symbol
instead of "=" (native-endian), since it is reading an image defined as
having little-endian characteristics.
See two edk2 debci runs, on amd64 (sucessful) and on s390x (failed):
https://ci.debian.net/packages/e/edk2/testing/amd64/66712410/
https://ci.debian.net/packages/e/edk2/testing/s390x/66711962/
There are other places in this file where the same "=" (native) conversion
is used, - these should probably be fixed too.
Attached is a small patch (untested yet) which should fix this.
Thanks,
/mjt
diff --git a/virt/firmware/varstore/edk2.py b/virt/firmware/varstore/edk2.py
index 33b2738..54db6e1 100644
--- a/virt/firmware/varstore/edk2.py
+++ b/virt/firmware/varstore/edk2.py
@@ -62,5 +62,5 @@ class Edk2VarStore:
guid = guids.parse_bin(self.filedata, offset + 16)
(vlen, sig, attr, hlen, csum, xoff, rev, blocks, blksize) = \
- struct.unpack_from("=QLLHHHxBLL", self.filedata, offset + 32)
+ struct.unpack_from("<QLLHHHxBLL", self.filedata, offset + 32)
logging.debug('vol=%s vlen=0x%x rev=%d blocks=%d*%d (0x%x)',
guids.name(guid), vlen, rev,
@@ -76,5 +76,5 @@ class Edk2VarStore:
def parse_varstore(self, start):
guid = guids.parse_bin(self.filedata, start)
- (size, storefmt, state) = struct.unpack_from("=LBB", self.filedata,
start + 16)
+ (size, storefmt, state) = struct.unpack_from("<LBB", self.filedata,
start + 16)
logging.debug('varstore=%s size=0x%x format=0x%x state=0x%x',
guids.name(guid), size, storefmt, state)
@@ -97,8 +97,8 @@ class Edk2VarStore:
varlist = efivar.EfiVarList()
while pos < self.end:
- (magic, state, attr, count) = struct.unpack_from("=HBxLQ",
self.filedata, pos)
+ (magic, state, attr, count) = struct.unpack_from("<HBxLQ",
self.filedata, pos)
if magic != 0x55aa:
break
- (pk, nsize, dsize) = struct.unpack_from("=LLL", self.filedata, pos
+ 32)
+ (pk, nsize, dsize) = struct.unpack_from("<LLL", self.filedata, pos
+ 32)
if state == 0x3f:
--- End Message ---
--- Begin Message ---
Source: virt-firmware
Source-Version: 25.10-2
Done: dann frazier <[email protected]>
We believe that the bug you reported is fixed in the latest version of
virt-firmware, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
dann frazier <[email protected]> (supplier of updated virt-firmware package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Format: 1.8
Date: Tue, 02 Dec 2025 18:20:50 -0700
Source: virt-firmware
Architecture: source
Version: 25.10-2
Distribution: unstable
Urgency: medium
Maintainer: dann frazier <[email protected]>
Changed-By: dann frazier <[email protected]>
Closes: 1121761
Changes:
virt-firmware (25.10-2) unstable; urgency=medium
.
* Use correct endianness when reading varstore images. Thanks
to Michael Tokarev. Closes: #1121761.
Checksums-Sha1:
60fecea9876dd4a796d1b233413fa53ae223e2d9 1488 virt-firmware_25.10-2.dsc
ada82c9aac8bcab50e217255710513164fcec4a1 4944
virt-firmware_25.10-2.debian.tar.xz
7cdba3373870986ac6efbd92b18385baa5a7dff1 5878
virt-firmware_25.10-2_source.buildinfo
Checksums-Sha256:
087f387f9ccaee10c4b44e993a23f7c54ff38554527b4cff5ead8b5f2308d49e 1488
virt-firmware_25.10-2.dsc
b9729a65348d2cca07c986b41d624ebc35a2fa7ede701e310219f8c496144963 4944
virt-firmware_25.10-2.debian.tar.xz
a137dcdcb6105ef28dd6a3861ec4635bc5e4c48b2a77685db5523d70eaa14e3f 5878
virt-firmware_25.10-2_source.buildinfo
Files:
d590485574be299420893ca6fabf6674 1488 python optional virt-firmware_25.10-2.dsc
c77e93823cd4a4fefd6a80a1d73bf900 4944 python optional
virt-firmware_25.10-2.debian.tar.xz
98ddeaa92703727661707c2f1061d8ce 5878 python optional
virt-firmware_25.10-2_source.buildinfo
-----BEGIN PGP SIGNATURE-----
wr0EARYKAG8FgmkvkPUJEFRbhkD0YjpYRxQAAAAAAB4AIHNhbHRAbm90YXRpb25z
LnNlcXVvaWEtcGdwLm9yZ9gi8c0Yf8PmeDvIWEg6PIKPiFbx8aQcah8+PBj5KEWb
FiEEKBpcS4ojw8R0IfYuVFuGQPRiOlgAAFlyAP0SZb4+9CD38SunxL7zMdTw53Tp
5V7g2LbMkIUZMilNKQD+PGLd88Bb9LygHqs6Fg+Fwrlw6cMrNvepJ0E89xdKcQQ=
=GpLt
-----END PGP SIGNATURE-----
pgpjZ9cWA9VMz.pgp
Description: PGP signature
--- End Message ---