RTEMS | open: Race condition when called with O_TRUNC (#5109)
Loris Nardo (@loris.nardo)
gitlab at rtems.org
Thu Aug 8 05:13:52 UTC 2024
Loris Nardo created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5109
## Summary
Checking the code of `open`, I noticed that when `O_TRUNC` is passed, the iop flag is updated to include `LIBIO_FLAGS_OPEN` and then ftruncate is called on the file descriptor of the iop.
In doing so, there is a small time window in which the file descriptor can be accessed by other threads and can perform some operation on the file before the truncate has been completed or even started.
## Steps to reproduce
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5109
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20240808/fc6fa57d/attachment.htm>
More information about the bugs
mailing list