Intermittent data corruption in gpg 1.2.0

judy m. down judy0@blackburnmail.com
Tue Dec 17 11:20:09 2002


Any help would be appreciated.

Most of the time, it works perfectly. But for some files, it fails about
10% to 20% of the time. One such file is /var/lib/dpkg/available, which is
a
debian file.

When I decrypt, gpg complains:

	gpg: [don't know]: invalid packet (ctb=14)

I tried several ways to recreate it without using gpg, but it never
happened without it, which is why I am posting here.  I'm not 100% certain
it's gpg that's causing the corruption, however, because it's hard
to recreate without calling gpg from afio.

A typical input that sometimes causes data corruption:

$ find /var/lib/dpkg/available /var/lib/dpkg/available |
	afio -oz -Z -U \
			-P gpg \
			-Q --batch \
			-Q --no-options \
			-Q --homedir -Q $homedir \
			-Q --always-trust \
			-Q --no-auto-check-trustdb \
			-Q --recipient -Q "${qid:?}" \
			-Q --debug-all -Q -vv \
			-Q -e \
			-3 0 \
			"$qofile"

Typical output:

(The real output is huge, but to spare everybody's mailboxes I elided it
with "...".)
gpg: DBG: fd_cache_open (/home/judy/root-var/staging--xyzzy-staging/tmpd-qh
ome-qout--2002-12-17-Tue-00-50-45-083--13835/pubring.gpg) not cached
gpg: DBG: iobuf-1.0: open `/home/judy/root-var/staging--xyzzy-staging/tmpd-
qhome-qout--2002-12-17-Tue-00-50-45-083--13835/pubring.gpg' fd=3
gpg: DBG: iobuf-1.0: underflow: req=8192
gpg: DBG: iobuf-1.0: underflow: got=877 rc=0
gpg: DBG: parse_packet(iob=1): type=6 length=418 (search.keyring.c.962)
gpg: DBG: mpi_alloc(1024)
gpg: DBG: mpi_alloc_limb_space(1024)
gpg: DBG: mpi_alloc(160)
gpg: DBG: mpi_alloc_limb_space(160)
gpg: DBG: mpi_alloc(1024)
gpg: DBG: mpi_alloc_limb_space(1024)
gpg: DBG: mpi_alloc(1024)
gpg: DBG: mpi_alloc_limb_space(1024)
gpg: DBG: free_packet() type=6
gpg: DBG: mpi_free
gpg: DBG: dummy m_size called
gpg: DBG: mpi_free_limb_space of size 0
gpg: DBG: mpi_free
...
gpg: DBG: parse_packet(iob=2): type=12 length=2 (parse.keyring.c.382)
gpg: DBG: iobuf-2.0: underflow: req=8192
gpg: DBG: iobuf-2.0: underflow: got=0 rc=-1
gpg: DBG: /home/judy/root-var/staging--xyzzy-staging/tmpd-qhome-qout--2002-
12-17-Tue-00-50-45-083--13835/pubring.gpg: close fd 6
gpg: DBG: fd_cache_close (/home/judy/root-var/staging--xyzzy-staging/tmpd-q
home-qout--2002-12-17-Tue-00-50-45-083--13835/pubring.gpg) new slot created
gpg: DBG: iobuf-2.0: underflow: eof
gpg: DBG: iobuf-2.0: close `(null)'
gpg: DBG: finish_lookup: checking key DE60C724 (all)(req_usage=2)
gpg: DBG: 	checking subkey 90B0FE82
gpg: DBG: 	subkey looks fine
gpg: DBG: 	using key 90B0FE82
gpg: using secondary key 90B0FE82 instead of primary key DE60C724
gpg: DBG: mpi_alloc(1024)
gpg: DBG: mpi_alloc_limb_space(1024)
gpg: DBG: mpi_alloc(32)
gpg: DBG: mpi_alloc_limb_space(32)
gpg: DBG: mpi_alloc(1024)
gpg: DBG: mpi_alloc_limb_space(1024)
gpg: DBG: free_packet() type=6
gpg: DBG: mpi_free
...
gpg: DBG: dummy m_size called
gpg: DBG: mpi_free_limb_space of size 0
gpg: DBG: iobuf-1.0: close `file_filter(fd)'
gpg: DBG: /home/judy/root-var/staging--xyzzy-staging/tmpd-qhome-qout--2002-
12-17-Tue-00-50-45-083--13835/pubring.gpg: close fd 3
gpg: DBG: fd_cache_close (/home/judy/root-var/staging--xyzzy-staging/tmpd-q
home-qout--2002-12-17-Tue-00-50-45-083--13835/pubring.gpg) new slot created
gpg: key DE60C724: accepted as trusted key
gpg: DBG: fd_cache_open (/home/judy/root-var/staging--xyzzy-staging/tmpd-qh
ome-qout--2002-12-17-Tue-00-50-45-083--13835/pubring.gpg) using cached fp
gpg: DBG: iobuf-3.0: open `/home/judy/root-var/staging--xyzzy-staging/tmpd-
qhome-qout--2002-12-17-Tue-00-50-45-083--13835/pubring.gpg' fd=3
gpg: DBG: iobuf-3.0: underflow: req=8192
gpg: DBG: iobuf-3.0: underflow: got=877 rc=0
gpg: DBG: parse_packet(iob=3): type=6 length=418 (search.keyring.c.962)
gpg: DBG: mpi_alloc(1024)
gpg: DBG: mpi_alloc_limb_space(1024)
gpg: DBG: mpi_alloc(160)
gpg: DBG: mpi_alloc_limb_space(160)
gpg: DBG: mpi_alloc(1024)
gpg: DBG: mpi_alloc_limb_space(1024)
gpg: DBG: mpi_alloc(1024)
...
gpg: reading from `[stdin]'
gpg: DBG: iobuf-6.0: create `file_filter(fd)'
gpg: writing to stdout
gpg: DEK is:  5F 90 2E CC 73 C6 D5 68 28 28 E9 83 47 5D AD 14
gpg: DBG: mpi_alloc_secure(1024)
gpg: DBG: mpi_alloc_limb_space(1024)
gpg: DBG: pubkey_encrypt: algo=16
gpg: pkey:DF343045A08D5A1444CB41CDA2C46115D7705FE9E8010A62582747E137D99DADE
AA5502B8395914869618ADB8F0FC7C96A394D0FC11FCACD8E1251012CF59F71D8EB6CBB8D96
C78E46F8E4D9487E8CC7F552FF7C85D3EAC1705A38A8ECAD6368A20E99F41BE469D62B040B2
1E00C8000F5D830C32866305D5CF7C5BBB5D444A7
gpg:   pkey:7
gpg: pkey:836770522FB9D5AE75C7CC20A1D612B3D6533211C9D295A5C251E01C8F555DC69
1A068B7B199DE451ADC1C16648F3130460FB49EB39DD2A9C136667C85BBDB39087C9DEB372B
74574B3D093D178D6323546AACC9DF5417A7733E97DBE56DB5AD4A8A4C39E6CF60D14040E4B
4162328C034439C07C25CB083C4CE5D44034C146F
gpg: data:23F753D74A97F5D749FA6B608389E49F9B230D0E0184D11F4CF06896E951F8F16
33EF90204245B0F59A5158CDA122E74726F3B36D3ED1D00D6CA69CCF45F1F4E86F22AB6F728
76DC6F707D58C7CFE32A2FFA3E1B289C2424E6228A44E04D72DD47FD906860E5E5C0AFFF800
075F902ECC73C6D5682828E983475DAD140780
gpg: DBG: mpi_alloc(1024)
gpg: DBG: mpi_alloc_limb_space(1024)
...
gpg: DBG: mpi_free_limb_space of size 0

gpg: DBG: mpi_free
gpg: DBG: dummy m_size called
gpg: DBG: mpi_free_limb_space of size 0
gpg: DBG: mpi_free
...
gpg: DBG: dummy m_size called
gpg: DBG: mpi_free_limb_space of size 0
...
gpg: DBG: mpi_free_limb_space of size 0
gpg: encr:A95A43FC1E3AC98A87BE2AD0E97EDEA0548B604C8F673DCA471E4EE9E5438D075
F7887F15C433604471DFDDC4C3471C3BCA4F02684A4D0E10DD176A5F6C54CFC12471B0627D8
E097FD84FD4C8638EADD6759386C33B0473513AE03DDCA346611906963B657A6A1483457D8C
BAB8272F588C04AFBDDF38592C862B4681F8C9A67
gpg: encr:96FF58BB696CC64212F9EE5EB754A05119BBABD3C7874B4322226F9C842D3A412
52DCCEC3548E015920C4EDF2B80940A64825C4CDA639BD52EA04A4D21A3C5E5180DC4D4973B
815346F191B78F0B97D5C17637C9A9B35C0F2C994C57B676EC0F7D3529ED8084B9E9A3113E0
340B1415C1958914C869D73ADFBBFF355D970988
gpg: DBG: mpi_free
gpg: DBG: dummy m_size called
gpg: DBG: mpi_free_limb_space of size 0
gpg: ELG-E/AES encrypted for: "90B0FE82 aaaaa <a@a>"
gpg: DBG: build_packet() type=1
gpg: DBG: iobuf-7.0: close `(null)'
gpg: DBG: mpi_free
...
gpg: DBG: iobuf-5.0: underflow: got=8192 rc=0
gpg: DBG: enter deflate: avail_in=8192, avail_out=8192, flush=0
gpg: DBG: leave deflate: avail_in=8192, avail_out=0, n=8192, zrc=0
gpg: DBG: enter deflate: avail_in=8192, avail_out=8192, flush=0
gpg: DBG: leave deflate: avail_in=8192, avail_out=0, n=8192, zrc=0
gpg: DBG: enter deflate: avail_in=8192, avail_out=8192, flush=0
gpg: DBG: leave deflate: avail_in=0, avail_out=6816, n=1376, zrc=0
gpg: DBG: iobuf-5.0: underflow: req=8192
gpg: DBG: iobuf-5.0: underflow: got=8192 rc=0
gpg: DBG: enter deflate: avail_in=8192, avail_out=8192, flush=0
...
gpg: DBG: enter deflate: avail_in=8192, avail_out=8192, flush=0
gpg: DBG: leave deflate: avail_in=0, avail_out=0, n=8192, zrc=0
gpg: DBG: iobuf-5.0: underflow: req=8192
gpg: DBG: iobuf-5.0: underflow: got=0 rc=-1
gpg: DBG: iobuf-5.0: underflow: eof
gpg: DBG: iobuf-5.0: underflow: eof (due to filter eof)
gpg: DBG: iobuf-6.3: pop `block_filter'
gpg: DBG: free block_filter 0x80e04f0
gpg: DBG: iobuf-6.2: popped filter
gpg: DBG: iobuf-5.0: close `(null)'
gpg: DBG: enter deflate: avail_in=3727, avail_out=8192, flush=0
gpg: DBG: leave deflate: avail_in=3727, avail_out=0, n=8192, zrc=0
gpg: DBG: enter deflate: avail_in=3727, avail_out=8192, flush=0
gpg: DBG: leave deflate: avail_in=3727, avail_out=0, n=8192, zrc=0
gpg: DBG: enter deflate: avail_in=3727, avail_out=8192, flush=0
gpg: DBG: leave deflate: avail_in=0, avail_out=6754, n=1438, zrc=0
gpg: DBG: iobuf-6.2: close `compress_filter'
gpg: DBG: enter deflate: avail_in=0, avail_out=8192, flush=4
gpg: DBG: leave deflate: avail_in=0, avail_out=5012, n=3180, zrc=1
gpg: DBG: iobuf-6.1: close `cipher_filter'
gpg: DBG: iobuf-6.1: close `block_filter'
gpg: DBG: free block_filter 0x80e0390
gpg: DBG: iobuf-6.0: close `file_filter(fd)'
gpg: DBG: free_packet() type=11
gpg: DBG: mpi_free
gpg: DBG: dummy m_size called
gpg: DBG: mpi_free_limb_space of size 0
gpg: DBG: mpi_free
gpg: DBG: dummy m_size called
gpg: DBG: mpi_free_limb_space of size 0
gpg: DBG: mpi_free
gpg: DBG: dummy m_size called
gpg: DBG: mpi_free_limb_space of size 0
random usage: poolsize=600 mixed=11 polls=0/13 added=70/1772
              outmix=5 getlvl1=4/169 getlvl2=0/0
secmem usage: 1408/2496 bytes in 2/7 blocks of pool 2816/16384
afio: "/var/lib/dpkg/available.z": Error zipping file, written damaged copy
to archive.

...

Can anybody help?  I don't know what else to do.  I am using debian sarge,
ext3, software raid mirroring, linux 2.4.19ac4.

Thanks!




--
judy m. down 
<judy0@blackburnmail.com>

--------------------------------------------------------------------
Get your free email address at http://www.blackburnmail.com/