HomeFreeBSD

tty: gracefully handle proctree_lock locking

Description

tty: gracefully handle proctree_lock locking

Instead of relocking tty to get the proctree_lock and experiencing the
race due to the relock, take the proctree_lock in advance for ioctl
commands that need it. The affected commands, TIOCNOTTY, TIOCSCTTY,
and TIOCSPGRP, must not be overridden by the specific tty drivers,
so the common handling is cleaner.

Reviewed by: kevans (previous version), markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D59132

Details

Provenance
kibAuthored on Aug 23 2026, 8:53 PM
Reviewer
kevans
Differential Revision
Restricted Differential Revision
Parents
rG824f934bf9d5: tty: make tty_wait_background() aware of proctree_lock ownership
Branches
Unknown
Tags
Unknown