Allan Hessenflow commented: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5411#note_139115


With additional testing I can now explain the spintrcritical24 failures I've 
seen and the patch above that adds the atomic test and set of LIBIO_FLAGS_FREE 
in rtems_libio_free_iop outside the semaphore protected section is a correct 
fix for that as well as for newlib01.

In spintrcritical24 fcntl() is called from inside an interrupt on a file 
descriptor that is being closed from a normal task at approximately the same 
time. The close() results in rtems_libio_free_iop() being called. If the 
interrupt occurs inside that function after the test for LIBIO_FLAGS_FREE and 
before that flag is set then the free occurs twice on the same descriptor, 
messing up the free list. If the function that takes the mutex returns some 
error when called from an interrupt context, checking for that and not 
proceeding would also work to handle this case but not the newlib01() case.

The newlib01() test is similar in that it causes rtems_libio_free_iop() to be 
called at a point in the exit() process when semaphores can no longer be taken.

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5411#note_139115
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to