Dashboardinstitutional-transition-lab_read_regular_file special-file opening

_read_regular_file special-file opening

Category: gotcha
Confidence: 1.00
ID: 01a08491-a9a7-7c48-a328-23268f3fe720
Project ID: 1fa3712f-997f-4884-b7ec-8abb79f9e342
Cross-project: No
Recalled in other projects: 0
Source session: 1ZjgTYcT8eC9K18gr
Created: 2026-09-09 01:25:50
Updated: 2026-09-09 05:08:53

Content

Trap: opening with O_NONBLOCK and then calling fstat() looks safe because it prevents the tested FIFO from blocking, but sockets or devices may block or trigger driver side effects before classification. Fix: classify through a race-resistant path that never performs a readable device open, reject every non-regular object, then read only the bound regular-file descriptor; keep O_NONBLOCK as defense in depth.

Move to: