Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1365156 - Race condition when creating /var/log/sudo-io directory
Summary: Race condition when creating /var/log/sudo-io directory
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sudo
Version: 6.8
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Tomas Sykora
QA Contact: Patrik Kis
Depends On:
TreeView+ depends on / blocked
Reported: 2016-08-08 13:47 UTC by Ming Davies
Modified: 2018-09-13 05:51 UTC (History)
4 users (show)

Fixed In Version: sudo-1.8.6p3-26.el6
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1410086 (view as bug list)
Last Closed: 2017-03-21 11:02:15 UTC
Target Upstream Version:

Attachments (Terms of Use)
proposed patch (deleted)
2016-10-07 13:55 UTC, Tomas Sykora
no flags Details | Diff

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:0704 normal SHIPPED_LIVE sudo bug fix update 2017-03-21 12:40:12 UTC

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/ 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/ 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):

How reproducible:

Steps to Reproduce:

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.

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?

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