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

Crash attempting to query AIS card #824

Closed
programatix opened this issue Jul 11, 2016 · 6 comments
Closed

Crash attempting to query AIS card #824

programatix opened this issue Jul 11, 2016 · 6 comments

Comments

@programatix
Copy link
Contributor

Expected behaviour

What should happen?
I'm not expecting a crash

Actual behaviour

What happens instead?
The application crashed (opensc-explorer.exe, opensc-tool.exe and etc)

Steps to reproduce

I'm using Windows 10. I tried OpenSC 32-bit and 64-bit with same result.

  1. added custom ATR using "Gemalto MultiApp IAS/ECC v1.0.1" config in opensc.conf
  2. execute "opensc-tool --atr -v -v -v"
  3. crashed with message "OpenSC command line tool has stopped working."

Additional info
If I set "debug_file" in opensc.conf, it doesn't crash.

Logs

Please use Gist (https://gist.github.com/) or a similar code paster for longer
logs.

https://gist.github.com/programatix/96396074e23815971af14b7f44e7ec2d

@frankmorgner
Copy link
Member

You could try running this on Unix in gdb or similar. This would tell the exact place where the program crashes...

@viktorTarasov ?

@programatix
Copy link
Contributor Author

I traced the source code and I think I can safely say that it crashed when calling module_init from dll-tool.dll.

@programatix
Copy link
Contributor Author

I meant smm-local.dll

@viktorTarasov
Copy link
Member

On Win7-64x with the latest release I do not have such problems.
Will try to find the Win10.

@viktorTarasov
Copy link
Member

viktorTarasov commented Nov 21, 2016

I do not have problems on Win10-64 with the latest release. SM module is loaded and correctly used to manage protected application.

Have you used the same release?

@viktorTarasov
Copy link
Member

If I set "debug_file" in opensc.conf, it doesn't crash.

Well, taking into consideration this remark, I also have segfault.

viktorTarasov added a commit to viktorTarasov/OpenSC-SM that referenced this issue Nov 23, 2016
Issue OpenSC#824

In Windows, file handles (including 'stderr', 'stdout') can not be shared
between DLL-s, and so, the log handle (File *), defined in one module, cannot
be reused in another.

That is the situation when, for example, the SM is processed
in external, dynamically loadable module as it currently implemented for
IAS/ECC card.

That's for the configuration option 're-open of log file on each message' was
introduced.

This 're-open' logic has not been tested in the particular case of opensc-*
tools used with verbose log into 'stderr' -- in dynamically loaded module the
'stderr' handle, defined in the 'main' module, was not recognized as 'stderr'
and there was an attempt to close it.
viktorTarasov added a commit to viktorTarasov/OpenSC-SM that referenced this issue Nov 23, 2016
Issue OpenSC#824

In Windows, file handles (including 'stderr', 'stdout') can not be shared
between DLL-s, and so, the log handle (File *), defined in one module, cannot
be reused in another.

That is the situation when, for example, the SM is processed
in external, dynamically loadable module as it currently implemented for
IAS/ECC card.

That's for the configuration option 're-open of log file on each message' was
introduced.

This 're-open' logic has not been tested in the particular case of opensc-*
tools used with verbose log into 'stderr' -- in dynamically loaded module the
'stderr' handle, defined in the 'main' module, was not recognized as 'stderr'
and there was an attempt to close it.
frankmorgner added a commit to frankmorgner/OpenSC that referenced this issue Nov 30, 2016
remove the user configuration option reopen_debug_file and instead
handle the underlying problem internally. File handles may not be shared
among DLLs, so we reopen the debug file descriptor once when loading a
module that OpenSC's internal debugging.

Fixes OpenSC#824
Closes OpenSC#910
viktorTarasov added a commit that referenced this issue Dec 18, 2016
Issue #824

In Windows, file handles (including 'stderr', 'stdout') can not be shared
between DLL-s, and so, the log handle (File *), defined in one module, cannot
be reused in another.

That is the situation when, for example, the SM is processed
in external, dynamically loadable module as it currently implemented for
IAS/ECC card.

That's for the configuration option 're-open of log file on each message' was
introduced.

This 're-open' logic has not been tested in the particular case of opensc-*
tools used with verbose log into 'stderr' -- in dynamically loaded module the
'stderr' handle, defined in the 'main' module, was not recognized as 'stderr'
and there was an attempt to close it.

closes #910
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants