scdaemon sends SIGUSR2 to foreground gpg-agent

NIIBE Yutaka gniibe at fsij.org
Thu Nov 11 01:48:32 CET 2010


Hi,

Using Gnuk, I found a small problem at the interaction between
scdaemon and gpg-agent.  I am using gnupg2-2.0.14 (on Debian) and
reading its source, and reading the code
gnupg-2.1.0beta1/agent/gpg-agent.c too.

When we run gpg-agent in background, no problem.  In the function
handle_connections (agent/gpg-agent.c), it setups SIG_IGN for SIGUSR2.
# As we use gpg-agent in background, we don't see any problem usually.

Invoked as foreground, gpg-agent does nothing for setup for SIGUSR2.

When there is no gpg-agent, it will be spawned with "--server"
(foreground).  Then, when scdaemon will find Gnuk Token, it sends
SIGUSR2 to gpg-agent.  Thus, gpg-agent will be killed, and it results
"IPC write error".

Scdaemon should not send SIGUSR2 to foreground gpg-agent, or,
gpg-agent would setup SIG_IGN for SIGUSR2, even if it runs foreground.

Here is the interaction log:
-----
$ gpg2 --card-edit
can't connect to `/home/gniibe/.gnupg/S.gpg-agent': No such file or directory
Application ID ...: D276000124010200F517000000010000
Version ..........: 2.0
Manufacturer .....: unknown
Serial number ....: 00000001
Name of cardholder: Yutaka Niibe
Language prefs ...: ja
Sex ..............: male
URL of public key : http://www.gniibe.org/gniibe.asc
Login data .......: gniibe
Signature PIN ....: forced
Key attributes ...: 2048R 2048R 2048R
Max. PIN lengths .: 127 127 127
PIN retry counter : 3 3 3
Signature counter : 2
Signature key ....: 1241 24BD 3B48 62AF 7A0A  42F1 00B4 5EBD 4CA7 BABE
      created ....: 2010-10-15 06:46:33
Encryption key....: 42E1 E805 4E6F 1F30 26F2  DC79 79A7 9093 0842 39CF
      created ....: 2010-10-15 06:46:33
Authentication key: B4D9 7142 C42D 6802 F5F7  4E70 9C33 B6BA 5BB0 65DC
      created ....: 2010-10-22 06:06:36
General key info..:
pub  2048R/4CA7BABE 2010-10-15 NIIBE Yutaka <gniibe at fsij.org>
sec>  2048R/4CA7BABE  created: 2010-10-15  expires: never
                      card-no: F517 00000001
ssb>  2048R/084239CF  created: 2010-10-15  expires: never
                      card-no: F517 00000001
ssb>  2048R/5BB065DC  created: 2010-10-22  expires: never
                      card-no: F517 00000001

Command> scdaemon[7182]: updating slot 0 status: 0x0000->0x0007 (0->1)
scdaemon[7182]: sending signal 12 to client 7181
scdaemon[7182]: scdaemon (GnuPG) 2.0.14 stopped


gpg: OpenPGP card not available: IPC write error

Command>
-- 



More information about the Gnupg-devel mailing list