The tree walking also affects ls:

$ mkdir -p a/b/c
$ strace ls -lhR a
[...]
openat(AT_FDCWD, "./a", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
fstat(4, {st_mode=S_IFDIR|0775, st_size=60, ...}) = 0
newfstatat(AT_FDCWD, "./a", {st_mode=S_IFDIR|0775, st_size=60, ...}, 
AT_SYMLINK_NOFOLLOW) = 0
getdents64(4, 0x5f4fbf019e70 /* 3 entries */, 32768) = 72
getdents64(4, 0x5f4fbf019e70 /* 0 entries */, 32768) = 0
statx(4, "b", AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW, STATX_ALL, 
{stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0775, 
stx_size=60, ...}) = 0
listxattr("b", 0x1, 0)                  = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "./a/b", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5
fstat(5, {st_mode=S_IFDIR|0775, st_size=60, ...}) = 0
newfstatat(AT_FDCWD, "./a/b", {st_mode=S_IFDIR|0775, st_size=60, ...}, 
AT_SYMLINK_NOFOLLOW) = 0
getdents64(5, 0x5f4fbf021eb0 /* 3 entries */, 32768) = 72
getdents64(5, 0x5f4fbf021eb0 /* 0 entries */, 32768) = 0
statx(5, "c", AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW, STATX_ALL, 
{stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0775, 
stx_size=40, ...}) = 0
listxattr("c", 0x1, 0)                  = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "./a/b/c", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 6
fstat(6, {st_mode=S_IFDIR|0775, st_size=40, ...}) = 0
brk(0x5f4fbf052000)                     = 0x5f4fbf052000
newfstatat(AT_FDCWD, "./a/b/c", {st_mode=S_IFDIR|0775, st_size=40, ...}, 
AT_SYMLINK_NOFOLLOW) = 0
getdents64(6, 0x5f4fbf029ef0 /* 2 entries */, 32768) = 48
getdents64(6, 0x5f4fbf029ef0 /* 0 entries */, 32768) = 0
brk(0x5f4fbf04a000)                     = 0x5f4fbf04a000
close(6)                                = 0
newfstatat(AT_FDCWD, "./a/b/c", {st_mode=S_IFDIR|0775, st_size=40, ...}, 
AT_SYMLINK_NOFOLLOW) = 0
brk(0x5f4fbf042000)                     = 0x5f4fbf042000
close(5)                                = 0
newfstatat(AT_FDCWD, "./a/b", {st_mode=S_IFDIR|0775, st_size=60, ...}, 
AT_SYMLINK_NOFOLLOW) = 0
brk(0x5f4fbf03a000)                     = 0x5f4fbf03a000
close(4)                                = 0
newfstatat(AT_FDCWD, "./a", {st_mode=S_IFDIR|0775, st_size=60, ...}, 
AT_SYMLINK_NOFOLLOW) = 0
close(3)                                = 0
write(1, ".:\ntotal 0\ndrwxrwxr-x 3 jak jak "..., 176.:
total 0

It's not clear how the raciness would be unsafe though, there doesn't
seem possible exploits: If you can modify any part of the file path you
can also modify it before or after...

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2111815

Title:
  [MIR] rust-coreutils

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2111815/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to