Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1365156

Summary: Race condition when creating /var/log/sudo-io directory
Product: Red Hat Enterprise Linux 6 Reporter: Ming Davies <minyu>
Component: sudoAssignee: Tomas Sykora <tosykora>
Status: CLOSED ERRATA QA Contact: Patrik Kis <pkis>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.8CC: mahajanajay33, pkis, pvrabec, tosykora
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sudo-1.8.6p3-26.el6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1410086 (view as bug list) Environment:
Last Closed: 2017-03-21 11:02:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
proposed patch none

Description Ming Davies 2016-08-08 13:47:41 UTC
Description of problem:
Customer said that when enabling sudo I/O logging the first commands executed at the same time fails with message "unable to mkdir", i.e. 

Aug  6 20:00:09 <HOSTNAME> sudo:   e6oper : unable to mkdir /var/log/sudo-io : File exists ; TTY=unknown ; PWD=/home/xxx ; USER=root ; COMMAND=/bin/su - ftpzpa --session-command -C /local/adapter/sstpat/tools/KACONSAP_I_01.sh Stop ProcessDown
Aug  6 20:00:09 <HOSTNAME> sudo:   e6oper : TTY=unknown ; PWD=/home/xxxx ; USER=root ; TSID=000001 ; COMMAND=/bin/su - ftpzpa --session-command -C /local/adapter/sstpat/tools/ECONSAP_I_01.sh Stop ProcessDown


Based on the source code, two processes possibility getting to the following point at the same time:

       if (stat(path, &sb) != 0) {
            if (mkdir(path, S_IRWXU) != 0)
                log_fatal(USE_ERRNO, _("unable to mkdir %s"), path);

(taken from plugins/sudoers/iolog.c).

Both processes verify that the directory doesn't exist, 1st process create the directory, the second process mkdir fails.


Version-Release number of selected component (if applicable):
sudo-1.8.6p3-24.el6.x86_64

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 3 Tomas Sykora 2016-10-07 13:55:46 UTC
Created attachment 1208161 [details]
proposed patch

Comment 7 errata-xmlrpc 2017-03-21 11:02:15 UTC
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.

https://rhn.redhat.com/errata/RHBA-2017-0704.html

Comment 8 Ajaykumar 2018-09-13 05:51:36 UTC
> Steps to Reproduce:
> 1.
> 2.
> 3.
> 

Can you please share the steps to reproduce this issue?