Bug 2277444

Summary: SIGSEGV in BIO_free
Product: [Fedora] Fedora Reporter: Steve <y9t7sypezp>
Component: osslsigncodeAssignee: Artem <ego.cordatus>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 39CC: davide, ego.cordatus
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/960359/
Whiteboard:
Fixed In Version: osslsigncode-2.8-3.fc41 osslsigncode-2.8-4.20240501gita53bd2b.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-05-01 22:47:57 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:

Description Steve 2024-04-27 01:12:57 UTC
Description of problem:
SIGSEGV in BIO_free

Version-Release number of selected component (if applicable):
osslsigncode-2.8-1.fc39.x86_64

2.7 does not crash.

How reproducible:
Always.

Steps to Reproduce:

Test with a copy of a recent kernel:

$ file vmlinuz-1.bin
vmlinuz-1.bin: Linux kernel x86 boot executable bzImage, version 6.8.7-200.fc39.x86_64 (mockbuild@45dd5688efad44f5b0bb641c76b5468d) #1 SMP PREEMPT_DYNAMIC Wed Apr 17 19:35:11 UTC 2024, RO-rootFS, swap_dev 0XE, Normal VGA

$ osslsigncode extract-signature -in vmlinuz-1.bin -out vmlinuz-1.sig
Current PE checksum   : 00000000
Calculated PE checksum: 00E34572
Warning: invalid PE checksum

Corrupted attribute certificate table
Attribute certificate table size  : 00000D48
Attribute certificate entry length: 00000762

Unable to extract existing signature
Segmentation fault (core dumped)

Actual results:
Program received signal SIGSEGV, Segmentation fault.

Expected results:
No SIGSEGV.

Additional info:

Comment 1 Steve 2024-04-27 01:18:58 UTC
$ gdb --args osslsigncode extract-signature -in vmlinuz-1.bin -out vmlinuz-1.sig
GNU gdb (Fedora Linux) 14.2-1.fc39
... 
(gdb) run
Starting program: /usr/bin/osslsigncode extract-signature -in vmlinuz-1.bin -out vmlinuz-1.sig
[Thread debugging using libthread_db enabled]                                                                                                     
Using host libthread_db library "/lib64/libthread_db.so.1".
Current PE checksum   : 00000000                                                                                                                  
Calculated PE checksum: 00E34572
Warning: invalid PE checksum

Corrupted attribute certificate table
Attribute certificate table size  : 00000D48
Attribute certificate entry length: 00000762

Unable to extract existing signature

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7ad75b1 in BIO_free (a=a@entry=0x5555555a9ef0) at crypto/bio/bio_lib.c:147
147         if ((a->method != NULL) && (a->method->destroy != NULL))                                                                              
(gdb)

Comment 2 Steve 2024-04-27 18:35:47 UTC
Artem: Thanks for opening the upstream issue.

Comment 3 Fedora Update System 2024-04-30 14:19:23 UTC
FEDORA-2024-0f11edc3fc (osslsigncode-2.8-3.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-0f11edc3fc

Comment 4 Artem 2024-04-30 14:20:14 UTC
Please test build with upstream patch fix. Build for other branches will be available soon:

https://bodhi.fedoraproject.org/updates/?search=osslsigncode

Comment 5 Fedora Update System 2024-04-30 14:23:53 UTC
FEDORA-2024-0f11edc3fc (osslsigncode-2.8-3.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Steve 2024-05-01 18:56:17 UTC
Thanks for the test build. This bug appears to be fixed, however osslsigncode still fails to extract a signature. Will open a separate bug for that problem.

$ osslsigncode extract-signature -in /boot/vmlinuz-6.8.7-200.fc39.x86_64 -out vmlinuz-2.sig
Current PE checksum   : 00000000
Calculated PE checksum: 00E34572
Warning: invalid PE checksum

Corrupted attribute certificate table
Attribute certificate table size  : 00000D48
Attribute certificate entry length: 00000762

Unable to extract existing signature
Failed

--
osslsigncode-2.8-3.fc39.x86_64

Comment 7 Artem 2024-05-01 18:57:31 UTC
Maybe we should try latest master branch.

Comment 8 Steve 2024-05-01 19:52:55 UTC
(In reply to Artem from comment #7)
> Maybe we should try latest master branch.

OK.

For the record, osslsigncode-2.7-1.fc39.x86_64 extracts the signature:

$ osslsigncode extract-signature -in /boot/vmlinuz-6.8.7-200.fc39.x86_64 -out vmlinuz-1.sig
Succeeded

With openssl-3.1.1-4.fc39.x86_64:

$ openssl pkcs7 -in vmlinuz-1.sig -inform DER -print_certs -noout
subject=C = US, ST = Massachusetts, L = Cambridge, O = "Red Hat, Inc.", OU = Fedora Secure Boot Signer, OU = bkernel01 kernel, CN = kernel-signer
issuer=C = US, ST = Massachusetts, L = Cambridge, O = "Red Hat, Inc.", OU = Fedora Secure Boot CA 20200709, CN = fedoraca

Comment 9 Fedora Update System 2024-05-01 20:13:23 UTC
FEDORA-2024-e2f35bd20c (osslsigncode-2.8-4.20240501gita53bd2b.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-e2f35bd20c

Comment 10 Steve 2024-05-01 20:27:16 UTC
$ rpm -q osslsigncode 
osslsigncode-2.8-4.20240501gita53bd2b.fc39.x86_64

$ osslsigncode extract-signature -in /boot/vmlinuz-6.8.7-200.fc39.x86_64 -out vmlinuz-2.sig
Current PE checksum   : 00000000
Calculated PE checksum: 00E34572
Warning: invalid PE checksum

Corrupted attribute certificate table
Attribute certificate table size  : 00000D48
Attribute certificate entry length: 00000762

Unable to extract existing signature
Failed

Comment 11 Artem 2024-05-01 20:31:49 UTC
Interesting. Can you please provide this feedback in upstream bug that bug is not completely fixed? Or open new one upstream issue.

Comment 12 Fedora Update System 2024-05-01 22:47:57 UTC
FEDORA-2024-e2f35bd20c (osslsigncode-2.8-4.20240501gita53bd2b.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.