Page MenuHomeFreeBSD

filemon: Reject FILEMON_SET_FD commands when the fd is a kqueue
ClosedPublic

Authored by markj on Feb 1 2022, 2:59 PM.
Tags
None
Referenced Files
F84279934: D34128.id.diff
Tue, May 21, 7:26 PM
Unknown Object (File)
Sun, May 19, 6:01 PM
Unknown Object (File)
Mon, Apr 29, 12:19 AM
Unknown Object (File)
Fri, Apr 26, 5:28 PM
Unknown Object (File)
Fri, Apr 26, 2:49 PM
Unknown Object (File)
Mar 31 2024, 1:10 AM
Unknown Object (File)
Mar 31 2024, 1:10 AM
Unknown Object (File)
Mar 21 2024, 3:40 AM

Details

Summary

When FILEMON_SET_FD is used, the filemon handle effectively wraps the
passed file. In particular, the handle may be inherited by a child
process, or transferred over a unix domain socket, so we must verify
that the backing file permits this.

Reported by: syzbot+36e6be9e02735fe66ca8@syzkaller.appspotmail.com

Diff Detail

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

Event Timeline

markj requested review of this revision.Feb 1 2022, 2:59 PM

Looks reasonable. filemon.4 needs an update too?

Document EINVAL and EBADF.

Besides that unrelated nit, the manual page language LGTM. Can't speak to consistency with the code change.

share/man/man4/filemon.4
54–55 ↗(On Diff #102220)

"binaries using an emulated ABI" maybe? Neither "of" and "foreign" look quite right.

markj marked an inline comment as done.

Unrelated fixups. Change "will" to "may" since filemon does at least
hook compat32 system calls.

debdrup added a subscriber: debdrup.

Manual page changes look good to me, can't comment on the code.

This revision is now accepted and ready to land.Feb 2 2022, 8:01 AM
emaste added inline comments.
share/man/man4/filemon.4
54–55 ↗(On Diff #102220)

"emulated" isn't quite right

Possibly "non-native" or "non-FreeBSD" ABIs

54–55 ↗(On Diff #102220)

Oops this comment was stuck as a draft