Red Hat Bugzilla – Bug 695018
PEM module's segfaults on debug builds when logging file was created by root
Last modified: 2013-06-11 12:26:30 EDT
+++ This bug was initially created as a clone of Bug #695011 +++
Description of problem: While running debug builds the pem module sometimes crashes while attempting to write to its log file. The problem occurs when the module is used initially by an application being run as root and later by the same or another application running as a regular user.
Version-Release number of selected component (if applicable): nss-3.12.9-14.
How reproducible: often
Steps to Reproduce:
1. Use an application such as crypto-util's genkey untility to generate a self-signed certificate for an apache server or a CA. Such an operation must be run as root.
2. Run a application, e.g. curl, that will gets its cryptographic services by the pem module.
Actual results: The pem module crashes on initialization.
Expected results: The application should complete it's task normally
--- Additional comment from email@example.com on 2011-04-09 14:27:42 EDT ---
The PEM module's initialization function pem_Initialize we has
Looing is implemented in util.c with
plogfile = fopen("/tmp/pkcs11.log", "a");
The fopen tries to open the log file to write to it. If the log file was initilially created by an application running as root fopen will fail and plogfile will be set to NULL. Later plog calls
vfprintf(plogfile, fmt, ap);
with a NULL and a crash happens.
Using the logging utilities from NSPR will prevent this problems. It is also what's required of modules intended to be part of NSS as this one is.
--- Additional comment from firstname.lastname@example.org on 2011-04-09 15:30:36 EDT ---
Created attachment 490990 [details]
Reimplement PEM logging in terms of NSPR's own
Normal users using standard builds will not run into this problem because
logging is compiled out. On the other hand, developers or users to whom we may
provide an NSS debug build to aid us with a bug investigation could run into
Since RHEL 6.1 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.
Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.