Repository navigation
Conversation
088b927 to
a9d5955
Compare
|
I think this could be raced. No well parent-held fd and the path could be called relatively containing a |
a9d5955 to
5074f19
Compare
|
@kkrrz test please. |
|
@seks99x Released 3.5.2 fails on these commands with Note: in my local build, configure did not define Thanks for the fix! |
|
Thanks for testing! |
On Android, intermediate FUSE mount roots such as /storage/emulated fail fstatat(AT_SYMLINK_NOFOLLOW) with ENOENT (via vfs_getattr) even though their VFS dentry exists and resolves during path traversal. When an intermediate component (is_last == 0) in ona_open() fails fstatat() with ENOENT, fall back to opening the single component directly via openat(dfd, comp, dir_traverse_flags | O_NOFOLLOW). Because O_PATH | O_DIRECTORY | O_NOFOLLOW pins the VFS directory dentry without invoking vfs_getattr(), it traverses un-stat-able intermediate mount points while preserving atomic single-component O_NOFOLLOW/O_DIRECTORY checks, abspath tracking, and confinement.
62b98a9 to
0da0cbe
Compare
Fixes #1170
On Android (and certain FUSE/container mount setups), intermediate directories like
/storage/emulatedfailfstatat(AT_SYMLINK_NOFOLLOW)withENOENT(viavfs_getattr) even though their VFS dentry exists and resolves during normal kernel path traversal (link_path_walk). Becauseona_open()stats each component one by one before opening it, paths traversing/storage/emulated/0fail prematurely withENOENT.Fix
When an intermediate component (
!is_last) inona_open()failsfstatat()withENOENT, fall back to opening that single component directly viaopenat(dfd, comp, dir_traverse_flags | O_NOFOLLOW):dir_traverse_flags(O_PATH | O_DIRECTORYon Linux) successfully holds the directory fd for traversal even whenfstatat()fails on the intermediate mount root.*at()operation strictly single-component (compnever contains a'/'), preserving atomicO_NOFOLLOWandO_DIRECTORYenforcement with zero TOCTOU window.abspathviaabspath_step()and enforces--confine-root/ daemon confinement viaabspath_outside_confinement().Testing
testsuite/unstatable-intermediate-dir_test.pycompiles a small LinuxLD_PRELOADinterposer (fake_android_fuse.so) that returnsENOENTonfstatatfor bare"emulated"or"*/emulated"while allowingopenat()traversal through to"0":emulated/0/Documents), leaf paths (emulated/0), relative./walks, and trusted symlinks (/sdcard -> .../storage/emulated/0)."emulated"still fail withENOENT, and that--files-from(the only one currently enforcing confinement here;src/destconfinement is fixed in Enforce --confine-root on destination/source paths and update confinement tests #1169) symlink escapes under--confine-roottraverse"emulated/0"and fail withELOOP(notENOENT).