RTEMS | cpukit/libio: Support close with IOP references held (!516)
Chris Johns (@chris)
gitlab at rtems.org
Wed Jun 25 03:54:16 UTC 2025
Chris Johns commented on a discussion on cpukit/libcsupport/src/libio.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/516#note_125239
> - * Clear everything except the reference count part. At this point in time
> - * there may be still some holders of this file descriptor.
> - */
> - rtems_libio_iop_flags_clear( iop, LIBIO_FLAGS_REFERENCE_INC - 1U );
> - zero = offsetof( rtems_libio_t, offset );
> - memset( (char *) iop + zero, 0, sizeof( *iop ) - zero );
> + rtems_libio_lock();
>
> - /*
> - * Append it to the free list. This increases the likelihood that a use
> - * after close is detected.
> - */
> - *rtems_libio_iop_free_tail = iop;
> - rtems_libio_iop_free_tail = &iop->data1;
> + zero = offsetof( rtems_libio_t, offset );
> + memset( (char *) iop + zero, 0, sizeof( *iop ) - zero );
Explain which bit? I have only moved the existing code and updated the flags related comment.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/516#note_125239
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/20250625/b0de8019/attachment-0001.htm>
More information about the bugs
mailing list