You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'hwparam-20170420' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
Pull hw lockdown support from David Howells:
"Annotation of module parameters that configure hardware resources
including ioports, iomem addresses, irq lines and dma channels.
This allows a future patch to prohibit the use of such module
parameters to prevent that hardware from being abused to gain access
to the running kernel image as part of locking the kernel down under
UEFI secure boot conditions.
Annotations are made by changing:
module_param(n, t, p)
module_param_named(n, v, t, p)
module_param_array(n, t, m, p)
to:
module_param_hw(n, t, hwtype, p)
module_param_hw_named(n, v, t, hwtype, p)
module_param_hw_array(n, t, hwtype, m, p)
where the module parameter refers to a hardware setting
hwtype specifies the type of the resource being configured. This can
be one of:
ioport Module parameter configures an I/O port
iomem Module parameter configures an I/O mem address
ioport_or_iomem Module parameter could be either (runtime set)
irq Module parameter configures an I/O port
dma Module parameter configures a DMA channel
dma_addr Module parameter configures a DMA buffer address
other Module parameter configures some other value
Note that the hwtype is compile checked, but not currently stored (the
lockdown code probably won't require it). It is, however, there for
future use.
A bonus is that the hwtype can also be used for grepping.
The intention is for the kernel to ignore or reject attempts to set
annotated module parameters if lockdown is enabled. This applies to
options passed on the boot command line, passed to insmod/modprobe or
direct twiddling in /sys/module/ parameter files.
The module initialisation then needs to handle the parameter not being
set, by (1) giving an error, (2) probing for a value or (3) using a
reasonable default.
What I can't do is just reject a module out of hand because it may
take a hardware setting in the module parameters. Some important
modules, some ipmi stuff for instance, both probe for hardware and
allow hardware to be manually specified; if the driver is aborts with
any error, you don't get any ipmi hardware.
Further, trying to do this entirely in the module initialisation code
doesn't protect against sysfs twiddling.
[!] Note that in and of itself, this series of patches should have no
effect on the the size of the kernel or code execution - that is
left to a patch in the next series to effect. It does mark
annotated kernel parameters with a KERNEL_PARAM_FL_HWPARAM flag in
an already existing field"
* tag 'hwparam-20170420' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: (38 commits)
Annotate hardware config module parameters in sound/pci/
Annotate hardware config module parameters in sound/oss/
Annotate hardware config module parameters in sound/isa/
Annotate hardware config module parameters in sound/drivers/
Annotate hardware config module parameters in fs/pstore/
Annotate hardware config module parameters in drivers/watchdog/
Annotate hardware config module parameters in drivers/video/
Annotate hardware config module parameters in drivers/tty/
Annotate hardware config module parameters in drivers/staging/vme/
Annotate hardware config module parameters in drivers/staging/speakup/
Annotate hardware config module parameters in drivers/staging/media/
Annotate hardware config module parameters in drivers/scsi/
Annotate hardware config module parameters in drivers/pcmcia/
Annotate hardware config module parameters in drivers/pci/hotplug/
Annotate hardware config module parameters in drivers/parport/
Annotate hardware config module parameters in drivers/net/wireless/
Annotate hardware config module parameters in drivers/net/wan/
Annotate hardware config module parameters in drivers/net/irda/
Annotate hardware config module parameters in drivers/net/hamradio/
Annotate hardware config module parameters in drivers/net/ethernet/
...
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include <linux/mmiotrace.h>
|
||||
|
||||
static unsigned long mmio_address;
|
||||
module_param(mmio_address, ulong, 0);
|
||||
module_param_hw(mmio_address, ulong, iomem, 0);
|
||||
MODULE_PARM_DESC(mmio_address, " Start address of the mapping of 16 kB "
|
||||
"(or 8 MB if read_far is non-zero).");
|
||||
|
||||
|
||||
@@ -94,9 +94,9 @@ static struct applicom_board {
|
||||
static unsigned int irq = 0; /* interrupt number IRQ */
|
||||
static unsigned long mem = 0; /* physical segment of board */
|
||||
|
||||
module_param(irq, uint, 0);
|
||||
module_param_hw(irq, uint, irq, 0);
|
||||
MODULE_PARM_DESC(irq, "IRQ of the Applicom board");
|
||||
module_param(mem, ulong, 0);
|
||||
module_param_hw(mem, ulong, iomem, 0);
|
||||
MODULE_PARM_DESC(mem, "Shared Memory Address of Applicom board");
|
||||
|
||||
static unsigned int numboards; /* number of installed boards */
|
||||
|
||||
@@ -1375,39 +1375,39 @@ MODULE_PARM_DESC(type, "Defines the type of each interface, each"
|
||||
" interface separated by commas. The types are 'kcs',"
|
||||
" 'smic', and 'bt'. For example si_type=kcs,bt will set"
|
||||
" 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"
|
||||
" addresses separated by commas. Only use if an interface"
|
||||
" is in memory. Otherwise, set it to zero or leave"
|
||||
" 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"
|
||||
" addresses separated by commas. Only use if an interface"
|
||||
" is a port. Otherwise, set it to zero or leave"
|
||||
" 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"
|
||||
" addresses separated by commas. Only use if an interface"
|
||||
" has an interrupt. Otherwise, set it to zero or leave"
|
||||
" 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"
|
||||
" and each successive register used by the interface. For"
|
||||
" instance, if the start address is 0xca2 and the spacing"
|
||||
" is 2, then the second address is at 0xca4. Defaults"
|
||||
" 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."
|
||||
" 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"
|
||||
" the 8-bit IPMI register has to be read from a larger"
|
||||
" 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."
|
||||
" IPMI register, in bits. For instance, if the data"
|
||||
" is read from a 32-bit word and the IPMI data is in"
|
||||
" 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"
|
||||
" the controller. Normally this is 0x20, but can be"
|
||||
" overridden by this parm. This is an array indexed"
|
||||
|
||||
@@ -80,10 +80,10 @@ int mwave_3780i_io = 0;
|
||||
int mwave_uart_irq = 0;
|
||||
int mwave_uart_io = 0;
|
||||
module_param(mwave_debug, int, 0);
|
||||
module_param(mwave_3780i_irq, int, 0);
|
||||
module_param(mwave_3780i_io, int, 0);
|
||||
module_param(mwave_uart_irq, int, 0);
|
||||
module_param(mwave_uart_io, int, 0);
|
||||
module_param_hw(mwave_3780i_irq, int, irq, 0);
|
||||
module_param_hw(mwave_3780i_io, int, ioport, 0);
|
||||
module_param_hw(mwave_uart_irq, int, irq, 0);
|
||||
module_param_hw(mwave_uart_io, int, ioport, 0);
|
||||
|
||||
static int mwave_open(struct inode *inode, struct file *file);
|
||||
static int mwave_close(struct inode *inode, struct file *file);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define DRV_NAME "cs5535-clockevt"
|
||||
|
||||
static int timer_irq;
|
||||
module_param_named(irq, timer_irq, int, 0644);
|
||||
module_param_hw_named(irq, timer_irq, int, irq, 0644);
|
||||
MODULE_PARM_DESC(irq, "Which IRQ to use for the clock source MFGPT ticks.");
|
||||
|
||||
/*
|
||||
|
||||
@@ -378,7 +378,7 @@ static void __exit speedstep_exit(void)
|
||||
cpufreq_unregister_driver(&speedstep_driver);
|
||||
}
|
||||
|
||||
module_param(smi_port, int, 0444);
|
||||
module_param_hw(smi_port, int, ioport, 0444);
|
||||
module_param(smi_cmd, int, 0444);
|
||||
module_param(smi_sig, uint, 0444);
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
|
||||
static unsigned int base[MAX_NUM_DIO48E];
|
||||
static unsigned int num_dio48e;
|
||||
module_param_array(base, uint, &num_dio48e, 0);
|
||||
module_param_hw_array(base, uint, ioport, &num_dio48e, 0);
|
||||
MODULE_PARM_DESC(base, "ACCES 104-DIO-48E base addresses");
|
||||
|
||||
static unsigned int irq[MAX_NUM_DIO48E];
|
||||
module_param_array(irq, uint, NULL, 0);
|
||||
module_param_hw_array(irq, uint, irq, NULL, 0);
|
||||
MODULE_PARM_DESC(irq, "ACCES 104-DIO-48E interrupt line numbers");
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
|
||||
static unsigned int base[MAX_NUM_IDI_48];
|
||||
static unsigned int num_idi_48;
|
||||
module_param_array(base, uint, &num_idi_48, 0);
|
||||
module_param_hw_array(base, uint, ioport, &num_idi_48, 0);
|
||||
MODULE_PARM_DESC(base, "ACCES 104-IDI-48 base addresses");
|
||||
|
||||
static unsigned int irq[MAX_NUM_IDI_48];
|
||||
module_param_array(irq, uint, NULL, 0);
|
||||
module_param_hw_array(irq, uint, irq, NULL, 0);
|
||||
MODULE_PARM_DESC(irq, "ACCES 104-IDI-48 interrupt line numbers");
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
|
||||
static unsigned int base[MAX_NUM_IDIO_16];
|
||||
static unsigned int num_idio_16;
|
||||
module_param_array(base, uint, &num_idio_16, 0);
|
||||
module_param_hw_array(base, uint, ioport, &num_idio_16, 0);
|
||||
MODULE_PARM_DESC(base, "ACCES 104-IDIO-16 base addresses");
|
||||
|
||||
static unsigned int irq[MAX_NUM_IDIO_16];
|
||||
module_param_array(irq, uint, NULL, 0);
|
||||
module_param_hw_array(irq, uint, irq, NULL, 0);
|
||||
MODULE_PARM_DESC(irq, "ACCES 104-IDIO-16 interrupt line numbers");
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
static unsigned int base[MAX_NUM_GPIOMM];
|
||||
static unsigned int num_gpiomm;
|
||||
module_param_array(base, uint, &num_gpiomm, 0);
|
||||
module_param_hw_array(base, uint, ioport, &num_gpiomm, 0);
|
||||
MODULE_PARM_DESC(base, "Diamond Systems GPIO-MM base addresses");
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
|
||||
static unsigned int base[MAX_NUM_WS16C48];
|
||||
static unsigned int num_ws16c48;
|
||||
module_param_array(base, uint, &num_ws16c48, 0);
|
||||
module_param_hw_array(base, uint, ioport, &num_ws16c48, 0);
|
||||
MODULE_PARM_DESC(base, "WinSystems WS16C48 base addresses");
|
||||
|
||||
static unsigned int irq[MAX_NUM_WS16C48];
|
||||
module_param_array(irq, uint, NULL, 0);
|
||||
module_param_hw_array(irq, uint, irq, NULL, 0);
|
||||
MODULE_PARM_DESC(irq, "WinSystems WS16C48 interrupt line numbers");
|
||||
|
||||
/**
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
/* If force_addr is set to anything different from 0, we forcibly enable
|
||||
the device at the given address. */
|
||||
static u16 force_addr;
|
||||
module_param(force_addr, ushort, 0);
|
||||
module_param_hw(force_addr, ushort, ioport, 0);
|
||||
MODULE_PARM_DESC(force_addr,
|
||||
"Initialize the base address of the i2c controller");
|
||||
|
||||
|
||||
@@ -323,9 +323,9 @@ MODULE_AUTHOR("Hans Berglund <hb@spacetec.no>");
|
||||
MODULE_DESCRIPTION("I2C-Bus adapter routines for PCF8584 ISA bus adapter");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
module_param(base, int, 0);
|
||||
module_param(irq, int, 0);
|
||||
module_param_hw(base, int, ioport_or_iomem, 0);
|
||||
module_param_hw(irq, int, irq, 0);
|
||||
module_param(clock, int, 0);
|
||||
module_param(own, int, 0);
|
||||
module_param(mmapped, int, 0);
|
||||
module_param_hw(mmapped, int, other, 0);
|
||||
module_isa_driver(i2c_elektor_driver, 1);
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
static struct platform_device *pdev;
|
||||
|
||||
static u16 base;
|
||||
module_param(base, ushort, 0);
|
||||
module_param_hw(base, ushort, ioport, 0);
|
||||
MODULE_PARM_DESC(base, "Base I/O address");
|
||||
|
||||
static int irq;
|
||||
module_param(irq, int, 0);
|
||||
module_param_hw(irq, int, irq, 0);
|
||||
MODULE_PARM_DESC(irq, "IRQ (optional)");
|
||||
|
||||
/* ----- Low-level parallel port access ----------------------------------- */
|
||||
|
||||
@@ -197,9 +197,9 @@ MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>");
|
||||
MODULE_DESCRIPTION("ISA base PCA9564/PCA9665 driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
module_param(base, ulong, 0);
|
||||
module_param_hw(base, ulong, ioport, 0);
|
||||
MODULE_PARM_DESC(base, "I/O base address");
|
||||
module_param(irq, int, 0);
|
||||
module_param_hw(irq, int, irq, 0);
|
||||
MODULE_PARM_DESC(irq, "IRQ");
|
||||
module_param(clock, int, 0);
|
||||
MODULE_PARM_DESC(clock, "Clock rate in hertz.\n\t\t"
|
||||
|
||||
@@ -106,7 +106,7 @@ MODULE_PARM_DESC(force, "Forcibly enable the PIIX4. DANGEROUS!");
|
||||
/* If force_addr is set to anything different from 0, we forcibly enable
|
||||
the PIIX4 at the given address. VERY DANGEROUS! */
|
||||
static int force_addr;
|
||||
module_param (force_addr, int, 0);
|
||||
module_param_hw(force_addr, int, ioport, 0);
|
||||
MODULE_PARM_DESC(force_addr,
|
||||
"Forcibly enable the PIIX4 at the given address. "
|
||||
"EXTREMELY DANGEROUS!");
|
||||
|
||||
@@ -119,7 +119,7 @@ static int blacklist[] = {
|
||||
/* If force_addr is set to anything different from 0, we forcibly enable
|
||||
the device at the given address. */
|
||||
static u16 force_addr;
|
||||
module_param(force_addr, ushort, 0);
|
||||
module_param_hw(force_addr, ushort, ioport, 0);
|
||||
MODULE_PARM_DESC(force_addr, "Initialize the base address of the i2c controller");
|
||||
|
||||
static struct pci_driver sis5595_driver;
|
||||
|
||||
@@ -94,7 +94,7 @@ MODULE_PARM_DESC(force, "Forcibly enable the SMBus. DANGEROUS!");
|
||||
/* If force_addr is set to anything different from 0, we forcibly enable
|
||||
the VT596 at the given address. VERY DANGEROUS! */
|
||||
static u16 force_addr;
|
||||
module_param(force_addr, ushort, 0);
|
||||
module_param_hw(force_addr, ushort, ioport, 0);
|
||||
MODULE_PARM_DESC(force_addr,
|
||||
"Forcibly enable the SMBus at the given address. "
|
||||
"EXTREMELY DANGEROUS!");
|
||||
|
||||
@@ -42,7 +42,7 @@ MODULE_LICENSE("GPL");
|
||||
|
||||
#define MAX_DEVICES 4
|
||||
static int base[MAX_DEVICES] = { 0x820, 0x840 };
|
||||
module_param_array(base, int, NULL, 0);
|
||||
module_param_hw_array(base, int, ioport, NULL, 0);
|
||||
MODULE_PARM_DESC(base, "Base addresses for the ACCESS.bus controllers");
|
||||
|
||||
#define POLL_TIMEOUT (HZ/5)
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
static unsigned int base[max_num_isa_dev(STX104_EXTENT)];
|
||||
static unsigned int num_stx104;
|
||||
module_param_array(base, uint, &num_stx104, 0);
|
||||
module_param_hw_array(base, uint, ioport, &num_stx104, 0);
|
||||
MODULE_PARM_DESC(base, "Apex Embedded Systems STX104 base addresses");
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user