Page MenuHome GnuPG

Pinentry-curses fallback + gpg / gpgsm can lead to endless 100% cpu loop
Closed, DuplicatePublic

Description

While testing T2874 i noticed that I had a pinentry process churning 100%
cpu in one thread.

Backtrace after attaching:

(gdb) bt
#0 0x00007f0fef283873 in __select_nocancel () at
../sysdeps/unix/syscall-template.S:81
#1 0x00007f0feff8ab64 in _nc_timed_wait () from /lib/x86_64-linux-gnu/libtinfo.so.5
#2 0x00007f0ff01aa8f8 in _nc_wgetch () from /lib/x86_64-linux-gnu/libncurses.so.5
#3 0x00007f0ff01ab3d5 in wgetch () from /lib/x86_64-linux-gnu/libncurses.so.5
#4 0x00000000004125bc in dialog_run (tty_type=<optimized out>,
tty_name=<optimized out>, pinentry=<optimized out>)

at ../../pinentry/pinentry-curses.c:931

#5 curses_cmd_handler (pinentry=<optimized out>) at
../../pinentry/pinentry-curses.c:1162
#6 0x000000000040db47 in cmd_getpin (ctx=0x7f0ff20be008, line=<optimized out>)
at ../../pinentry/pinentry.c:1268
#7 0x00007f0ff1ca88c1 in dispatch_command (ctx=0x7f0ff20be008,
line=0x7f0ff20be15e "", linelen=<optimized out>)

at assuan-handler.c:675

#8 0x00007f0ff1ca8bd9 in process_request (ctx=0x7f0ff20be008) at
assuan-handler.c:871
#9 assuan_process (ctx=0x7f0ff20be008) at assuan-handler.c:894
#10 0x000000000040e3dd in pinentry_loop2 (infd=0, outfd=<optimized out>) at
../../pinentry/pinentry.c:1537
#11 0x0000000000407b63 in main (argc=1, argv=0x7ffd3b895768) at
../../qt/main.cpp:348

To reproduce:
unset display
echo foo | gpg -s
-> Hit crtl + C in the curses dialog

Afterwards the input on my terminal is broken somewhat (it replaces inputs
sometimes with * etc) and pinentry churns CPU