HomeFreeBSD

tty: delete knotes when TTY is revoked

Description

tty: delete knotes when TTY is revoked

Do not clear knotes from the TTY until it gets dealloc'ed, unless the
TTY is being revoked, in that case delete the knotes when closed is
called on the TTY.

When knotes are cleared from a knlist, those knotes become detached from
the knlist. And when an event is triggered on a detached knote there
isn't an associated knlist and therefore no lock will be taken when the
event is triggered.

This becomes a problem when a detached knote is triggered on a TTY since
the mutex for a TTY is also used as the lock for its knlists. This
scenario ends up calling the TTY event handlers without the TTY lock
being held and tripping on asserts in the event handlers.

PR: 272151
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D41605

(cherry picked from commit acd5638e268a6706f6b7ad84947a8425e8d51ef7)

Details

Provenance
rewAuthored on Dec 19 2023, 12:40 AM
markjCommitted on Oct 10 2024, 8:28 PM
Reviewer
kib
Differential Revision
D41605: tty: delete knotes when TTY is revoked
Parents
rGcde4ab289dfc: flua: Add wrappers for sys/utsname.h
Branches
Unknown
Tags
Unknown