Bug 1410086

Summary: Race condition when creating /var/log/sudo-io directory
Product: Red Hat Enterprise Linux 7 Reporter: Patrik Kis <pkis>
Component: sudoAssignee: Daniel Kopeček <dkopecek>
Status: CLOSED ERRATA QA Contact: Dalibor Pospíšil <dapospis>
Severity: low Docs Contact:
Priority: low    
Version: 7.4CC: dapospis, pkis, tosykora
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1365156 Environment:
Last Closed: 2017-08-01 17:03:40 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:
Bug Depends On: 1360687    
Bug Blocks:    

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