Page MenuHomeFreeBSD

pipe: Avoid calling selrecord() on a closing pipe
ClosedPublic

Authored by markj on Apr 27 2021, 9:33 PM.
Tags
None
Referenced Files
F115933043: D30016.id88278.diff
Wed, Apr 30, 2:17 PM
Unknown Object (File)
Tue, Apr 15, 5:24 PM
Unknown Object (File)
Tue, Apr 1, 4:44 AM
Unknown Object (File)
Mar 15 2025, 4:03 AM
Unknown Object (File)
Mar 4 2025, 10:12 PM
Unknown Object (File)
Feb 25 2025, 4:04 PM
Unknown Object (File)
Feb 25 2025, 3:21 PM
Unknown Object (File)
Feb 25 2025, 1:12 AM
Subscribers

Details

Summary

pipe_poll() may add the calling thread to the selinfo lists of both ends
of a pipe. It is ok to do this for the local end, since we know we hold
a reference on the file and so the local end is not closed. It is not
ok to do this for the remote end, which may already be closed and have
called seldrain(). In this scenario, when the polling thread wakes up,
it may end up referencing a freed selinfo.

Guard the selrecord() call appropriately.

Reported by: syzkaller+KASAN

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable