]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
kern: tty: recanonicalize the buffer on ICANON/VEOF/VEOL changes
authorKyle Evans <kevans@FreeBSD.org>
Tue, 16 Jan 2024 02:55:59 +0000 (20:55 -0600)
committerKyle Evans <kevans@FreeBSD.org>
Tue, 16 Jan 2024 02:55:59 +0000 (20:55 -0600)
commit522083ffbd1ab9b485861750e889d606dc75ed0a
treec8a7d8e2ae2d33231275341d6ce4f758a932fd0f
parentd51dac5f1370bdca1ea20c6b48cdea463f6f5dda
kern: tty: recanonicalize the buffer on ICANON/VEOF/VEOL changes

Before this change, we would canonicalize any partial input if the new
local mode is not ICANON, but that's about it.  If we were switching
from -ICANON -> ICANON, or if VEOF/VEOL changes, then our internal canon
accounting would be wrong.

The main consequence of this is that in ICANON mode, we would
potentially hang a read(2) longer if the new VEOF/VEOL appears later in
the buffer, and FIONREAD would be similarly wrong as a result.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D43456
sys/kern/tty.c
sys/kern/tty_inq.c
sys/kern/tty_ttydisc.c
sys/sys/ttydisc.h
sys/sys/ttyqueue.h