Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Annotate hardware config module parameters in drivers/char/ipmi/

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/char/ipmi/.

Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Corey Minyard <cminyard@mvista.com>
cc: openipmi-developer@lists.sourceforge.net

+7 -7
+7 -7
drivers/char/ipmi/ipmi_si_intf.c
··· 1375 1375 " interface separated by commas. The types are 'kcs'," 1376 1376 " 'smic', and 'bt'. For example si_type=kcs,bt will set" 1377 1377 " the first interface to kcs and the second to bt"); 1378 - module_param_array(addrs, ulong, &num_addrs, 0); 1378 + module_param_hw_array(addrs, ulong, iomem, &num_addrs, 0); 1379 1379 MODULE_PARM_DESC(addrs, "Sets the memory address of each interface, the" 1380 1380 " addresses separated by commas. Only use if an interface" 1381 1381 " is in memory. Otherwise, set it to zero or leave" 1382 1382 " it blank."); 1383 - module_param_array(ports, uint, &num_ports, 0); 1383 + module_param_hw_array(ports, uint, ioport, &num_ports, 0); 1384 1384 MODULE_PARM_DESC(ports, "Sets the port address of each interface, the" 1385 1385 " addresses separated by commas. Only use if an interface" 1386 1386 " is a port. Otherwise, set it to zero or leave" 1387 1387 " it blank."); 1388 - module_param_array(irqs, int, &num_irqs, 0); 1388 + module_param_hw_array(irqs, int, irq, &num_irqs, 0); 1389 1389 MODULE_PARM_DESC(irqs, "Sets the interrupt of each interface, the" 1390 1390 " addresses separated by commas. Only use if an interface" 1391 1391 " has an interrupt. Otherwise, set it to zero or leave" 1392 1392 " it blank."); 1393 - module_param_array(regspacings, int, &num_regspacings, 0); 1393 + module_param_hw_array(regspacings, int, other, &num_regspacings, 0); 1394 1394 MODULE_PARM_DESC(regspacings, "The number of bytes between the start address" 1395 1395 " and each successive register used by the interface. For" 1396 1396 " instance, if the start address is 0xca2 and the spacing" 1397 1397 " is 2, then the second address is at 0xca4. Defaults" 1398 1398 " to 1."); 1399 - module_param_array(regsizes, int, &num_regsizes, 0); 1399 + module_param_hw_array(regsizes, int, other, &num_regsizes, 0); 1400 1400 MODULE_PARM_DESC(regsizes, "The size of the specific IPMI register in bytes." 1401 1401 " This should generally be 1, 2, 4, or 8 for an 8-bit," 1402 1402 " 16-bit, 32-bit, or 64-bit register. Use this if you" 1403 1403 " the 8-bit IPMI register has to be read from a larger" 1404 1404 " register."); 1405 - module_param_array(regshifts, int, &num_regshifts, 0); 1405 + module_param_hw_array(regshifts, int, other, &num_regshifts, 0); 1406 1406 MODULE_PARM_DESC(regshifts, "The amount to shift the data read from the." 1407 1407 " IPMI register, in bits. For instance, if the data" 1408 1408 " is read from a 32-bit word and the IPMI data is in" 1409 1409 " bit 8-15, then the shift would be 8"); 1410 - module_param_array(slave_addrs, int, &num_slave_addrs, 0); 1410 + module_param_hw_array(slave_addrs, int, other, &num_slave_addrs, 0); 1411 1411 MODULE_PARM_DESC(slave_addrs, "Set the default IPMB slave address for" 1412 1412 " the controller. Normally this is 0x20, but can be" 1413 1413 " overridden by this parm. This is an array indexed"