diff mbox series

[v2,2/2] tty: Change order of ttynull to be loaded sooner.

Message ID 20250217040748.2017975-3-adamsimonelli@gmail.com
State New
Headers show
Series Optionally allow ttynull to be selected as a default console | expand

Commit Message

adamsimonelli@gmail.com Feb. 17, 2025, 4:07 a.m. UTC
From: Adam Simonelli <adamsimonelli@gmail.com>

If CONFIG_NULL_TTY_CONSOLE is enabled, and CONFIG_VT is disabled, ttynull
will become the default primary console device, based on the load order.
Users and distributions that are migrating away from CONFIG_VT will
benefit from this as /dev/console would not suddenly become /dev/ttyS0
which could otherwise cause some user space behavior changes, namely the
TCGETS ioctl failing, which causes libc's isatty() to incorrectly return
false when /dev/ttyS0 is disabled, and will prevent a device that is
connected to a user's /dev/ttyS0 to suddenly start getting kernel log
messages.

Signed-off-by: Adam Simonelli <adamsimonelli@gmail.com>
---
 drivers/tty/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Greg Kroah-Hartman Feb. 19, 2025, 2:03 p.m. UTC | #1
On Sun, Feb 16, 2025 at 11:07:48PM -0500, adamsimonelli@gmail.com wrote:
> From: Adam Simonelli <adamsimonelli@gmail.com>
> 
> If CONFIG_NULL_TTY_CONSOLE is enabled, and CONFIG_VT is disabled, ttynull
> will become the default primary console device, based on the load order.

You mean "link order" right?

> Users and distributions that are migrating away from CONFIG_VT will
> benefit from this as /dev/console would not suddenly become /dev/ttyS0
> which could otherwise cause some user space behavior changes, namely the
> TCGETS ioctl failing, which causes libc's isatty() to incorrectly return
> false when /dev/ttyS0 is disabled, and will prevent a device that is
> connected to a user's /dev/ttyS0 to suddenly start getting kernel log
> messages.

I'm sorry, but I can not parse that very long sentance.  If CONFIG_VT is
not enabled, this isn't going to change anything with ttynull, it will
just happen to have this console loaded before all others, right?

Which implies that this might break existing systems when this loads
before the expected platform-specific drivers.  Was this tested on those
systems?

> 
> Signed-off-by: Adam Simonelli <adamsimonelli@gmail.com>
> ---
>  drivers/tty/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/Makefile b/drivers/tty/Makefile
> index 07aca5184a55..03bb47e11e1c 100644
> --- a/drivers/tty/Makefile
> +++ b/drivers/tty/Makefile
> @@ -11,6 +11,8 @@ obj-$(CONFIG_N_HDLC)		+= n_hdlc.o
>  obj-$(CONFIG_N_GSM)		+= n_gsm.o
>  
>  obj-y				+= vt/
> +obj-$(CONFIG_NULL_TTY)		+= ttynull.o

If you are going to rely on link order here, and HAVE to have this above
all other consoles, please document it as such so that people have a
hint as to why you are doing this in the file so it dosn't change again.

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/tty/Makefile b/drivers/tty/Makefile
index 07aca5184a55..03bb47e11e1c 100644
--- a/drivers/tty/Makefile
+++ b/drivers/tty/Makefile
@@ -11,6 +11,8 @@  obj-$(CONFIG_N_HDLC)		+= n_hdlc.o
 obj-$(CONFIG_N_GSM)		+= n_gsm.o
 
 obj-y				+= vt/
+obj-$(CONFIG_NULL_TTY)		+= ttynull.o
+
 obj-$(CONFIG_HVC_DRIVER)	+= hvc/
 obj-y				+= serial/
 obj-$(CONFIG_SERIAL_DEV_BUS)	+= serdev/
@@ -20,7 +22,6 @@  obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o
 obj-$(CONFIG_MOXA_INTELLIO)	+= moxa.o
 obj-$(CONFIG_MOXA_SMARTIO)	+= mxser.o
 obj-$(CONFIG_NOZOMI)		+= nozomi.o
-obj-$(CONFIG_NULL_TTY)	        += ttynull.o
 obj-$(CONFIG_SYNCLINK_GT)	+= synclink_gt.o
 obj-$(CONFIG_PPC_EPAPR_HV_BYTECHAN) += ehv_bytechan.o
 obj-$(CONFIG_GOLDFISH_TTY)	+= goldfish.o