HomeFreeBSD

ktrace: Avoid recursion in namei()

Description

ktrace: Avoid recursion in namei()

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.

Also make the parameter to ktrnamei() const and convert to ANSI.

Reported by: syzbot+d0a4de45e58d3c08af4b@syzkaller.appspotmail.com
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30340

Details

Provenance
markjAuthored on May 22 2021, 4:07 PM
Reviewer
kib
Differential Revision
D30340: ktrace: Avoid recursion in namei()
Parents
rGe67ef6ce667d: libkvm: Fix build after removeal of p_tracevp
Branches
Unknown
Tags
Unknown