#11 Hangs while decrypting large messages

open
nobody
None
6
2001-11-24
2001-05-31
Anonymous
No

Linux x86 2.4.4
XEmacs 21.1.14
Gnus 5.8.8
GnuPG 1.0.6
Mailcrypt: all versions seem affected

Decrypting messages larger than a few kilobytes (encrypted) hangs XEmacs until gpg is killed from a shell, at which point a SIGPIPE error is displayed by mailcrypt.

Stracing both XEmacs and gpg shows that they're both stuck in a write syscall to their respective output pipes. Under Linux a pipe memory buffer is relatively small (one 4Kb page) and apparently mailcrypt tries to send the whole buffer to gpg before reading the cleartext ouput from its input pipe.

If I understand the problem correctly, in case of large enough ciphertext buffers (>8Kb?), this behaviour "clogs" both pipes - gpg decrypts the first 4Kb of cleartext then waits for mailcrypt to empty the output pipe, while mailcrypt keeps sending more ciphertext to gpg until the second pipe is full as well. This results in the deadlock I observed.

I have no idea of how this problem might be corrected, short of using temporary files instead of pipes (and lose security) or bypassing mailcrypt altogether for such messages. Either solution is probably not acceptable. Perhaps it is possible to improve the pipe r/w mechanism used by mailcrypt in some way - writing ciphertext in small chunks, or forking separate writer/reader processes come to mind as possible approaches.

Discussion

  • Brian Warner

    Brian Warner - 2001-11-20
    • priority: 5 --> 8
     
  • Brian Warner

    Brian Warner - 2001-11-20

    Logged In: YES
    user_id=24186

    Yeah, that's a fun bug. If anyone knows of a way to do this
    correctly, please let me know. Maybe some kind of process
    sentinel scheme? -Brian

     
  • Brian Warner

    Brian Warner - 2001-11-24

    Logged In: YES
    user_id=24186

    I just tried to verify this problem on (FSF) emacs21, and
    could not: a 1MB file seemed to encrypt and decrypt without
    trouble. I got a note from RMS saying that the send_process
    call should read output from the child task if the input
    pipe gets full.. perhaps XEmacs doesn't behave the same way?
    -Brian

     
  • Brian Warner

    Brian Warner - 2001-11-24

    Logged In: YES
    user_id=24186

    I just verified the problem still exists on XEmacs-21.4.5 .
    It looks
    like process-unix.c is meant to handle blocked pipes, but
    obviously something is broken. I use FSF emacs myself.. are
    there any XEmacs hackers in the room?

     
  • Brian Warner

    Brian Warner - 2001-11-24
    • priority: 8 --> 6
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks