RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1437706 - glibc corrupting open mode - misc/mntent_r.c:__setmntent()
Summary: glibc corrupting open mode - misc/mntent_r.c:__setmntent()
Keywords:
Status: CLOSED DUPLICATE of bug 1437618
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: glibc
Version: 6.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: glibc team
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-31 00:40 UTC by Manjunath Patil
Modified: 2017-03-31 21:09 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-31 01:22:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Manjunath Patil 2017-03-31 00:40:22 UTC
Description of problem:
The glibc-rh1012343.patch which was included in glibc-2.12-1.208.el6
introduced a possible corruption window. Following is the change added
by the glibc-rh1012343.patch -

95     char newmode[modelen + 2];
96  -  memcpy (mempcpy (newmode, mode, modelen), "c", 2);
97  +  memcpy (mempcpy (newmode, mode, modelen), "ce", 2);
98     FILE *result = fopen (file, newmode);

Here the patch added a new character to newmode, without increasing the
size of newmode. As a result, the newmode will not have a null character
at the end. The fopen expecting newmode to be string, could end up
reading more character than it should be.

Version-Release number of selected component (if applicable):
glibc-2.12-1.208.el6

How reproducible:
Doing a start and shutdown-abort of oracle database in a loop for over 100 times with NFS storage triggers this issue intermittently.

A simple test-case to reproduce this issue is on the way.

Steps to Reproduce:
1. configure oracle database with NFS storage
2. start database
3. shutdown abort database [ non-graceful termination]
4. repeat 2 and 3 in a loop for about 100 times
5. You will see database start failing with EACCES error
[ EACCES was due to corruption of open mode. In this case, open mode "r" (in source file) was converted to "rw" (in strace output)]

Additional info:
This issue is fixed in mainline -
[... glibc.git.mainline]# git blame misc/mntent_r.c | grep newmode
312be3f9 (Ulrich Drepper        2011-11-15 04:24:42 -0500  41)   char newmode[modelen + 3];
312be3f9 (Ulrich Drepper        2011-11-15 04:24:42 -0500  42)   memcpy (mempcpy (newmode, mode, modelen), "ce", 3);
ee8449f7 (Ulrich Drepper        2003-09-04 08:27:37 +0000  43)   FILE *result = fopen (file, newmode);

[... glibc.git.mainline]# git log -n 1 -p 312be3f9 | head
commit 312be3f9f5eab1643d7dcc7728c76d413d4f2640
Author: Ulrich Drepper <drepper>
Date:   Tue Nov 15 04:24:42 2011 -0500

    Clean up internal fopen uses
   
    No need to ever not use c and e.

[... glibc.git.mainline]# git log -n 1 -p 312be3f9 | grep newmode
-  char newmode[modelen + 2];
-  memcpy (mempcpy (newmode, mode, modelen), "c", 2);
+  char newmode[modelen + 3];
+  memcpy (mempcpy (newmode, mode, modelen), "ce", 3);
   FILE *result = fopen (file, newmode);

Once newmode size is increased to 3, we couldn't reproduce the issue with database test case.

Comment 2 Carlos O'Donell 2017-03-31 01:22:47 UTC
(In reply to Manjunath Patil from comment #0)
> Once newmode size is increased to 3, we couldn't reproduce the issue with
> database test case.

Manjunath,

Thank you very much for reporting this issue.

In bug 1437147 we acknowledge Oracle as the first reporter via their blog post:
https://bugzilla.redhat.com/show_bug.cgi?id=1437147#c2

I'm going to close this bug as a duplicate of the RHEL 6.9 bug 1437618 (RHEL 6.10 bug 1437147), which has already been fixed and will be released shortly in our RHEL 6.9 batch update.

Please note that our own internal audit revealed that 3 functions were not yet correctly covered for cancellation, and they have been fixed in the upcoming update along with the fix in setmntent() for the missing null terminator.

Cheers,
Carlos.

*** This bug has been marked as a duplicate of bug 1437618 ***


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