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
Contributor

The POSIX arch_open macro passed the Windows-style share flag as the mode argument of open(2) and ignored the 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.

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; 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.

@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
Contributor Author

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

Removed the comment.

@matejk
matejk force-pushed the fix/file-backend-permissions branch from 2c2c337 to f2a5f9b Compare June 17, 2026 20:35
@matejk
matejk force-pushed the fix/file-backend-permissions branch from f2a5f9b to f1185cd Compare July 3, 2026 22:01
@matejk

matejk commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Done, the comment is removed; only the single-line change remains.

@matejk
matejk requested a review from Piloalucard July 3, 2026 22:47

@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.

Thanks for this! LGTM

@matejk
matejk force-pushed the fix/file-backend-permissions branch from f1185cd to 88ee075 Compare August 17, 2026 20:10
@matejk
matejk changed the base branch from main to release/v2.4.9.0 August 17, 2026 20:10
@matejk
matejk changed the base branch from release/v2.4.9.0 to main August 17, 2026 20:11
The share flag was passed as the mode, so the file backend created 0200
files that a non-root user could not reopen.
@matejk
matejk force-pushed the fix/file-backend-permissions branch 2 times, most recently from 05090b7 to e05e485 Compare August 17, 2026 20:28
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