Skip to content

syscall: use O_PATH for directory traversal - #1052

Merged
steadytao merged 3 commits into
RsyncProject:masterfrom
steadytao:fix/termux-destination-chdir
Aug 16, 2026
Merged

syscall: use O_PATH for directory traversal#1052
steadytao merged 3 commits into
RsyncProject:masterfrom
steadytao:fix/termux-destination-chdir

Conversation

@steadytao

Copy link
Copy Markdown
Member

Fixes#1050

Summary

  • use O_PATH for intermediate directory descriptors in the ownership-checked path walk where supported
  • reopen a fully resolved directory with the caller's requested access mode before returning it
  • add regression coverage for destinations below searchable but unreadable directories

Android permits traversal through / to /sdcard but does not permit Termux to open / with O_RDONLY | O_DIRECTORY. The hardened destination walk therefore failed before reaching the destination even though the intermediate directories were searchable.

@steadytao
steadytaoforce-pushed the fix/termux-destination-chdir branch 3 times, most recently from de6b0c7 to 56e37eaCompareAugust 13, 2026 19:32
@p-linnanep-linnane mentioned this pull request Aug 13, 2026
@p-linnane

Copy link
Copy Markdown

Noting that this PR also fixes our Landlock sandboxing issue in Homebrew: Homebrew/homebrew-core#298558

@steadytao

steadytao commented Aug 13, 2026

Copy link
Copy Markdown
MemberAuthor

Ah, yes, it very well would. Thank you.

ribbons added a commit to ribbons/android-rsync that referenced this pull request Aug 14, 2026
Apply 56e37eae66 proposed by tao upstream in RsyncProject/rsync#1052 to
fix a failure when attempting directory traversal.
@steadytao
steadytaoforce-pushed the fix/termux-destination-chdir branch from 56e37ea to ebe13dcCompareAugust 15, 2026 06:21
@steadytao
steadytaoforce-pushed the fix/termux-destination-chdir branch from ebe13dc to 94ff329CompareAugust 15, 2026 06:24
@steadytao
steadytao merged commit 3b1eb8d into RsyncProject:masterAug 16, 2026
9 of 21 checks passed
@steadytao
steadytao deleted the fix/termux-destination-chdir branch August 16, 2026 11:52
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3.5.0 fails under termux

2 participants

@steadytao@p-linnane