pgp semaphores management on linux

Posted on

Problem :

I’ve an issue with pgp semaphores management.

As far as I see pgp (version 6.5.8) creates 4 semaphores while starting to encrypt the file but only 2 of them are then destroyed at the end.

To reproduce I’ve tried to..

1) list of currently used semaphores

> ipcs -s

------ Semaphore Arrays --------
key        semid      owner      perms      nsems
0x00000000 0          root       600        1
0x00000000 32769      root       600        1
0x00000000 98306      nobody     600        1
0x00000000 131075     nobody     600        1
0x00000000 163844     nobody     600        1
0x00000000 196613     nobody     600        1
0x00000000 229382     nobody     600        1

2 semaphores are used by “root” user and 4 semaphores used by nobody (apache webserver) user.

2) then if I try to create and encrypt a file just created I obtain such output:

> pgp -e /tmp/test.tmp 'ftp-vega <ftp-vega@it.st.com>'
Pretty Good Privacy(tm) Version 6.5.8
(c) 1999 Network Associates Inc.
Uses the RSAREF(tm) Toolkit, which is copyright RSA Data Security, Inc.
Export of this software may be restricted by the U.S. government.



Recipients' public key(s) will be used to encrypt.

Key for user ID: ftp-vega <ftp-vega@it.st.com>
2048-bit RSA key, Key ID 0x8AB0285F, created 2005/11/02
Key can sign.

Ciphertext file: /tmp/test.tmp.pgp

and the file is correctly encrypted (and can obvioulsy be decripted), so, in my understanding, the encryption process completes succesfully (apparently) without any iusses…

3) But then, if I try to list again semaphores used I see that 2 more semaphores had been created but not cleaned:

> ipcs -s

------ Semaphore Arrays --------
key        semid      owner      perms      nsems
0x00000000 0          root       600        1
0x00000000 32769      root       600        1
0x00000000 98306      nobody     600        1
0x00000000 131075     nobody     600        1
0x00000000 163844     nobody     600        1
0x00000000 196613     nobody     600        1
0x00000000 229382     nobody     600        1
0x00000000 11599881   root       0          1
0x00000000 11632650   root       0          1

As on this system pgp is running several times a day (for several files to be encrypted) some days ago I’ve listed more than 1000 orphan semaphores having perms = 0.

Is there anyone that has the same behaviour?
What I can do to prevent it (instead to remove any time any orphan semaphores created)?

Thanks anyone would be able to help me (and sorry for my english).

Ciao,
Stefano
Milan, Italy

Solution :

I’ve finally discovered the cause of orphans semaphores that are caused by pgp (Pretty Good Privacy(tm) Version 6.5.8 – (c) 1999 Network Associates Inc) under Linux machine.
PGP uses a semaphores architecture to encrypt data… during encryptions 4 semaphores are created but only 2 of them destroyed at the end and for several files to be encrypted it may cause the above described behaviour.

Leave a Reply

Your email address will not be published. Required fields are marked *