Bug 1010

Summary: sporadic errors, sudo: unable to write to I/O log file: A file or directory in the path name does not exist.
Product: Sudo Reporter: gokoyev
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED WORKSFORME    
Severity: high    
Priority: low    
Version: 1.9.5   
Hardware: IBM   
OS: AIX   

Description gokoyev 2021-11-22 10:41:37 MST
Since upgrading to v. 1.9.5p2 from 1.8.31 users are getting random IO log file errors and unable to sudo:

sudo: unable to write to I/O log file: A file or directory in the path name does not exist.
sudo: error initializing I/O plugin sudoers_io


In the debug log I see this

..
ov 22 12:17:10 sudo[14418242] mkdir /var, mode 0700, uid 0, gid 0 @ sudo_mkdir_parents_v1() ./mkdir_parents.c:63
Nov 22 12:17:10 sudo[14418242] mkdir /var/log, mode 0700, uid 0, gid 0 @ sudo_mkdir_parents_v1() ./mkdir_parents.c:63
Nov 22 12:17:10 sudo[14418242] mkdir /var/log/sudo-io, mode 0700, uid 0, gid 0 @ sudo_mkdir_parents_v1() ./mkdir_parents.c:63
Nov 22 12:17:10 sudo[14418242] mkdir /var/log/sudo-io/00, mode 0700, uid 0, gid 0 @ sudo_mkdir_parents_v1() ./mkdir_parents.c:63
Nov 22 12:17:10 sudo[14418242] mkdir /var/log/sudo-io/00/17, mode 0700, uid 0, gid 0 @ sudo_mkdir_parents_v1() ./mkdir_parents.c:63
Nov 22 12:17:10 sudo[14418242] <- sudo_mkdir_parents_v1 @ ./mkdir_parents.c:106 := true
Nov 22 12:17:10 sudo[14418242] mkdir /var/log/sudo-io/00/17/MJ, mode 0700 @ iolog_mkdirs() ./iolog_fileio.c:175
Nov 22 12:17:10 sudo[14418242] <- iolog_mkdirs @ ./iolog_fileio.c:204 := true
Nov 22 12:17:10 sudo[14418242] iolog path /var/log/sudo-io/00/17/MJ @ iolog_mkpath() ./iolog_fileio.c:545
Nov 22 12:17:10 sudo[14418242] <- iolog_mkpath @ ./iolog_fileio.c:547 := true
Nov 22 12:17:10 sudo[14418242] -> iolog_openat @ ./iolog_fileio.c:387
Nov 22 12:17:10 sudo[14418242] <- iolog_openat @ ./iolog_fileio.c:420 := 8
Nov 22 12:17:10 sudo[14418242] -> iolog_write_info_file @ ./iolog_fileio.c:1016
Nov 22 12:17:10 sudo[14418242] -> iolog_write_info_file_legacy @ ./iolog_fileio.c:895
Nov 22 12:17:10 sudo[14418242] -> iolog_openat @ ./iolog_fileio.c:387
Nov 22 12:17:10 sudo[14418242] <- iolog_openat @ ./iolog_fileio.c:420 := -1
Nov 22 12:17:10 sudo[14418242] unable to open /var/log/sudo-io/00/17/MJ/log: A file or directory in the path name does not exist. @ iolog_write_info_file_legacy() ./iolog_fileio.c:900
Nov 22 12:17:10 sudo[14418242] <- iolog_write_info_file_legacy @ ./iolog_fileio.c:903 := false


I also see the zero size log file created in the specified path:

ls -al var/log/sudo-io/00/17/MJ/log
-rw-------    1 root     staff             0 Nov 22 12:17 var/log/sudo-io/00/17/MJ/log


The error comes and goes and does not always happen to all users.
Comment 1 Todd C. Miller 2022-01-07 12:55:48 MST
What version of AIX are you running?  It looks like the openat() function is failing.  I see that openat() was introduced in AIX 7.1 so perhaps there are still bugs in the implementation.

One option would be to tell configure that openat() is not available and see if that makes a difference.  You can do this by passing "ac_cv_func_openat=no" to the configure script.

As far as I can tell this is not a bug in sudo itself.
Comment 2 gokoyev 2022-01-07 13:41:28 MST
(In reply to Todd C. Miller from comment #1)
> What version of AIX are you running?  It looks like the openat()
> function is failing.  I see that openat() was introduced in AIX 7.1
> so perhaps there are still bugs in the implementation.

running AIX v7.2 TL4

I was able to upgrade to the pre-built rpm binary for sudo 1.9.8 and it does not seem to have this issue anymore.  I'm not sure if it was compiled with  different flags from 1.9.5.