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
Unknown Object (File)
Thu, Mar 21, 3:40 AM
Unknown Object (File)
Jan 25 2024, 6:15 AM
Unknown Object (File)
Jan 25 2024, 6:15 AM
Unknown Object (File)
Jan 16 2024, 5:14 AM
Unknown Object (File)
Dec 20 2023, 7:14 AM
Unknown Object (File)
Dec 12 2023, 12:31 PM
Unknown Object (File)
Dec 12 2023, 2:15 AM
Unknown Object (File)
Nov 23 2023, 4:58 PM

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