Bug 1410086 - Race condition when creating /var/log/sudo-io directory
Summary: Race condition when creating /var/log/sudo-io directory
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: sudo
Version: 7.4
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Daniel Kopeček
QA Contact: Dalibor Pospíšil
URL:
Whiteboard:
Depends On: sudo-rhel7.4-rebase
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-04 12:34 UTC by Patrik Kis
Modified: 2017-08-01 17:27 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1365156
Environment:
Last Closed: 2017-08-01 17:03:40 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2017 0 normal SHIPPED_LIVE sudo bug fix and enhancement update 2017-08-01 18:02:36 UTC

Description Patrik Kis 2017-01-04 12:34:30 UTC
The problem seems also exists with RHEL-7 version of sudo. Please consider ot fix it.

+++ This bug was initially created as a clone of Bug #1365156 +++

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.

Comment 1 Tomas Sykora 2017-02-21 10:55:45 UTC
This will be fixed by the rebase in 7.4.

Comment 5 errata-xmlrpc 2017-08-01 17:03:40 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://access.redhat.com/errata/RHBA-2017:2017

Comment 6 errata-xmlrpc 2017-08-01 17:27:35 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://access.redhat.com/errata/RHBA-2017:2017


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