Bug 695018 - PEM module's segfaults on debug builds when logging file was created by root
PEM module's segfaults on debug builds when logging file was created by root
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: nss (Show other bugs)
6.1
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Elio Maldonado Batiz
BaseOS QE Security Team
:
Depends On: 695011
Blocks:
  Show dependency treegraph
 
Reported: 2011-04-09 15:36 EDT by Elio Maldonado Batiz
Modified: 2013-06-11 12:26 EDT (History)
7 users (show)

See Also:
Fixed In Version: nss-3.12.10-3.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 695011
Environment:
Last Closed: 2011-12-06 07:10:33 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Elio Maldonado Batiz 2011-04-09 15:36:15 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 info:

--- Additional comment from emaldona@redhat.com on 2011-04-09 14:27:42 EDT ---

The PEM module's initialization function pem_Initialize we has
....
    open_log(); 
    plog("pem_Initialize\n");
....
Looing is implemented in util.c with
FILE *plogfile;
void open_log()
{
#ifdef DEBUG
    plogfile = fopen("/tmp/pkcs11.log", "a");
#endif

    return;
}
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 emaldona@redhat.com on 2011-04-09 15:30:36 EDT ---

Created attachment 490990 [details]
Reimplement PEM logging in terms of NSPR's own
Comment 2 Elio Maldonado Batiz 2011-04-09 15:43:48 EDT
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
this.
Comment 3 RHEL Product and Program Management 2011-04-10 02:00:11 EDT
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.
Comment 10 errata-xmlrpc 2011-12-06 07:10:33 EST
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.

http://rhn.redhat.com/errata/RHBA-2011-1584.html

Note You need to log in before you can comment on or make changes to this bug.