[PATCH v2 1/3] linux/termios: clear k_termios.c_cflag & CIBAUD for non-split speed [BZ 33340]
H. Peter Anvin
hpa@zytor.com
Tue Sep 16 09:36:58 GMT 2025
On 2025-09-10 14:36, H. Peter Anvin wrote:
> After getting more experience with the various broken direct-to-ioctl
> termios2 hacks using Fedora 43 beta, I have found a fair number of
> cases where the software would fail to set, or clear CIBAUD for
> non-split-speed operation.
>
> Thus it seems will help improve compatibility to clear the kernel-side
> version of c_cflag & CIBAUD (having the same meaning to the Linux
> kernel as the speed 0 has for cfsetibaud(), i.e. force the input speed
> to equal the output speed) for non-split-speed operation, rather than
> having it explicitly equal the output speed in CBAUD.
>
> When writing the code that went into glibc 2.42 I had considered this
> issue, and had to make an educated guess which way would be more
> likely to break fewer things. Unfortunately, it appears I guessed
> wrong.
>
> A third option would be to *always* set CIBAUD to __BOTHER, even for
> the standard baud rates. However, that is an even bigger departure
> from legacy behavior, whereas this variant mostly preserves current
> behavior in terms of under what conditions buggy utilities will
> continue to work.
>
> This change is in tcsetattr() rather than
> ___termios2_canonicalize_speeds(), as it should not be run for
> tcgetattr(); that would break split speed support for the legacy
> interface versions of cfgetispeed() and cfsetispeed().
>
> [ v2: fixed comment style ]
>
*Gentle ping*
-hpa
More information about the Libc-alpha
mailing list