[Pkg-shadow-devel] useradd durability improvement

Cat Zimmermann cat.zimmermann at crowdstrike.com
Tue Mar 8 17:37:44 UTC 2016


Hello Serge and others on Pkg-shadow-devel,

I believe the useradd utility is missing an fsync on the /etc directory itself to ensure durability after each rename.

Below is strace output on RHEL7 and Ubuntu 14.04.3.

Cheers,
Cat Zimmermann

$ strace -y useradd -M fakeuser 2>&1 | grep /etc | grep "rename\|fsync”

fsync(11</etc/passwd->)                 = 0
fsync(4</etc/passwd+>)                  = 0
rename("/etc/passwd+", "/etc/passwd")   = 0
fsync(4</etc/shadow->)                  = 0
fsync(4</etc/shadow+>)                  = 0
rename("/etc/shadow+", "/etc/shadow")   = 0
fsync(4</etc/group->)                   = 0
fsync(4</etc/group+>)                   = 0
rename("/etc/group+", "/etc/group")     = 0
fsync(4</etc/gshadow->)                 = 0
fsync(4</etc/gshadow+>)                 = 0
rename("/etc/gshadow+", "/etc/gshadow") = 0
fsync(4</etc/subuid->)                  = 0
fsync(4</etc/subuid+>)                  = 0
rename("/etc/subuid+", "/etc/subuid")   = 0
fsync(4</etc/subgid->)                  = 0
fsync(4</etc/subgid+>)                  = 0
rename("/etc/subgid+", "/etc/subgid")   = 0

$ done.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-shadow-devel/attachments/20160308/a74e64be/attachment.html>


More information about the Pkg-shadow-devel mailing list