aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2017-04-04 11:54:29 -0400
committerDavid Howells <dhowells@redhat.com>2017-04-20 07:02:32 -0400
commit3b60daf86b133f0b15e3eb9b767c6c1752af2bd6 (patch)
treee44fce87a67db71f6d2033b252371eafac168c75
parentea38fd72fb5f065e3f655d388193db3476820482 (diff)
Annotate hardware config module parameters in drivers/tty/
When the kernel is running in secure boot mode, we lock down the kernel to prevent userspace from modifying the running kernel image. Whilst this includes prohibiting access to things like /dev/mem, it must also prevent access by means of configuring driver modules in such a way as to cause a device to access or modify the kernel image. To this end, annotate module_param* statements that refer to hardware configuration and indicate for future reference what type of parameter they specify. The parameter parser in the core sees this information and can skip such parameters with an error message if the kernel is locked down. The module initialisation then runs as normal, but just sees whatever the default values for those parameters is. Note that we do still need to do the module initialisation because some drivers have viable defaults set in case parameters aren't specified and some drivers support automatic configuration (e.g. PNP or PCI) in addition to manually coded parameters. This patch annotates drivers in drivers/tty/. Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk> Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> cc: Jiri Slaby <jslaby@suse.com> cc: linux-serial@vger.kernel.org
-rw-r--r--drivers/tty/cyclades.c4
-rw-r--r--drivers/tty/moxa.c2
-rw-r--r--drivers/tty/mxser.c2
-rw-r--r--drivers/tty/rocket.c10
-rw-r--r--drivers/tty/serial/8250/8250_core.c4
-rw-r--r--drivers/tty/synclink.c6
6 files changed, 14 insertions, 14 deletions
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index 5e4fa9206861..104f09c58163 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -156,8 +156,8 @@ static unsigned int cy_isa_addresses[] = {
156static long maddr[NR_CARDS]; 156static long maddr[NR_CARDS];
157static int irq[NR_CARDS]; 157static int irq[NR_CARDS];
158 158
159module_param_array(maddr, long, NULL, 0); 159module_param_hw_array(maddr, long, iomem, NULL, 0);
160module_param_array(irq, int, NULL, 0); 160module_param_hw_array(irq, int, irq, NULL, 0);
161 161
162#endif /* CONFIG_ISA */ 162#endif /* CONFIG_ISA */
163 163
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index 4caf0c3b1f99..3b251f4e5df0 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -179,7 +179,7 @@ MODULE_FIRMWARE("c320tunx.cod");
179 179
180module_param_array(type, uint, NULL, 0); 180module_param_array(type, uint, NULL, 0);
181MODULE_PARM_DESC(type, "card type: C218=2, C320=4"); 181MODULE_PARM_DESC(type, "card type: C218=2, C320=4");
182module_param_array(baseaddr, ulong, NULL, 0); 182module_param_hw_array(baseaddr, ulong, ioport, NULL, 0);
183MODULE_PARM_DESC(baseaddr, "base address"); 183MODULE_PARM_DESC(baseaddr, "base address");
184module_param_array(numports, uint, NULL, 0); 184module_param_array(numports, uint, NULL, 0);
185MODULE_PARM_DESC(numports, "numports (ignored for C218)"); 185MODULE_PARM_DESC(numports, "numports (ignored for C218)");
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 7b8f383fb090..8bd6fb6d9391 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -183,7 +183,7 @@ static int ttymajor = MXSERMAJOR;
183 183
184MODULE_AUTHOR("Casper Yang"); 184MODULE_AUTHOR("Casper Yang");
185MODULE_DESCRIPTION("MOXA Smartio/Industio Family Multiport Board Device Driver"); 185MODULE_DESCRIPTION("MOXA Smartio/Industio Family Multiport Board Device Driver");
186module_param_array(ioaddr, ulong, NULL, 0); 186module_param_hw_array(ioaddr, ulong, ioport, NULL, 0);
187MODULE_PARM_DESC(ioaddr, "ISA io addresses to look for a moxa board"); 187MODULE_PARM_DESC(ioaddr, "ISA io addresses to look for a moxa board");
188module_param(ttymajor, int, 0); 188module_param(ttymajor, int, 0);
189MODULE_LICENSE("GPL"); 189MODULE_LICENSE("GPL");
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index d66c1edd9892..b51a877da986 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -250,15 +250,15 @@ static int sReadAiopNumChan(WordIO_t io);
250 250
251MODULE_AUTHOR("Theodore Ts'o"); 251MODULE_AUTHOR("Theodore Ts'o");
252MODULE_DESCRIPTION("Comtrol RocketPort driver"); 252MODULE_DESCRIPTION("Comtrol RocketPort driver");
253module_param(board1, ulong, 0); 253module_param_hw(board1, ulong, ioport, 0);
254MODULE_PARM_DESC(board1, "I/O port for (ISA) board #1"); 254MODULE_PARM_DESC(board1, "I/O port for (ISA) board #1");
255module_param(board2, ulong, 0); 255module_param_hw(board2, ulong, ioport, 0);
256MODULE_PARM_DESC(board2, "I/O port for (ISA) board #2"); 256MODULE_PARM_DESC(board2, "I/O port for (ISA) board #2");
257module_param(board3, ulong, 0); 257module_param_hw(board3, ulong, ioport, 0);
258MODULE_PARM_DESC(board3, "I/O port for (ISA) board #3"); 258MODULE_PARM_DESC(board3, "I/O port for (ISA) board #3");
259module_param(board4, ulong, 0); 259module_param_hw(board4, ulong, ioport, 0);
260MODULE_PARM_DESC(board4, "I/O port for (ISA) board #4"); 260MODULE_PARM_DESC(board4, "I/O port for (ISA) board #4");
261module_param(controller, ulong, 0); 261module_param_hw(controller, ulong, ioport, 0);
262MODULE_PARM_DESC(controller, "I/O port for (ISA) rocketport controller"); 262MODULE_PARM_DESC(controller, "I/O port for (ISA) rocketport controller");
263module_param(support_low_speed, bool, 0); 263module_param(support_low_speed, bool, 0);
264MODULE_PARM_DESC(support_low_speed, "1 means support 50 baud, 0 means support 460400 baud"); 264MODULE_PARM_DESC(support_low_speed, "1 means support 50 baud, 0 means support 460400 baud");
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 76e03a7de9cc..89fde17d9617 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -1191,7 +1191,7 @@ module_exit(serial8250_exit);
1191MODULE_LICENSE("GPL"); 1191MODULE_LICENSE("GPL");
1192MODULE_DESCRIPTION("Generic 8250/16x50 serial driver"); 1192MODULE_DESCRIPTION("Generic 8250/16x50 serial driver");
1193 1193
1194module_param(share_irqs, uint, 0644); 1194module_param_hw(share_irqs, uint, other, 0644);
1195MODULE_PARM_DESC(share_irqs, "Share IRQs with other non-8250/16x50 devices (unsafe)"); 1195MODULE_PARM_DESC(share_irqs, "Share IRQs with other non-8250/16x50 devices (unsafe)");
1196 1196
1197module_param(nr_uarts, uint, 0644); 1197module_param(nr_uarts, uint, 0644);
@@ -1201,7 +1201,7 @@ module_param(skip_txen_test, uint, 0644);
1201MODULE_PARM_DESC(skip_txen_test, "Skip checking for the TXEN bug at init time"); 1201MODULE_PARM_DESC(skip_txen_test, "Skip checking for the TXEN bug at init time");
1202 1202
1203#ifdef CONFIG_SERIAL_8250_RSA 1203#ifdef CONFIG_SERIAL_8250_RSA
1204module_param_array(probe_rsa, ulong, &probe_rsa_count, 0444); 1204module_param_hw_array(probe_rsa, ulong, ioport, &probe_rsa_count, 0444);
1205MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA"); 1205MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA");
1206#endif 1206#endif
1207MODULE_ALIAS_CHARDEV_MAJOR(TTY_MAJOR); 1207MODULE_ALIAS_CHARDEV_MAJOR(TTY_MAJOR);
diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c
index 657eed82eeb3..a2c308f7d637 100644
--- a/drivers/tty/synclink.c
+++ b/drivers/tty/synclink.c
@@ -869,9 +869,9 @@ static int txholdbufs[MAX_TOTAL_DEVICES];
869 869
870module_param(break_on_load, bool, 0); 870module_param(break_on_load, bool, 0);
871module_param(ttymajor, int, 0); 871module_param(ttymajor, int, 0);
872module_param_array(io, int, NULL, 0); 872module_param_hw_array(io, int, ioport, NULL, 0);
873module_param_array(irq, int, NULL, 0); 873module_param_hw_array(irq, int, irq, NULL, 0);
874module_param_array(dma, int, NULL, 0); 874module_param_hw_array(dma, int, dma, NULL, 0);
875module_param(debug_level, int, 0); 875module_param(debug_level, int, 0);
876module_param_array(maxframe, int, NULL, 0); 876module_param_array(maxframe, int, NULL, 0);
877module_param_array(txdmabufs, int, NULL, 0); 877module_param_array(txdmabufs, int, NULL, 0);