Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segmentation fault on linux using cherry reader with pinpad #3022

Closed
tlahn opened this issue Feb 12, 2024 · 5 comments · Fixed by #3023
Closed

segmentation fault on linux using cherry reader with pinpad #3022

tlahn opened this issue Feb 12, 2024 · 5 comments · Fixed by #3023

Comments

@tlahn
Copy link

tlahn commented Feb 12, 2024

Problem Description

Using Cherry card reader with pin via pinpad on Linux causes segmentation fault for current master branch.

Test command and result on master:

$ pkcs11-tool --test --login
Using slot 0 with a present token (0x0)
Segmentation fault (core dumped)

When specifying pin on commandline it does not show the segfault. It fails expectedly with a different error, which will be fixed by #2943

$ pkcs11-tool --test --login -p 111111111111
Using slot 0 with a present token (0x0)
C_SeedRandom() and C_GenerateRandom():
  seeding (C_SeedRandom) not supported
  seems to be OK
Digests:
  all 4 digest functions seem to work
  MD5: OK
  RIPEMD160: OK
  SHA-1: OK
  SHA256: OK
Ciphers: not implemented
Signatures (currently only for RSA)
  testing key 0 (Authentisierungsschluessel)
error: PKCS11 function C_SignFinal failed: rv = CKR_USER_NOT_LOGGED_IN (0x101)
Aborting.

Running the commands on git tag 0.24.0 does not show a segfault, whether I set pin on commandline or not.

Using git bisect I could identify these commits as the change from ok to error:

Steps to reproduce

$ ./bootstrap && ./configure --prefix=/usr/local --sysconfdir=/etc/opensc && make && sudo make install
$ pkcs11-tool --test --login

Details on hardware and config

Reader and card info:

$ opensc-tool -n
Using reader with a card: Cherry GmbH SmartTerminal ST-2xxx [CCID Interface] (55952134200215) 00 00
Atos CardOS

The card is a D-TRUST Card 4.1 Std. RSA 2ca.

Config:

$ cat $OPENSC_CONF
app default {
  debug = 9;
  debug_file = /tmp/tmp.cKWXxeUgGb/opensc-debug.txt;
}

Logs

Log file from execution on master without specifying pin on commandline is attached: opensc-debug-master-pinpad-redacted.txt.

I redacted personal details returned by the card as far as I found them. Logs should not contain pin, as the process failed before entering it, but it would not matter as I changed it for testing purposes.

I could also provide similar logs for any of the other code revisions if this is helpful. Just let me know.

dmesg shows the following error: pkcs11-tool[104048]: segfault at 0 ip 0000000000000000 sp 00007fffd93b8d28 error 14 in pkcs11-tool[5634feed4000+7000] likely on CPU 1 (core 1, socket 0)

Jakuje added a commit to Jakuje/OpenSC that referenced this issue Feb 12, 2024
@Jakuje Jakuje mentioned this issue Feb 12, 2024
5 tasks
@Jakuje
Copy link
Member

Jakuje commented Feb 12, 2024

🤦 obviously the conditions are negated: Can you verify this is fixed with #3023 ?

@tlahn
Copy link
Author

tlahn commented Feb 12, 2024

The problem is fixed with #3023 for me. Thanks for your fast response.

Jakuje added a commit that referenced this issue Feb 13, 2024
@hamarituc
Copy link
Contributor

The problem is fixed with #3023 for me. Thanks for your fast response.

Was it a request to me to do a rebase of this pull-request or a request to @tlahn for doing this locally at his side?

@Jakuje
Copy link
Member

Jakuje commented Feb 13, 2024

I think rebasing would be good to make sure it works ok, but there is very little chance it will have some effect to each other.

@hamarituc
Copy link
Contributor

I think rebasing would be good to make sure it works ok, but there is very little chance it will have some effect to each other.

Sorry, my last comment was meant to go to #2943. Nevertheless, I did a rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants