LibBSD | freebsd/sys_generic: Prevent multiple FD mappings (!66)
Kinsey Moore (@opticron)
gitlab at rtems.org
Wed May 21 19:22:48 UTC 2025
Kinsey Moore created a merge request: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/66
Project:Branches: opticron/rtems-libbsd:main-fix-selfd-handling to rtems/pkg/rtems-libbsd:main
Author: Kinsey Moore
Assignee: Kinsey Moore
## Summary
freebsd/sys_generic: Prevent multiple FD mappings
When the selscan() and selrescan() functions were modified for use with
RTEMS, the already-mapped FD was stored in selfd->sf_cookie by selscan()
contrary to the modified behavior of pollscan() which stores an unmapped
FD (wrapped inside a struct) in sf_cookie. This stored mapped FD was
then mapped again into libbsd FD space in selrescan() which resulted in
EBADF since there was no open FD in the lower range that libbsd FD space
FDs typically occupy compared to RTEMS FD space.
The fix is to only store unmapped FDs into selfd->sf_cookie by passing
the unmapped FD into selfdalloc() instead of the already-mapped FD.
<!-- Default settings, if it is a dropdown it will set after submission -->
--
View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/66
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/20250521/c22c766e/attachment.htm>
More information about the bugs
mailing list