Bug #48202
closedlibcephfs allows calling ftruncate on a file open read-only
0%
Description
When calling ceph_ftruncate on an "fd" open read only, using the O_RDONLY flag, libcephfs does not return and error and instead truncates the file. Compare this to the typical libc/linux ftruncate call which will return an error when the fd is not open for writing.
To reproduce I am attaching a simple c file that first "touches" the file (to ensure it exists) and then opens it read only and then demonstrates that truncate "succeeds" but a subsequent write fails. In comparison I attach a c file with system calls that demonstrates that ftruncate fails before reaching the write call.
I originally discovered this issue while wrapping APIs for go-ceph, but wrote the C versions to ensure this issue was, in fact, present in the libcephs layer.
Please let me know if I can provide any other information.
Files
Updated by Patrick Donnelly over 3 years ago
- Status changed from New to In Progress
- Assignee set to Patrick Donnelly
- Target version set to v16.0.0
- Source set to Community (dev)
- Backport set to octopus,nautilus
Updated by Patrick Donnelly over 3 years ago
- Status changed from In Progress to Fix Under Review
- Pull request ID set to 38031
Updated by Patrick Donnelly over 3 years ago
- Status changed from Fix Under Review to Pending Backport
Updated by Nathan Cutler over 3 years ago
- Copied to Backport #48375: octopus: libcephfs allows calling ftruncate on a file open read-only added
Updated by Nathan Cutler over 3 years ago
- Copied to Backport #48376: nautilus: libcephfs allows calling ftruncate on a file open read-only added
Updated by Nathan Cutler about 3 years ago
- Status changed from Pending Backport to Resolved
While running with --resolve-parent, the script "backport-create-issue" noticed that all backports of this issue are in status "Resolved" or "Rejected".