NetBSD Problem Report #42435
From jruohone@gmail.com Thu Dec 10 12:18:45 2009
Return-Path: <jruohone@gmail.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id C65C063BAB5
for <gnats-bugs@gnats.netbsd.org>; Thu, 10 Dec 2009 12:18:45 +0000 (UTC)
Message-Id: <20091210093441.B87D42A55@marx.bitnet>
Date: Thu, 10 Dec 2009 11:34:41 +0200 (EET)
From: Jukka Ruohonen <jruohonen@iki.fi>
Sender: a b <jruohone@gmail.com>
Reply-To: jruohonen@iki.fi
To: gnats-bugs@gnats.NetBSD.org
Subject: netpgpkeys(1) segfaults
X-Send-Pr-Version: 3.95
>Number: 42435
>Category: bin
>Synopsis: netpgpkeys(1) segfaults
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: agc
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Dec 10 12:20:01 +0000 2009
>Closed-Date: Sun Dec 05 07:09:34 +0000 2010
>Last-Modified: Sun Dec 05 07:09:34 +0000 2010
>Originator: Jukka Ruohonen
>Release: NetBSD 5.99.21
>Organization:
-
>Environment:
Architecture: i386
Machine: i386
>Description:
$ netpgpkeys --export-key
Memory fault
>How-To-Repeat:
$ netpgpkeys --export-key
Memory fault
$ ktruss netpgpkeys --export-key
[...]
1202 1 netpgpkeys open("/home/jruoho/.gnupg/pubring.gpg", 0, 0x1) = 3
1202 1 netpgpkeys __fstat50(0x3, 0xbf97a850) = 0
1202 1 netpgpkeys mmap(0, 0x4b30, 0x1, 0x2, 0x3, 0, 0, 0) =
0xb7ff1000
1202 1 netpgpkeys close(0x3) = 0
1202 1 netpgpkeys munmap(0xb7ff1000, 0x4b30) = 0
1202 1 netpgpkeys close(0x3) Err#9 EBADF
1202 1 netpgpkeys open("/home/jruoho/.gnupg/secring.gpg", 0, 0x1) = 3
1202 1 netpgpkeys __fstat50(0x3, 0xbf97a850) = 0
1202 1 netpgpkeys mmap(0, 0x1571, 0x1, 0x2, 0x3, 0, 0, 0) =
0xb7ff4000
1202 1 netpgpkeys close(0x3) = 0
1202 1 netpgpkeys munmap(0xb7ff4000, 0x1571) = 0
1202 1 netpgpkeys close(0x3) Err#9 EBADF
1202 1 netpgpkeys SIGSEGV SIG_DFL
$ netpgpkeys --coredumps --export-key
netpgp: warning: core dumps enabled
Memory fault (core dumped)
(gdb) bt
#0 0xb6db7cb0 in strlen () from /usr/lib/libc.so.12
#1 0xb6f9d908 in __ops_getkeybyname () from /usr/lib/libnetpgp.so.2
#2 0xb6f85b24 in netpgp_export_key () from /usr/lib/libnetpgp.so.2
#3 0x08048e71 in netpgp_cmd ()
#4 0x080492b5 in main ()
>Fix:
Not yet further investigated.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: bin-bug-people->agc
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Thu, 10 Dec 2009 12:25:36 +0000
Responsible-Changed-Why:
Over to maintainer.
From: "Alistair G. Crooks" <agc@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/42435 CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Date: Wed, 14 Apr 2010 00:18:46 +0000
Module Name: src
Committed By: agc
Date: Wed Apr 14 00:18:46 UTC 2010
Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: writer.c
Log Message:
Don't warn about erroneous errors in skey_checksum_finaliser().
Allocate space for the checkhash before attempting to use it - a
long-standing bug from openpgpsdk. Part of the fix for PR 42435 from
Jukka Ruohonen.
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 \
src/crypto/external/bsd/netpgp/dist/src/lib/writer.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Alistair G. Crooks" <agc@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/42435 CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Date: Wed, 14 Apr 2010 00:21:40 +0000
Module Name: src
Committed By: agc
Date: Wed Apr 14 00:21:40 UTC 2010
Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: openssl_crypto.c
Log Message:
Fixes to make key generation work properly - duplicate the public key RSA
BIGNUM fields - part of long-standing bug inherited from openpgpsdk.
Part of the fix for PR 42435 from Jukka Ruohonen.
Also pass the desired hash algorithm down, so that SHA1 is no longer
hardcoded.
To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 \
src/crypto/external/bsd/netpgp/dist/src/lib/openssl_crypto.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Alistair G. Crooks" <agc@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/42435 CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Date: Wed, 14 Apr 2010 00:22:21 +0000
Module Name: src
Committed By: agc
Date: Wed Apr 14 00:22:21 UTC 2010
Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c
Log Message:
Fix (RSA) key generation.
Part of the fix for PR 42435 from Jukka Ruohonen.
To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: agc@NetBSD.org
State-Changed-When: Sun, 18 Apr 2010 01:31:07 +0000
State-Changed-Why:
I think this has been fixed:
[4:45:01] agc@osx-vm1 ...bsd/netpgp/dist [2283] > netpgpkeys --export-key
netpgp: bad homedir
Cannot find own key "(null)" in keyring
key '(null)' not found
and so I was wondering if this is what you've found too?
Thanks,
Alistair
From: Jukka Ruohonen <jruohonen@iki.fi>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/42435 (netpgpkeys(1) segfaults)
Date: Tue, 20 Apr 2010 08:32:30 +0300
On Sun, Apr 18, 2010 at 01:31:08AM +0000, agc@NetBSD.org wrote:
> [4:45:01] agc@osx-vm1 ...bsd/netpgp/dist [2283] > netpgpkeys --export-key
> netpgp: bad homedir
> Cannot find own key "(null)" in keyring
> key '(null)' not found
>
> and so I was wondering if this is what you've found too?
Actually, no; I still get the memory fault:
$ netpgpkeys --version --verbose
NetPGP portable 3.99.1/[20100313]
All bug reports, praise and chocolate, please, to:
Alistair Crooks <agc@netbsd.org> c0596823
$ netpgpkeys --export-key
Memory fault
Also:
$ pwd
/home/jruoho
$ netpgpkeys --generate-key
netpgp: bad homedir
pub 2048/RSA (Encrypt or Sign) 31013f349cd14474 2010-04-20
Key fingerprint: 5f77 b000 423c c819 bdf9 3ad7 3101 3f34 9cd1 4474
uid RSA 2048-bit key <jruoho@localhost>
netpgp: generated keys in directory (null)/31013f349cd14474
(null)/31013f349cd14474/pubring.gpg: No such file or directory
can't open pubring '(null)/31013f349cd14474/pubring.gpg'
This was with an empty $HOME/.gnupg. It created an empty $HOME/homedir. When
I created .gnupg beforehand:
$ netpgpkeys --generate-key
/home/jruoho/.gnupg/pubring.gpg: No such file or directory
Can't read pubring /home/jruoho/.gnupg/pubring.gpg
Can't read pub keyring
pub 2048/RSA (Encrypt or Sign) 065b329b1348d105 2010-04-20
Key fingerprint: ccd7 f164 b8b3 7e2d f096 c90e 065b 329b 1348 d105
uid RSA 2048-bit key <jruoho@localhost>
netpgp: generated keys in directory /home/jruoho/.gnupg/065b329b1348d105
Memory fault
Even though it again faults, I can then continue the example and list the
key. But not if I omit the path:
$ netpgpkeys --list-keys <
/home/jruoho/.gnupg/pubring.gpg: No such file or directory
Can't read pubring /home/jruoho/.gnupg/pubring.gpg
Can't read pub keyring
Memory fault
The other options in netpgpkeys(1) seem to work fine though; I can list the
keys and signatures, find keys from my original .gnupg, and so on.
State-Changed-From-To: feedback->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 20 Apr 2010 15:30:48 +0000
State-Changed-Why:
feedback received, some problems still exist
State-Changed-From-To: open->feedback
State-Changed-By: agc@NetBSD.org
State-Changed-When: Sat, 08 May 2010 04:18:57 +0000
State-Changed-Why:
I've added code to set the netpgp variable for the home directory even if
it does not exist - I'd be grateful if you could try this one for me.
Thanks,
Alistair
From: "Alistair G. Crooks" <agc@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/42435 CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Date: Sat, 8 May 2010 04:17:45 +0000
Module Name: src
Committed By: agc
Date: Sat May 8 04:17:45 UTC 2010
Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c
Log Message:
if the home directory does not exist, still set its value as a netpgp
variable, as the netpgpkeys(1) program, for one, will try to create the
home directory if it does not exist.
should fix PR 42435
To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: feedback->open
State-Changed-By: jruoho@NetBSD.org
State-Changed-When: Thu, 05 Aug 2010 05:15:30 +0000
State-Changed-Why:
Problem is still there (5.99.37/i386).
From: Jukka Ruohonen <jruohonen@iki.fi>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/42435: netpgpkeys(1) segfaults
Date: Thu, 5 Aug 2010 08:13:56 +0300
Still no luck.
$ ktruss netpgpkeys --export-key > truss
24037 1 ktruss fktrace = 0
24037 1 ktruss emul(netbsd)
24037 1 ktruss fcntl(0x4, 0x3, 0) = 1
24037 1 ktruss fcntl(0x4, 0x4, 0x1) = 0
24037 1 ktruss execve("/bin/netpgpkeys", 0xbfbfeb48, 0xbfbfeb54) Err#2 ENOENT
24037 1 ktruss execve("/sbin/netpgpkeys", 0xbfbfeb48, 0xbfbfeb54) Err#2 ENOENT
24037 1 netpgpkeys execve("/usr/bin/netpgpkeys", 0xbfbfeb48, 0xbfbfeb54) JUSTRETURN
24037 1 netpgpkeys emul(netbsd)
24037 1 netpgpkeys mmap(0, 0x8000, 0x3, 0x1002, 0xffffffff, 0, 0, 0) = 0xbbbdf000
24037 1 netpgpkeys open("/etc/ld.so.conf", 0, 0) Err#2 ENOENT
24037 1 netpgpkeys open("/usr/lib/libnetpgp.so.3", 0, 0) = 3
24037 1 netpgpkeys __fstat50(0x3, 0xbfbfe348) = 0
24037 1 netpgpkeys mmap(0, 0x1000, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbbbde000
24037 1 netpgpkeys munmap(0xbbbde000, 0x1000) = 0
24037 1 netpgpkeys mmap(0, 0x37000, 0x5, 0x2, 0x3, 0, 0, 0) = 0xbbba8000
24037 1 netpgpkeys mmap(0xbbbdd000, 0x2000, 0x3, 0x12, 0x3, 0, 0x34000, 0) = 0xbbbdd000
24037 1 netpgpkeys mmap(0xbbbdf000, 0, 0x3, 0x1012, 0xffffffff, 0, 0, 0) = 0xbbbdf000
24037 1 netpgpkeys close(0x3) = 0
24037 1 netpgpkeys open("/usr/lib/libcrypto.so.6", 0, 0xbfbfe348) = 3
24037 1 netpgpkeys __fstat50(0x3, 0xbfbfe348) = 0
24037 1 netpgpkeys mmap(0, 0x1000, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbbba7000
24037 1 netpgpkeys munmap(0xbbba7000, 0x1000) = 0
24037 1 netpgpkeys mmap(0, 0x175000, 0x5, 0x2, 0x3, 0, 0, 0) = 0xbba33000
24037 1 netpgpkeys mmap(0xbbb8e000, 0x17000, 0x3, 0x12, 0x3, 0, 0x15b000, 0) = 0xbbb8e000
24037 1 netpgpkeys mmap(0xbbba5000, 0x3000, 0x3, 0x1012, 0xffffffff, 0, 0, 0) = 0xbbba5000
24037 1 netpgpkeys close(0x3) = 0
24037 1 netpgpkeys open("/usr/lib/libz.so.1", 0, 0xbfbfe348) = 3
24037 1 netpgpkeys __fstat50(0x3, 0xbfbfe348) = 0
24037 1 netpgpkeys mmap(0, 0x1000, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbba32000
24037 1 netpgpkeys munmap(0xbba32000, 0x1000) = 0
24037 1 netpgpkeys mmap(0, 0x12000, 0x5, 0x2, 0x3, 0, 0, 0) = 0xbba21000
24037 1 netpgpkeys mmap(0xbba32000, 0x1000, 0x3, 0x12, 0x3, 0, 0x10000, 0) = 0xbba32000
24037 1 netpgpkeys mmap(0xbba33000, 0, 0x3, 0x1012, 0xffffffff, 0, 0, 0) = 0xbba33000
24037 1 netpgpkeys close(0x3) = 0
24037 1 netpgpkeys open("/usr/lib/libbz2.so.1", 0, 0xbfbfe348) = 3
24037 1 netpgpkeys __fstat50(0x3, 0xbfbfe348) = 0
24037 1 netpgpkeys mmap(0, 0x1000, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbba20000
24037 1 netpgpkeys munmap(0xbba20000, 0x1000) = 0
24037 1 netpgpkeys mmap(0, 0x11000, 0x5, 0x2, 0x3, 0, 0, 0) = 0xbba10000
24037 1 netpgpkeys mmap(0xbba20000, 0x1000, 0x3, 0x12, 0x3, 0, 0x10000, 0) = 0xbba20000
24037 1 netpgpkeys mmap(0xbba21000, 0, 0x3, 0x1012, 0xffffffff, 0, 0, 0) = 0xbba21000
24037 1 netpgpkeys close(0x3) = 0
24037 1 netpgpkeys open("/usr/lib/libc.so.12", 0, 0xbfbfe348) = 3
24037 1 netpgpkeys __fstat50(0x3, 0xbfbfe348) = 0
24037 1 netpgpkeys mmap(0, 0x1000, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbba0f000
24037 1 netpgpkeys munmap(0xbba0f000, 0x1000) = 0
24037 1 netpgpkeys mmap(0, 0x10d000, 0x5, 0x2, 0x3, 0, 0, 0) = 0xbb903000
24037 1 netpgpkeys mmap(0xbb9f9000, 0x8000, 0x3, 0x12, 0x3, 0, 0xf6000, 0) = 0xbb9f9000
24037 1 netpgpkeys mmap(0xbba01000, 0xf000, 0x3, 0x1012, 0xffffffff, 0, 0, 0) = 0xbba01000
24037 1 netpgpkeys close(0x3) = 0
24037 1 netpgpkeys open("/lib/libcrypt.so.1", 0, 0xbfbfe348) = 3
24037 1 netpgpkeys __fstat50(0x3, 0xbfbfe348) = 0
24037 1 netpgpkeys mmap(0, 0x1000, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbb902000
24037 1 netpgpkeys munmap(0xbb902000, 0x1000) = 0
24037 1 netpgpkeys mmap(0, 0x9000, 0x5, 0x2, 0x3, 0, 0, 0) = 0xbb8fa000
24037 1 netpgpkeys mmap(0xbb8ff000, 0x1000, 0x3, 0x12, 0x3, 0, 0x5000, 0) = 0xbb8ff000
24037 1 netpgpkeys mmap(0xbb900000, 0x3000, 0x3, 0x1012, 0xffffffff, 0, 0, 0) = 0xbb900000
24037 1 netpgpkeys close(0x3) = 0
24037 1 netpgpkeys open("/lib/libc.so.12", 0, 0xbfbfe348) = 3
24037 1 netpgpkeys __fstat50(0x3, 0xbfbfe348) = 0
24037 1 netpgpkeys close(0x3) = 0
24037 1 netpgpkeys open("/lib/libc.so.12", 0, 0xbfbfe348) = 3
24037 1 netpgpkeys __fstat50(0x3, 0xbfbfe348) = 0
24037 1 netpgpkeys close(0x3) = 0
24037 1 netpgpkeys open("/lib/libc.so.12", 0, 0xbfbfe348) = 3
24037 1 netpgpkeys __fstat50(0x3, 0xbfbfe348) = 0
24037 1 netpgpkeys close(0x3) = 0
24037 1 netpgpkeys __sysctl(0xbfbfea78, 0x2, 0xbba0e5a0, 0xbfbfea80, 0, 0) = 0
24037 1 netpgpkeys __sysctl(0xbfbfe138, 0x2, 0xbba08b18, 0xbfbfe140, 0, 0) = 0
24037 1 netpgpkeys __sysctl(0xbfbfe078, 0x2, 0xbba0f4c0, 0xbfbfe080, 0, 0) = 0
24037 1 netpgpkeys readlink("/etc/malloc.conf", 0xbfbfe145, 0x400) Err#2 ENOENT
24037 1 netpgpkeys break(0x8100000) = 0
24037 1 netpgpkeys mmap(0, 0x100000, 0x3, 0x14001002, 0xffffffff, 0, 0, 0) = 0xbb700000
24037 1 netpgpkeys __stat50("/home/jruoho/.gnupg", 0xbfbfe15c) = 0
24037 1 netpgpkeys setrlimit(0x4, 0xbfbfe158) = 0
24037 1 netpgpkeys open("/home/jruoho/.gnupg/gpg.conf", 0, 0x1b6) = 3
24037 1 netpgpkeys __fstat50(0x3, 0xbfbfdee0) = 0
24037 1 netpgpkeys read(0x3, 0xbb70b000, 0x4000) = 9183
"# Options for GnuPG\n# Copyright 1998, 1999, 2000, 2001, 2002, 2003 F"
24037 1 netpgpkeys read(0x3, 0xbb70b000, 0x4000) = 0
""
24037 1 netpgpkeys close(0x3) = 0
24037 1 netpgpkeys open("/home/jruoho/.gnupg/pubring.gpg", 0, 0x1) = 3
24037 1 netpgpkeys __fstat50(0x3, 0xbfbfdb30) = 0
24037 1 netpgpkeys mmap(0, 0x4b30, 0x1, 0x2, 0x3, 0, 0, 0) = 0xbb8f5000
24037 1 netpgpkeys close(0x3) = 0
24037 1 netpgpkeys munmap(0xbb8f5000, 0x4b30) = 0
24037 1 netpgpkeys close(0x3) Err#9 EBADF
24037 1 netpgpkeys open("/home/jruoho/.gnupg/secring.gpg", 0, 0x1) = 3
24037 1 netpgpkeys __fstat50(0x3, 0xbfbfdb30) = 0
24037 1 netpgpkeys mmap(0, 0x1571, 0x1, 0x2, 0x3, 0, 0, 0) = 0xbb8f8000
24037 1 netpgpkeys close(0x3) = 0
24037 1 netpgpkeys munmap(0xbb8f8000, 0x1571) = 0
24037 1 netpgpkeys close(0x3) Err#9 EBADF
24037 1 netpgpkeys SIGSEGV SIG_DFL
From: "Arnaud Ysmal" <stacktic@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/42435 CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Date: Sun, 31 Oct 2010 19:45:54 +0000
Module Name: src
Committed By: stacktic
Date: Sun Oct 31 19:45:53 UTC 2010
Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c netpgp.c
Log Message:
PR/42435 : Check pointers against NULL to avoid dereferencing them
To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 \
src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c
cvs rdiff -u -r1.77 -r1.78 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: stacktic@NetBSD.org
State-Changed-When: Sun, 31 Oct 2010 19:54:33 +0000
State-Changed-Why:
Fixed
State-Changed-From-To: feedback->closed
State-Changed-By: agc@NetBSD.org
State-Changed-When: Sun, 05 Dec 2010 07:09:34 +0000
State-Changed-Why:
stacktic kindly committed the fix - thanks!
this is a feedback timeout - if the problem re-appears, the PR
can be re-opened.
thanks for the PR!
best,
alistair
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.