HandleManager 'No such file or directory', segmentation fault

Aperta
#773 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cpp
Ambito
backend

Direzione di ricerca

The report points to src/lib/handle_mgr/HandleManager.cpp, line 75, where HandleManager::getSession segfaults because this is null during a SoftHSMv2 signing operation through OpenSSL and pkcs11-provider. Start by reading that function and the related discussion in issue #635, then trace how the session's HandleManager is obtained. Done means the failing signing flow no longer segfaults; the issue does not identify a test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I'm trying to use SoftHSMv2 in OpenSSL via pkcs11-provider. I'm building SoftHSMv2 from source, https://github.com/softhsm/SoftHSMv2/commit/a181dae9d3bfe270d81f29c7a799ee36daa5242a. When I try to sign something I get a seg fault.

root@d9a3a7531a3c:/# echo "test" > test.txt
   openssl pkeyutl -provider softhsm -sign -inkey "pkcs11:object=test;type=private" -in test.txt -out signature.bin
Enter pass phrase for PKCS#11 Token (Slot 479520929 - SoftHSM slot ID 0x1c94e8a1):
Segmentation fault (core dumped)

Running it under gdb, It looks like it's this line that is failing. (gdb output below.)

https://github.com/softhsm/SoftHSMv2/blob/a181dae9d3bfe270d81f29c7a799ee36daa5242a/src/lib/handle_mgr/HandleManager.cpp#L75

This may be related, https://github.com/softhsm/SoftHSMv2/issues/635#issuecomment-1699242624.

Stack trace
root@d9a3a7531a3c:/# gdb openssl
GNU gdb (Debian 13.1-3) 13.1
[...]
(gdb) run pkeyutl -provider softhsm -sign -inkey "pkcs11:object=test;type=private" -in test.txt -out signature.bin
Starting program: /usr/local/bin/openssl pkeyutl -provider softhsm -sign -inkey "pkcs11:object=test;type=private" -in test.txt -out signature.bin
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
Enter pass phrase for PKCS#11 Token (Slot 479520929 - SoftHSM slot ID 0x1c94e8a1):

Program received signal SIGSEGV, Segmentation fault.
0x0000fffff77018c8 in HandleManager::getSession (this=0x0, hSession=hSession@entry=1) at HandleManager.cpp:75
75      HandleManager.cpp: No such file or directory.
Lingua principale
C++
Stelle
1.1k
Fork
434
Merge medio
12g 14h
PR unite (30g)
2

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di softhsm/SoftHSMv2

Tutte le issue di softhsm/SoftHSMv2

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.