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)
Wed, Dec 18, 4:20 AM
Unknown Object (File)
Nov 23 2024, 2:11 PM
Unknown Object (File)
Nov 23 2024, 11:58 AM
Unknown Object (File)
Nov 23 2024, 2:59 AM
Unknown Object (File)
Nov 22 2024, 11:01 PM
Unknown Object (File)
Nov 21 2024, 11:21 PM
Unknown Object (File)
Nov 13 2024, 6:55 AM
Unknown Object (File)
Oct 31 2024, 6:28 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