Skip to content

Fix file permissions passed to open(2) by the POSIX arch_open#612

Open
matejk wants to merge 1 commit into
LinearTapeFileSystem:mainfrom
matejk:fix/file-backend-permissions
Open

Fix file permissions passed to open(2) by the POSIX arch_open#612
matejk wants to merge 1 commit into
LinearTapeFileSystem:mainfrom
matejk:fix/file-backend-permissions

Conversation

@matejk

@matejk matejk commented Jun 12, 2026

Copy link
Copy Markdown

The POSIX arch_open macro passed the Windows-style share flag as the mode argument of open(2) and ignored the actual permission argument. Files created by the file tape backend get mode 0200 (write-only), so a non-root user cannot reopen records it has just written; mounting a freshly formatted file-backend volume fails with EDEV_RW_PERM. Running as root masks the problem.

One commit, 4 lines. Prerequisite for the integration test suite (#611), which formats and mounts file-backend volumes as a regular user; #611 carries a duplicate of this commit so its CI is green standalone — git drops the duplicate whichever merges first.

@Piloalucard Piloalucard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hello @matejk Thank for the contribution and for the catch!
Indeed unused parameter of the macro was mistakenly setted, unused parameter should be the share_flg, not perm flag.
Change is overall good! But I do not think we need the comments added, single line change is enough.

The POSIX arch_open macro passed the Windows-style share flag as the
mode argument of open(2) and ignored the actual permission argument.
Files created by the file tape backend got mode 0200 (write-only), so
a non-root user could not reopen records it had just written; mounting
a freshly formatted file-backend volume failed with EDEV_RW_PERM.
Running as root masked the problem.
@matejk matejk force-pushed the fix/file-backend-permissions branch from 8dbd641 to 2c2c337 Compare June 13, 2026 07:01
@matejk

matejk commented Jun 13, 2026

Copy link
Copy Markdown
Author

Change is overall good! But I do not think we need the comments added, single line change is enough.

Removed the comment.

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.

2 participants