Commit 684497bf authored by David Howells's avatar David Howells

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: default avatarAlan Cox <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Reviewed-by: default avatarCorey Minyard <cminyard@mvista.com>
cc: openipmi-developer@lists.sourceforge.net
parent 3c2e2e68
...@@ -1375,39 +1375,39 @@ MODULE_PARM_DESC(type, "Defines the type of each interface, each" ...@@ -1375,39 +1375,39 @@ MODULE_PARM_DESC(type, "Defines the type of each interface, each"
" interface separated by commas. The types are 'kcs'," " interface separated by commas. The types are 'kcs',"
" 'smic', and 'bt'. For example si_type=kcs,bt will set" " 'smic', and 'bt'. For example si_type=kcs,bt will set"
" the first interface to kcs and the second to bt"); " the first interface to kcs and the second to bt");
module_param_array(addrs, ulong, &num_addrs, 0); module_param_hw_array(addrs, ulong, iomem, &num_addrs, 0);
MODULE_PARM_DESC(addrs, "Sets the memory address of each interface, the" MODULE_PARM_DESC(addrs, "Sets the memory address of each interface, the"
" addresses separated by commas. Only use if an interface" " addresses separated by commas. Only use if an interface"
" is in memory. Otherwise, set it to zero or leave" " is in memory. Otherwise, set it to zero or leave"
" it blank."); " it blank.");
module_param_array(ports, uint, &num_ports, 0); module_param_hw_array(ports, uint, ioport, &num_ports, 0);
MODULE_PARM_DESC(ports, "Sets the port address of each interface, the" MODULE_PARM_DESC(ports, "Sets the port address of each interface, the"
" addresses separated by commas. Only use if an interface" " addresses separated by commas. Only use if an interface"
" is a port. Otherwise, set it to zero or leave" " is a port. Otherwise, set it to zero or leave"
" it blank."); " it blank.");
module_param_array(irqs, int, &num_irqs, 0); module_param_hw_array(irqs, int, irq, &num_irqs, 0);
MODULE_PARM_DESC(irqs, "Sets the interrupt of each interface, the" MODULE_PARM_DESC(irqs, "Sets the interrupt of each interface, the"
" addresses separated by commas. Only use if an interface" " addresses separated by commas. Only use if an interface"
" has an interrupt. Otherwise, set it to zero or leave" " has an interrupt. Otherwise, set it to zero or leave"
" it blank."); " it blank.");
module_param_array(regspacings, int, &num_regspacings, 0); module_param_hw_array(regspacings, int, other, &num_regspacings, 0);
MODULE_PARM_DESC(regspacings, "The number of bytes between the start address" MODULE_PARM_DESC(regspacings, "The number of bytes between the start address"
" and each successive register used by the interface. For" " and each successive register used by the interface. For"
" instance, if the start address is 0xca2 and the spacing" " instance, if the start address is 0xca2 and the spacing"
" is 2, then the second address is at 0xca4. Defaults" " is 2, then the second address is at 0xca4. Defaults"
" to 1."); " to 1.");
module_param_array(regsizes, int, &num_regsizes, 0); module_param_hw_array(regsizes, int, other, &num_regsizes, 0);
MODULE_PARM_DESC(regsizes, "The size of the specific IPMI register in bytes." MODULE_PARM_DESC(regsizes, "The size of the specific IPMI register in bytes."
" This should generally be 1, 2, 4, or 8 for an 8-bit," " This should generally be 1, 2, 4, or 8 for an 8-bit,"
" 16-bit, 32-bit, or 64-bit register. Use this if you" " 16-bit, 32-bit, or 64-bit register. Use this if you"
" the 8-bit IPMI register has to be read from a larger" " the 8-bit IPMI register has to be read from a larger"
" register."); " register.");
module_param_array(regshifts, int, &num_regshifts, 0); module_param_hw_array(regshifts, int, other, &num_regshifts, 0);
MODULE_PARM_DESC(regshifts, "The amount to shift the data read from the." MODULE_PARM_DESC(regshifts, "The amount to shift the data read from the."
" IPMI register, in bits. For instance, if the data" " IPMI register, in bits. For instance, if the data"
" is read from a 32-bit word and the IPMI data is in" " is read from a 32-bit word and the IPMI data is in"
" bit 8-15, then the shift would be 8"); " bit 8-15, then the shift would be 8");
module_param_array(slave_addrs, int, &num_slave_addrs, 0); module_param_hw_array(slave_addrs, int, other, &num_slave_addrs, 0);
MODULE_PARM_DESC(slave_addrs, "Set the default IPMB slave address for" MODULE_PARM_DESC(slave_addrs, "Set the default IPMB slave address for"
" the controller. Normally this is 0x20, but can be" " the controller. Normally this is 0x20, but can be"
" overridden by this parm. This is an array indexed" " overridden by this parm. This is an array indexed"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment