Page MenuHomeFreeBSD

ktrace: Avoid recursion in namei()
ClosedPublic

Authored by markj on May 18 2021, 8:50 PM.
Tags
None
Referenced Files
F163873256: D30340.id89449.diff
Sun, Jul 26, 7:11 PM
F163872640: D30340.id89661.diff
Sun, Jul 26, 7:09 PM
F163872304: D30340.diff
Sun, Jul 26, 7:06 PM
Unknown Object (File)
Sun, Jul 19, 10:44 PM
Unknown Object (File)
Tue, Jun 30, 8:06 PM
Unknown Object (File)
Jun 22 2026, 8:08 PM
Unknown Object (File)
Jun 12 2026, 10:13 AM
Unknown Object (File)
May 13 2026, 2:44 PM
Subscribers

Details

Summary

I tried fuzzing ktrace(2) with syzkaller and it found the following bug:
sys_ktrace() calls namei(), which may call ktrnamei(). But sys_ktrace()
also calls ktrace_enter() first, so if the caller is itself being
traced, the assertion in ktrace_enter() is triggered. And, ktrnamei()
does not check for recursion like most other ktrace ops do.

Fix the bug by simply deferring the ktrace_enter() call. I believe it
is safe to perform name resolution from sys_ktrace() even when traced.
Also make the parameter to ktrnamei() const and convert to ANSI.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 39281
Build 36170: arc lint + arc unit