Closed Shaeto closed 2 weeks ago
Why do you think a crash in libp11 should be fixed in osslsigncode?
well, i have fixed problem using workaround patch from https://github.com/mtrojnar/osslsigncode/issues/316 (move engine close)
so, openssl 3.2.1 still have this problem
osslsigncode 2.8.4 from Fedoras repos crashes with a SIGSEGV on Fedora 40.
The command I used was:
GOOGLE_APPLICATION_CREDENTIALS=gcloud-production.json \
KMS_PKCS11_CONFIG=production_pkcs11-config.yaml \
PKCS11_MODULE_PATH=libkmsp11-1.5-linux-amd64/libkmsp11.so \
osslsigncode sign \
-pkcs11engine /usr/lib64/engines-3/pkcs11.so \
-certs codesign_windows_cert.pem \
-key pkcs11:object=xxxxxx \
-n ThinLinc client \
-i https://www.cendio.com/ \
-comm \
-ts http://rfc3161timestamp.globalsign.com/advanced \
-in client-windows/unsigned-client.exe \
-out client-windows/tl-4.17.0-client-windows.exe
The output is:
Engine "pkcs11" set.
Segmentation fault (core dumped)
The end out the output with strace:
...
futex(0x7f7485400990, FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, 1258279, NULL, FUTEX_BITSET_MATCH_ANY) = -1 EAGAIN (Resource temporarily unavailable)
munmap(0x7f7470e00000, 8392704) = 0
close(4) = 0
close(3) = 0
munmap(0x7f74855bb000, 10842712) = 0
munmap(0x7f748674e000, 16392) = 0
munmap(0x7f74854d8000, 925712) = 0
openat(AT_FDCWD, "codesign_windows_cert.pem", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2585, ...}) = 0
lseek(3, 0, SEEK_SET) = 0
read(3, "-----BEGIN CERTIFICATE-----\nMIIH"..., 4096) = 2585
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "client-windows/tl-4.17.0-client-windows.exe", O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0666) = 3
newfstatat(AT_FDCWD, "client-windows/unsigned.exe", {st_mode=S_IFREG|0644, st_size=15089536, ...}, 0) = 0
openat(AT_FDCWD, "client-windows/unsigned.exe", O_RDONLY) = 4
mmap(NULL, 15089536, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7f747f19c000
close(4) = 0
munmap(0x7f747f19c000, 15089536) = 0
newfstatat(AT_FDCWD, "client-windows/unsigned.exe", {st_mode=S_IFREG|0644, st_size=15089536, ...}, 0) = 0
openat(AT_FDCWD, "client-windows/unsigned.exe", O_RDONLY) = 4
mmap(NULL, 15089536, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7f747f19c000
close(4) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
brk(0x558c7f110000) = 0x558c7f110000
write(3, "MZ\220\0\3\0\0\0\4\0\0\0\377\377\0\0\270\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 8192) = 8192
write(3, "Q\211\307\211\34$\350\30U\0\0\205\300Rt}\213\205p\376\377\377\211\34$\307\205\254\376\377\377\2"..., 15065088) = 15065088
openat(AT_FDCWD, "/etc/localtime", O_RDONLY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=2298, ...}) = 0
fstat(4, {st_mode=S_IFREG|0644, st_size=2298, ...}) = 0
read(4, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\t\0\0\0\t\0\0\0\0"..., 4096) = 2298
lseek(4, -1449, SEEK_CUR) = 849
read(4, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\t\0\0\0\t\0\0\0\0"..., 4096) = 1449
close(4) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=NULL} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)
Works on fedora 39 with:
Not working on fedora 40 with:
Issue remains with osslsigncode-2.9-1.fc40.x86_64
.
@olszomal I'm afraid check_key_fork
crash may be a separate issue...
I believe this issue is related to specific OpenSSL versions that cause a segmentation fault during private key operations. The fault occurs in engine operations and has been addressed upstream with commit openssl/openssl@39ea783.
OpenSSL versions requiring a workaround include:
The workaround was applied in OpenSC/libp11#554. I recommend closing this issue.
Description:
SIGSEGV in check_key_fork
Affected version: v2.8.
Steps to Reproduce:
Build under CentOS Stream 9, gcc (GCC) 11.4.1, (libcrypto v3.2.1)
run:
stack trace: