Hello

I'm having issues with OpenSSL library password reading functionality
when called from Haskell (ghc) code on Linux. The issue is that
ui_openssl.c calls sigaction to push and pop signals and loses in
the process the SA_RESTART flag. Without SA_RESTART system calls
like read can fail with ERESTARTSYS, which causes fgets to fail and
the error to propagate. 

The error scenario works like this:
+ GHC uses SIGVTALRM for multitasking and sets SA_RESTART on it
+ pem pasword reading code tries to read password from the tty
+ ui_openssl.c saves the old SIGVTALRM and installs a new one without SA_RESTART
+ fgets calls read
+ read gets interrupted with ERESTARTSYS
+ fgets doesn't handle this and propagates the error
+ reading the pem password fails

Possible alternate fixes are:
+ Ignore SIGVTALRM in the code like SIGUSR1
+ Install the handlers with sigaction respecting SA_RESTART
+ Deal with ERESTARTSYS in the fgets code

Would it be possible to fix this? I can provide a patch to ignore
SIGVTALRM but that is just a two-line change.

- Taru Karttunen
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to