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
F85224014: D34128.id102237.diff
Mon, Jun 3, 8:19 AM
F85224012: D34128.id102220.diff
Mon, Jun 3, 8:19 AM
Unknown Object (File)
Thu, May 23, 10:44 PM
Unknown Object (File)
Tue, May 21, 7:26 PM
Unknown Object (File)
Sun, May 19, 6:01 PM
Unknown Object (File)
Apr 29 2024, 12:19 AM
Unknown Object (File)
Apr 26 2024, 5:28 PM
Unknown Object (File)
Apr 26 2024, 2:49 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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 44225
Build 41113: arc lint + arc unit

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

"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

"emulated" isn't quite right

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

54–55

Oops this comment was stuck as a draft