Bug 1593258

Summary: dbxtool fails to apply DBX blacklist updates with "invalid argument" error
Product: [Fedora] Fedora Reporter: Dominik 'Rathann' Mierzejewski <dominik>
Component: dbxtoolAssignee: Peter Jones <pjones>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 29CC: bugzilla, freddy, leighton, peter+fedora, pjones, rabin, redhat-bugzilla, rharwood, sergio.pasra, spljaa, zhelezov
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-27 18:14:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
strace -f -o dbxtool.strace.txt /usr/bin/dbxtool -a /usr/share/dbxtool/ none

Description Dominik 'Rathann' Mierzejewski 2018-06-20 11:54:59 UTC
Created attachment 1453202 [details]
strace -f -o dbxtool.strace.txt /usr/bin/dbxtool -a /usr/share/dbxtool/

Description of problem:
dbxtool fails to apply DBX blacklist updates with "invalid argument" error. I noticed this because the dbxtool.service unit is in failed state:

● dbxtool.service - Secure Boot DBX (blacklist) updater
   Loaded: loaded (/usr/lib/systemd/system/dbxtool.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2018-06-20 13:16:15 CEST; 36min ago
  Process: 1072 ExecStart=/usr/bin/dbxtool -a /usr/share/dbxtool/ -q (code=exited, status=1/FAILURE)
 Main PID: 1072 (code=exited, status=1/FAILURE)

Jun 20 13:16:15 localhost.localdomain systemd[1]: Started Secure Boot DBX (blacklist) updater.
Jun 20 13:16:15 localhost.localdomain dbxtool[1072]: Applying 1 updates
Jun 20 13:16:15 localhost.localdomain dbxtool[1072]: Applying "DBXUpdate-2016-08-09-13-16-00.bin" 2010-3-6 19:17:21
Jun 20 13:16:15 localhost.localdomain dbxtool[1072]: Could not apply database update "DBXUpdate-2016-08-09-13-16-00.bin": Invalid argument
Jun 20 13:16:15 localhost.localdomain dbxtool[1072]: Cannot Continue.: Invalid argument
Jun 20 13:16:15 localhost.localdomain systemd[1]: dbxtool.service: Main process exited, code=exited, status=1/FAILURE
Jun 20 13:16:15 localhost.localdomain systemd[1]: dbxtool.service: Failed with result 'exit-code'.

Version-Release number of selected component (if applicable):
dbxtool-8-5.fc28.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. /usr/bin/dbxtool -a /usr/share/dbxtool/

Actual results:
Applying 1 updates
Applying "DBXUpdate-2016-08-09-13-16-00.bin" 2010-3-6 19:17:21
Could not apply database update "DBXUpdate-2016-08-09-13-16-00.bin": Invalid argument
Cannot Continue.: Invalid argument

Expected results:
No errors.

Additional info:
Strace log attached.

Comment 1 Dominik 'Rathann' Mierzejewski 2018-11-23 08:46:24 UTC
Still happening on F29:
dbxtool-8-7.fc29.x86_64

$ sudo /usr/bin/dbxtool -a /usr/share/dbxtool/ -v
Getting next EFI_SIGNATURE_DATA
Getting next ESL buffer
Getting next EFI_SIGNATURE_DATA
Getting next EFI_SIGNATURE_LIST
Attempting to identify filetype: va2 guid is {pkcs7_cert} 
guid table guid is {pkcs7_cert}
ft_append_timestamp is 2010-03-06 19:17:21
Attempting to apply 1 updates
Sorting updates list
Checking if "DBXUpdate-2016-08-09-13-16-00.bin" has been applied.
Getting next EFI_SIGNATURE_DATA
Getting next ESL buffer
Update entry is not applied.
Update "DBXUpdate-2016-08-09-13-16-00.bin" is not applied
Applying 1 updates
Applying "DBXUpdate-2016-08-09-13-16-00.bin" 2010-3-6 19:17:21
Could not apply database update "DBXUpdate-2016-08-09-13-16-00.bin": Invalid argument
Cannot Continue.: Invalid argument
error trace:
 efivarfs.c:363 efivarfs_set_variable(): write failed: Bad file descriptor
 efivarfs.c:388 efivarfs_append_variable(): efivarfs_set_variable failed: Invalid argument
 lib.c:113 efi_append_variable(): ops->append_variable() failed: Invalid argument

Do you need any information from me to debug this?

Comment 2 Chris Murphy 2018-11-23 20:31:41 UTC
I've filed an upstream bug, maybe it'll get attention there.
https://github.com/rhboot/dbxtool/issues/4

Comment 3 Dominik 'Rathann' Mierzejewski 2018-11-23 21:06:43 UTC
Thanks!

Comment 4 Vladimir Zhelezov 2018-12-12 08:53:43 UTC
Hi, I am having the same issue

Fedora 29, x86_64
kernel-4.19.7-300
dbxtool-8-7
efivar-libs-35-4

I propose to change the bug against efivar-libs, that's where the failure is happening. There's been some commits upstream that have rewritten efivarfs_set_variable() to deal with writes to possibly immutable files in sysfs and possibly address this issue:

https://github.com/rhboot/efivar/commit/9c51123abebd05d3c62af5da9737bdf8dc0b12a1#diff-ee430aa702eed686d16930273dbed987
https://github.com/rhboot/efivar/commit/aa2a584e614fec3a30a30a39c6cea718913c09f4#diff-ee430aa702eed686d16930273dbed987

Comment 5 Vladimir Zhelezov 2018-12-16 08:10:19 UTC
With the update to efivar-libs-37-1.fc29.x86_64 the situation has changed. Systemd is still in a degraded state after boot because of dbxtool failing but I get no more errors coming from efivarfs.c. The new error message is:

Getting next EFI_SIGNATURE_DATA
Getting next ESL buffer
Getting next EFI_SIGNATURE_DATA
Getting next EFI_SIGNATURE_LIST
dbxtool: EFI Signature List is malformed
dbxtool: list has 3800 bytes left, element is 76 bytes

Comment 6 Vladimir Zhelezov 2018-12-16 08:27:58 UTC
Oh, which seems to lead us back to bug 1508808

Comment 7 Dominik 'Rathann' Mierzejewski 2018-12-16 16:04:32 UTC
Same here:
$ sudo /usr/bin/dbxtool -v -a /usr/share/dbxtool/
Getting next EFI_SIGNATURE_DATA
Getting next ESL buffer
Getting next EFI_SIGNATURE_DATA
Getting next EFI_SIGNATURE_LIST
dbxtool: EFI Signature List is malformed
dbxtool: list has 3800 bytes left, element is 76 bytes
$ rpm -q efivar-libs
efivar-libs-37-1.fc29.x86_64

Comment 8 Ben Cotton 2019-10-31 19:43:56 UTC
This message is a reminder that Fedora 29 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '29'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 29 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 9 Dominik 'Rathann' Mierzejewski 2019-11-03 22:29:53 UTC
No longer reproducible on F31.

Comment 10 Ben Cotton 2019-11-27 18:14:26 UTC
Fedora 29 changed to end-of-life (EOL) status on 2019-11-26. Fedora 29 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.