Skip to content

Dangling Symlink Resolution and Missing sync_file_range and syncfs System Calls#110

Open
doanbaotrung wants to merge 1 commit into
sysprog21:mainfrom
open-sources-port:sync_file_range
Open

Dangling Symlink Resolution and Missing sync_file_range and syncfs System Calls#110
doanbaotrung wants to merge 1 commit into
sysprog21:mainfrom
open-sources-port:sync_file_range

Conversation

@doanbaotrung

@doanbaotrung doanbaotrung commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

the sys_renameat2 and sys_linkat system calls
were using the resolving PATH_TR_NONE translation
mode for the source paths.
This caused elfuse to follow the symlink
leaf names to their targets, causing
dangling symlinks during package extraction
to fail with ENOENT (No such file or directory).
We updated these to use PATH_TR_NOFOLLOW for
the leaf components, preventing path resolution
from walking past the symlink itself.

Missing sync_file_range and syncfs System
Calls: We registered and defined
SYS_sync_file_range (84) and
SYS_syncfs (267) in abi.h and dispatch.tbl,
and implemented them in syscall.c as
aliases of sc_fsync_common.


Summary by cubic

Fixes dangling symlink handling in rename/link to avoid ENOENT during package extraction and implements shims for SYS_sync_file_range (84) and SYS_syncfs (267) to avoid ENOSYS.

  • Bug Fixes

    • renameat2 and linkat stop following leaf symlinks using PATH_TR_NOFOLLOW; linkat honors AT_SYMLINK_FOLLOW on the source. New paths use PATH_TR_CREATE | PATH_TR_NOFOLLOW.
  • New Features

    • Registered SYS_sync_file_range and SYS_syncfs in abi.h/dispatch.tbl. sync_file_range validates flags, returns immediately for WRITE-only, and uses fsync(fd) when WAIT flags are set. syncfs opens the fd then calls sync() to flush all filesystems.

Written for commit 23ab75d. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found and verified against the latest diff

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/syscall/syscall.c Outdated
Comment thread src/syscall/syscall.c Outdated
In fs.c, the sys_renameat2 and sys_linkat system
calls were using the resolving PATH_TR_NONE translation
mode for the source paths.

This caused elfuse to follow the symlink
leaf names to their targets, causing
dangling symlinks during package extraction
to fail with ENOENT (No such file or directory).
We updated these to use PATH_TR_NOFOLLOW for
the leaf components, preventing path resolution
from walking past the symlink itself.

Missing sync_file_range and syncfs System
Calls: We registered and defined
SYS_sync_file_range (84) and
SYS_syncfs (267) in abi.h and dispatch.tbl,
and implemented them in syscall.c as
aliases of sc_fsync_common.
Sign up for free to 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.

1 participant