Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1617198 > unrolled thread
| Started by | David Howells <dhowells@redhat.com> |
|---|---|
| First post | 2017-04-05 19:20 +0200 |
| Last post | 2017-04-05 19:30 +0200 |
| Articles | 20 on this page of 27 — 7 participants |
Back to article view | Back to linux.kernel
[PATCH 00/38] Annotate hw config module params for future lockdown David Howells <dhowells@redhat.com> - 2017-04-05 19:20 +0200
[PATCH 13/38] Annotate hardware config module parameters in drivers/media/ David Howells <dhowells@redhat.com> - 2017-04-05 19:20 +0200
Re: [PATCH 13/38] Annotate hardware config module parameters in drivers/media/ Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2017-04-19 13:10 +0200
[PATCH 08/38] Annotate hardware config module parameters in drivers/gpio/ David Howells <dhowells@redhat.com> - 2017-04-05 19:20 +0200
Re: [PATCH 08/38] Annotate hardware config module parameters in drivers/gpio/ Linus Walleij <linus.walleij@linaro.org> - 2017-04-07 12:50 +0200
Re: [PATCH 08/38] Annotate hardware config module parameters in drivers/gpio/ David Howells <dhowells@redhat.com> - 2017-04-07 15:00 +0200
[PATCH 07/38] Annotate hardware config module parameters in drivers/cpufreq/ David Howells <dhowells@redhat.com> - 2017-04-05 19:30 +0200
Re: [PATCH 07/38] Annotate hardware config module parameters in drivers/cpufreq/ Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-10 12:40 +0200
[PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ David Howells <dhowells@redhat.com> - 2017-04-05 19:30 +0200
Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ Thomas Gleixner <tglx@linutronix.de> - 2017-04-14 20:30 +0200
Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ David Howells <dhowells@redhat.com> - 2017-04-15 01:00 +0200
Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ Thomas Gleixner <tglx@linutronix.de> - 2017-04-15 07:50 +0200
Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ David Howells <dhowells@redhat.com> - 2017-04-15 08:00 +0200
Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ Thomas Gleixner <tglx@linutronix.de> - 2017-04-15 12:00 +0200
Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ David Howells <dhowells@redhat.com> - 2017-04-18 14:50 +0200
Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ Thomas Gleixner <tglx@linutronix.de> - 2017-04-18 15:00 +0200
Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ David Howells <dhowells@redhat.com> - 2017-04-19 17:40 +0200
Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ David Howells <dhowells@redhat.com> - 2017-04-19 17:40 +0200
[PATCH 02/38] Annotate hardware config module parameters in arch/x86/mm/ David Howells <dhowells@redhat.com> - 2017-04-05 19:30 +0200
Re: [PATCH 02/38] Annotate hardware config module parameters in arch/x86/mm/ Steven Rostedt <rostedt@goodmis.org> - 2017-04-05 19:40 +0200
Re: [PATCH 02/38] Annotate hardware config module parameters in arch/x86/mm/ Thomas Gleixner <tglx@linutronix.de> - 2017-04-14 20:20 +0200
Re: [PATCH 02/38] Annotate hardware config module parameters in arch/x86/mm/ David Howells <dhowells@redhat.com> - 2017-04-18 14:40 +0200
[PATCH 03/38] Annotate hardware config module parameters in drivers/char/ipmi/ David Howells <dhowells@redhat.com> - 2017-04-05 19:30 +0200
[PATCH 05/38] Annotate hardware config module parameters in drivers/char/ David Howells <dhowells@redhat.com> - 2017-04-05 19:30 +0200
Re: [PATCH 05/38] Annotate hardware config module parameters in drivers/char/ Greg KH <gregkh@linuxfoundation.org> - 2017-04-08 17:30 +0200
[PATCH 04/38] Annotate hardware config module parameters in drivers/char/mwave/ David Howells <dhowells@redhat.com> - 2017-04-05 19:30 +0200
[PATCH 01/38] Annotate module params that specify hardware parameters (eg. ioport) David Howells <dhowells@redhat.com> - 2017-04-05 19:30 +0200
Page 1 of 2 [1] 2 Next page →
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-04-05 19:20 +0200 |
| Subject | [PATCH 00/38] Annotate hw config module params for future lockdown |
| Message-ID | <tsWBr-5sA-3@gated-at.bofh.it> |
Here's a set of patches that annotate module parameters that configure
hardware resources including ioports, iomem addresses, irq lines and dma
channels.
This will be used in a future patch[*] to prohibit the use of such module
parameters so that hardware can't be abused to gain access to the running
kernel image.
[*] Which is in my "Kernel lockdown" series, posted separately for length
reasons.
This is done 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 hwtype specifies the type of the resource being configured.
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.
Further note that the hwtype can also be used for grepping.
The patches can be found here also:
http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=hwparam
at tag:
hwparam-20170405
David
---
David Howells (38):
Annotate module params that specify hardware parameters (eg. ioport)
Annotate hardware config module parameters in arch/x86/mm/
Annotate hardware config module parameters in drivers/char/ipmi/
Annotate hardware config module parameters in drivers/char/mwave/
Annotate hardware config module parameters in drivers/char/
Annotate hardware config module parameters in drivers/clocksource/
Annotate hardware config module parameters in drivers/cpufreq/
Annotate hardware config module parameters in drivers/gpio/
Annotate hardware config module parameters in drivers/i2c/
Annotate hardware config module parameters in drivers/iio/
Annotate hardware config module parameters in drivers/input/
Annotate hardware config module parameters in drivers/isdn/
Annotate hardware config module parameters in drivers/media/
Annotate hardware config module parameters in drivers/misc/
Annotate hardware config module parameters in drivers/mmc/host/
Annotate hardware config module parameters in drivers/net/appletalk/
Annotate hardware config module parameters in drivers/net/arcnet/
Annotate hardware config module parameters in drivers/net/can/
Annotate hardware config module parameters in drivers/net/ethernet/
Annotate hardware config module parameters in drivers/net/hamradio/
Annotate hardware config module parameters in drivers/net/irda/
Annotate hardware config module parameters in drivers/net/wan/
Annotate hardware config module parameters in drivers/net/wireless/
Annotate hardware config module parameters in drivers/parport/
Annotate hardware config module parameters in drivers/pci/hotplug/
Annotate hardware config module parameters in drivers/pcmcia/
Annotate hardware config module parameters in drivers/scsi/
Annotate hardware config module parameters in drivers/staging/media/
Annotate hardware config module parameters in drivers/staging/speakup/
Annotate hardware config module parameters in drivers/staging/vme/
Annotate hardware config module parameters in drivers/tty/
Annotate hardware config module parameters in drivers/video/
Annotate hardware config module parameters in drivers/watchdog/
Annotate hardware config module parameters in fs/pstore/
Annotate hardware config module parameters in sound/drivers/
Annotate hardware config module parameters in sound/isa/
Annotate hardware config module parameters in sound/oss/
Annotate hardware config module parameters in sound/pci/
arch/x86/mm/testmmiotrace.c | 2 -
drivers/char/applicom.c | 4 +-
drivers/char/ipmi/ipmi_si_intf.c | 14 +++---
drivers/char/mwave/mwavedd.c | 8 ++-
drivers/clocksource/cs5535-clockevt.c | 2 -
drivers/cpufreq/speedstep-smi.c | 2 -
drivers/gpio/gpio-104-dio-48e.c | 4 +-
drivers/gpio/gpio-104-idi-48.c | 4 +-
drivers/gpio/gpio-104-idio-16.c | 4 +-
drivers/gpio/gpio-gpio-mm.c | 2 -
drivers/gpio/gpio-ws16c48.c | 4 +-
drivers/i2c/busses/i2c-ali15x3.c | 2 -
drivers/i2c/busses/i2c-elektor.c | 6 +-
drivers/i2c/busses/i2c-parport-light.c | 4 +-
drivers/i2c/busses/i2c-pca-isa.c | 4 +-
drivers/i2c/busses/i2c-piix4.c | 2 -
drivers/i2c/busses/i2c-sis5595.c | 2 -
drivers/i2c/busses/i2c-viapro.c | 2 -
drivers/i2c/busses/scx200_acb.c | 2 -
drivers/iio/adc/stx104.c | 2 -
drivers/iio/dac/cio-dac.c | 2 -
drivers/input/mouse/inport.c | 2 -
drivers/input/mouse/logibm.c | 2 -
drivers/input/touchscreen/mk712.c | 4 +-
drivers/isdn/hardware/avm/b1isa.c | 4 +-
drivers/isdn/hardware/avm/t1isa.c | 4 +-
drivers/isdn/hisax/config.c | 10 ++--
drivers/media/pci/zoran/zoran_card.c | 2 -
drivers/media/rc/serial_ir.c | 10 ++--
drivers/misc/dummy-irq.c | 2 -
drivers/mmc/host/wbsd.c | 8 ++-
drivers/net/appletalk/cops.c | 6 +-
drivers/net/appletalk/ltpc.c | 6 +-
drivers/net/arcnet/com20020-isa.c | 4 +-
drivers/net/arcnet/com90io.c | 4 +-
drivers/net/arcnet/com90xx.c | 4 +-
drivers/net/can/cc770/cc770_isa.c | 8 ++-
drivers/net/can/sja1000/sja1000_isa.c | 8 ++-
drivers/net/ethernet/3com/3c509.c | 2 -
drivers/net/ethernet/3com/3c59x.c | 4 +-
drivers/net/ethernet/8390/ne.c | 4 +-
drivers/net/ethernet/8390/smc-ultra.c | 4 +-
drivers/net/ethernet/8390/wd.c | 8 ++-
drivers/net/ethernet/amd/lance.c | 6 +-
drivers/net/ethernet/amd/ni65.c | 6 +-
drivers/net/ethernet/cirrus/cs89x0.c | 6 +-
drivers/net/ethernet/dec/tulip/de4x5.c | 2 -
drivers/net/ethernet/hp/hp100.c | 2 -
drivers/net/ethernet/realtek/atp.c | 4 +-
drivers/net/ethernet/smsc/smc9194.c | 4 +-
drivers/net/hamradio/baycom_epp.c | 2 -
drivers/net/hamradio/baycom_par.c | 2 -
drivers/net/hamradio/baycom_ser_fdx.c | 4 +-
drivers/net/hamradio/baycom_ser_hdx.c | 4 +-
drivers/net/hamradio/dmascc.c | 2 -
drivers/net/irda/ali-ircc.c | 6 +-
drivers/net/irda/nsc-ircc.c | 6 +-
drivers/net/irda/smsc-ircc2.c | 10 ++--
drivers/net/irda/w83977af_ir.c | 4 +-
drivers/net/wan/cosa.c | 6 +-
drivers/net/wan/hostess_sv11.c | 6 +-
drivers/net/wan/sbni.c | 4 +-
drivers/net/wan/sealevel.c | 8 ++-
drivers/net/wireless/cisco/airo.c | 4 +-
drivers/parport/parport_pc.c | 8 ++-
drivers/pci/hotplug/cpcihp_generic.c | 2 -
drivers/pcmcia/i82365.c | 8 ++-
drivers/pcmcia/tcic.c | 8 ++-
drivers/scsi/aha152x.c | 4 +-
drivers/scsi/aha1542.c | 2 -
drivers/scsi/g_NCR5380.c | 8 ++-
drivers/scsi/gdth.c | 2 -
drivers/scsi/qlogicfas.c | 4 +-
drivers/staging/media/lirc/lirc_sir.c | 4 +-
drivers/staging/speakup/speakup_acntpc.c | 2 -
drivers/staging/speakup/speakup_dtlk.c | 2 -
drivers/staging/speakup/speakup_keypc.c | 2 -
drivers/staging/vme/devices/vme_pio2_core.c | 8 ++-
drivers/tty/cyclades.c | 4 +-
drivers/tty/moxa.c | 2 -
drivers/tty/mxser.c | 2 -
drivers/tty/rocket.c | 10 ++--
drivers/tty/serial/8250/8250_core.c | 4 +-
drivers/tty/synclink.c | 6 +-
drivers/video/fbdev/arcfb.c | 8 ++-
drivers/video/fbdev/n411.c | 6 +-
drivers/watchdog/cpu5wdt.c | 2 -
drivers/watchdog/eurotechwdt.c | 4 +-
drivers/watchdog/pc87413_wdt.c | 2 -
drivers/watchdog/sc1200wdt.c | 2 -
drivers/watchdog/wdt.c | 4 +-
fs/pstore/ram.c | 2 -
include/linux/moduleparam.h | 65 +++++++++++++++++++++++++++
sound/drivers/mpu401/mpu401.c | 4 +-
sound/drivers/mtpav.c | 4 +-
sound/drivers/serial-u16550.c | 4 +-
sound/isa/ad1848/ad1848.c | 6 +-
sound/isa/adlib.c | 2 -
sound/isa/cmi8328.c | 12 ++---
sound/isa/cmi8330.c | 20 ++++----
sound/isa/cs423x/cs4231.c | 12 ++---
sound/isa/cs423x/cs4236.c | 18 ++++---
sound/isa/es1688/es1688.c | 12 ++---
sound/isa/es18xx.c | 12 ++---
sound/isa/galaxy/galaxy.c | 16 +++----
sound/isa/gus/gusclassic.c | 8 ++-
sound/isa/gus/gusextreme.c | 16 +++----
sound/isa/gus/gusmax.c | 8 ++-
sound/isa/gus/interwave.c | 10 ++--
sound/isa/msnd/msnd_pinnacle.c | 20 ++++----
sound/isa/opl3sa2.c | 16 +++----
sound/isa/opti9xx/miro.c | 14 +++---
sound/isa/opti9xx/opti92x-ad1848.c | 14 +++---
sound/isa/sb/jazz16.c | 12 ++---
sound/isa/sb/sb16.c | 14 +++---
sound/isa/sb/sb8.c | 6 +-
sound/isa/sc6000.c | 12 ++---
sound/isa/sscape.c | 12 ++---
sound/isa/wavefront/wavefront.c | 18 ++++---
sound/oss/ad1848.c | 8 ++-
sound/oss/aedsp16.c | 12 ++---
sound/oss/mpu401.c | 4 +-
sound/oss/msnd_pinnacle.c | 20 ++++----
sound/oss/opl3.c | 2 -
sound/oss/pas2_card.c | 18 ++++---
sound/oss/pss.c | 14 +++---
sound/oss/sb_card.c | 10 ++--
sound/oss/trix.c | 18 ++++---
sound/oss/uart401.c | 4 +-
sound/oss/uart6850.c | 4 +-
sound/oss/waveartist.c | 8 ++-
sound/pci/als4000.c | 2 -
sound/pci/cmipci.c | 6 +-
sound/pci/ens1370.c | 2 -
sound/pci/riptide/riptide.c | 6 +-
sound/pci/sonicvibes.c | 2 -
sound/pci/via82xx.c | 2 -
sound/pci/ymfpci/ymfpci.c | 6 +-
138 files changed, 493 insertions(+), 430 deletions(-)
[toc] | [next] | [standalone]
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-04-05 19:20 +0200 |
| Subject | [PATCH 13/38] Annotate hardware config module parameters in drivers/media/ |
| Message-ID | <tsWLa-5w8-55@gated-at.bofh.it> |
| In reply to | #1617198 |
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/media/.
Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Mauro Carvalho Chehab <mchehab@kernel.org>
cc: mjpeg-users@lists.sourceforge.net
cc: linux-media@vger.kernel.org
---
drivers/media/pci/zoran/zoran_card.c | 2 +-
drivers/media/rc/serial_ir.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/media/pci/zoran/zoran_card.c b/drivers/media/pci/zoran/zoran_card.c
index 5266755add63..4680f001653a 100644
--- a/drivers/media/pci/zoran/zoran_card.c
+++ b/drivers/media/pci/zoran/zoran_card.c
@@ -69,7 +69,7 @@ MODULE_PARM_DESC(card, "Card type");
*/
static unsigned long vidmem; /* default = 0 - Video memory base address */
-module_param(vidmem, ulong, 0444);
+module_param_hw(vidmem, ulong, iomem, 0444);
MODULE_PARM_DESC(vidmem, "Default video memory base address");
/*
diff --git a/drivers/media/rc/serial_ir.c b/drivers/media/rc/serial_ir.c
index 41b54e40176c..40d305842a9b 100644
--- a/drivers/media/rc/serial_ir.c
+++ b/drivers/media/rc/serial_ir.c
@@ -833,11 +833,11 @@ MODULE_LICENSE("GPL");
module_param(type, int, 0444);
MODULE_PARM_DESC(type, "Hardware type (0 = home-brew, 1 = IRdeo, 2 = IRdeo Remote, 3 = AnimaX, 4 = IgorPlug");
-module_param(io, int, 0444);
+module_param_hw(io, int, ioport, 0444);
MODULE_PARM_DESC(io, "I/O address base (0x3f8 or 0x2f8)");
/* some architectures (e.g. intel xscale) have memory mapped registers */
-module_param(iommap, bool, 0444);
+module_param_hw(iommap, bool, other, 0444);
MODULE_PARM_DESC(iommap, "physical base for memory mapped I/O (0 = no memory mapped io)");
/*
@@ -845,13 +845,13 @@ MODULE_PARM_DESC(iommap, "physical base for memory mapped I/O (0 = no memory map
* on 32bit word boundaries.
* See linux-kernel/drivers/tty/serial/8250/8250.c serial_in()/out()
*/
-module_param(ioshift, int, 0444);
+module_param_hw(ioshift, int, other, 0444);
MODULE_PARM_DESC(ioshift, "shift I/O register offset (0 = no shift)");
-module_param(irq, int, 0444);
+module_param_hw(irq, int, irq, 0444);
MODULE_PARM_DESC(irq, "Interrupt (4 or 3)");
-module_param(share_irq, bool, 0444);
+module_param_hw(share_irq, bool, other, 0444);
MODULE_PARM_DESC(share_irq, "Share interrupts (0 = off, 1 = on)");
module_param(sense, int, 0444);
[toc] | [prev] | [next] | [standalone]
| From | Mauro Carvalho Chehab <mchehab@s-opensource.com> |
|---|---|
| Date | 2017-04-19 13:10 +0200 |
| Subject | Re: [PATCH 13/38] Annotate hardware config module parameters in drivers/media/ |
| Message-ID | <txVEJ-2Kc-9@gated-at.bofh.it> |
| In reply to | #1617204 |
Em Wed, 05 Apr 2017 17:58:41 +0100
David Howells <dhowells@redhat.com> escreveu:
> 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/media/.
>
> Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Acked-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> cc: mjpeg-users@lists.sourceforge.net
> cc: linux-media@vger.kernel.org
> ---
>
> drivers/media/pci/zoran/zoran_card.c | 2 +-
> drivers/media/rc/serial_ir.c | 10 +++++-----
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/pci/zoran/zoran_card.c b/drivers/media/pci/zoran/zoran_card.c
> index 5266755add63..4680f001653a 100644
> --- a/drivers/media/pci/zoran/zoran_card.c
> +++ b/drivers/media/pci/zoran/zoran_card.c
> @@ -69,7 +69,7 @@ MODULE_PARM_DESC(card, "Card type");
> */
>
> static unsigned long vidmem; /* default = 0 - Video memory base address */
> -module_param(vidmem, ulong, 0444);
> +module_param_hw(vidmem, ulong, iomem, 0444);
> MODULE_PARM_DESC(vidmem, "Default video memory base address");
>
> /*
> diff --git a/drivers/media/rc/serial_ir.c b/drivers/media/rc/serial_ir.c
> index 41b54e40176c..40d305842a9b 100644
> --- a/drivers/media/rc/serial_ir.c
> +++ b/drivers/media/rc/serial_ir.c
> @@ -833,11 +833,11 @@ MODULE_LICENSE("GPL");
> module_param(type, int, 0444);
> MODULE_PARM_DESC(type, "Hardware type (0 = home-brew, 1 = IRdeo, 2 = IRdeo Remote, 3 = AnimaX, 4 = IgorPlug");
>
> -module_param(io, int, 0444);
> +module_param_hw(io, int, ioport, 0444);
> MODULE_PARM_DESC(io, "I/O address base (0x3f8 or 0x2f8)");
>
> /* some architectures (e.g. intel xscale) have memory mapped registers */
> -module_param(iommap, bool, 0444);
> +module_param_hw(iommap, bool, other, 0444);
> MODULE_PARM_DESC(iommap, "physical base for memory mapped I/O (0 = no memory mapped io)");
>
> /*
> @@ -845,13 +845,13 @@ MODULE_PARM_DESC(iommap, "physical base for memory mapped I/O (0 = no memory map
> * on 32bit word boundaries.
> * See linux-kernel/drivers/tty/serial/8250/8250.c serial_in()/out()
> */
> -module_param(ioshift, int, 0444);
> +module_param_hw(ioshift, int, other, 0444);
> MODULE_PARM_DESC(ioshift, "shift I/O register offset (0 = no shift)");
>
> -module_param(irq, int, 0444);
> +module_param_hw(irq, int, irq, 0444);
> MODULE_PARM_DESC(irq, "Interrupt (4 or 3)");
>
> -module_param(share_irq, bool, 0444);
> +module_param_hw(share_irq, bool, other, 0444);
> MODULE_PARM_DESC(share_irq, "Share interrupts (0 = off, 1 = on)");
>
> module_param(sense, int, 0444);
>
Thanks,
Mauro
[toc] | [prev] | [next] | [standalone]
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-04-05 19:20 +0200 |
| Subject | [PATCH 08/38] Annotate hardware config module parameters in drivers/gpio/ |
| Message-ID | <tsWL8-5w8-25@gated-at.bofh.it> |
| In reply to | #1617198 |
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/gpio/. Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk> Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> cc: Alexandre Courbot <gnurou@gmail.com> cc: linux-gpio@vger.kernel.org --- drivers/gpio/gpio-104-dio-48e.c | 4 ++-- drivers/gpio/gpio-104-idi-48.c | 4 ++-- drivers/gpio/gpio-104-idio-16.c | 4 ++-- drivers/gpio/gpio-gpio-mm.c | 2 +- drivers/gpio/gpio-ws16c48.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c index 17bd2ab4ebe2..dfa1a298e4f6 100644 --- a/drivers/gpio/gpio-104-dio-48e.c +++ b/drivers/gpio/gpio-104-dio-48e.c @@ -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"); /** diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c index 568375a7ebc2..c369b2083876 100644 --- a/drivers/gpio/gpio-104-idi-48.c +++ b/drivers/gpio/gpio-104-idi-48.c @@ -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"); /** diff --git a/drivers/gpio/gpio-104-idio-16.c b/drivers/gpio/gpio-104-idio-16.c index 7053cf736648..5949123986f2 100644 --- a/drivers/gpio/gpio-104-idio-16.c +++ b/drivers/gpio/gpio-104-idio-16.c @@ -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"); /** diff --git a/drivers/gpio/gpio-gpio-mm.c b/drivers/gpio/gpio-gpio-mm.c index fa4baa2543db..11ade5b288f8 100644 --- a/drivers/gpio/gpio-gpio-mm.c +++ b/drivers/gpio/gpio-gpio-mm.c @@ -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"); /** diff --git a/drivers/gpio/gpio-ws16c48.c b/drivers/gpio/gpio-ws16c48.c index 901b5ccb032d..f8a4f91f36c7 100644 --- a/drivers/gpio/gpio-ws16c48.c +++ b/drivers/gpio/gpio-ws16c48.c @@ -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"); /**
[toc] | [prev] | [next] | [standalone]
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Date | 2017-04-07 12:50 +0200 |
| Subject | Re: [PATCH 08/38] Annotate hardware config module parameters in drivers/gpio/ |
| Message-ID | <ttzCN-5WI-13@gated-at.bofh.it> |
| In reply to | #1617205 |
On Wed, Apr 5, 2017 at 6:57 PM, David Howells <dhowells@redhat.com> wrote: > 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/gpio/. > > Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk> > Signed-off-by: David Howells <dhowells@redhat.com> > Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com> > Acked-by: Linus Walleij <linus.walleij@linaro.org> > cc: Alexandre Courbot <gnurou@gmail.com> > cc: linux-gpio@vger.kernel.org Acked-by: Linus Walleij <linus.walleij@linaro.org> I see that I don't have this symbol in my tree so I guess the patch series adds it and this patch needs to follow it. Yours, Linus Walleij
[toc] | [prev] | [next] | [standalone]
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-04-07 15:00 +0200 |
| Subject | Re: [PATCH 08/38] Annotate hardware config module parameters in drivers/gpio/ |
| Message-ID | <ttBEC-7cJ-25@gated-at.bofh.it> |
| In reply to | #1618673 |
Linus Walleij <linus.walleij@linaro.org> wrote: > I see that I don't have this symbol in my tree so I guess the patch > series adds it and this patch needs to follow it. Yep. Patch #1 adds it. David
[toc] | [prev] | [next] | [standalone]
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-04-05 19:30 +0200 |
| Subject | [PATCH 07/38] Annotate hardware config module parameters in drivers/cpufreq/ |
| Message-ID | <tsWUO-5zn-3@gated-at.bofh.it> |
| In reply to | #1617198 |
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/cpufreq/. Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk> Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: "Rafael J. Wysocki" <rjw@rjwysocki.net> cc: Viresh Kumar <viresh.kumar@linaro.org> cc: linux-pm@vger.kernel.org --- drivers/cpufreq/speedstep-smi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/speedstep-smi.c b/drivers/cpufreq/speedstep-smi.c index 770a9ae1999a..37b30071c220 100644 --- a/drivers/cpufreq/speedstep-smi.c +++ b/drivers/cpufreq/speedstep-smi.c @@ -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);
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-04-10 12:40 +0200 |
| Subject | Re: [PATCH 07/38] Annotate hardware config module parameters in drivers/cpufreq/ |
| Message-ID | <tuETM-7TH-21@gated-at.bofh.it> |
| In reply to | #1617214 |
On 05-04-17, 17:57, David Howells wrote: > 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/cpufreq/. > > Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk> > Signed-off-by: David Howells <dhowells@redhat.com> > Acked-by: "Rafael J. Wysocki" <rjw@rjwysocki.net> > cc: Viresh Kumar <viresh.kumar@linaro.org> > cc: linux-pm@vger.kernel.org > --- > > drivers/cpufreq/speedstep-smi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/speedstep-smi.c b/drivers/cpufreq/speedstep-smi.c > index 770a9ae1999a..37b30071c220 100644 > --- a/drivers/cpufreq/speedstep-smi.c > +++ b/drivers/cpufreq/speedstep-smi.c > @@ -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); > Acked-by: Viresh Kumar <viresh.kumar@linaro.org> -- viresh
[toc] | [prev] | [next] | [standalone]
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-04-05 19:30 +0200 |
| Subject | [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ |
| Message-ID | <tsWUO-5zn-21@gated-at.bofh.it> |
| In reply to | #1617198 |
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/clocksource/. Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk> Signed-off-by: David Howells <dhowells@redhat.com> cc: Daniel Lezcano <daniel.lezcano@linaro.org> cc: Thomas Gleixner <tglx@linutronix.de> cc: linux-kernel@vger.kernel.org --- drivers/clocksource/cs5535-clockevt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clocksource/cs5535-clockevt.c b/drivers/clocksource/cs5535-clockevt.c index 9a7e37cf56b0..a1df588343f2 100644 --- a/drivers/clocksource/cs5535-clockevt.c +++ b/drivers/clocksource/cs5535-clockevt.c @@ -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."); /*
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2017-04-14 20:30 +0200 |
| Subject | Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ |
| Message-ID | <twe8N-4tn-1@gated-at.bofh.it> |
| In reply to | #1617215 |
On Wed, 5 Apr 2017, David Howells wrote: $subject == crap > 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/clocksource/. Sigh. > Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk> > Signed-off-by: David Howells <dhowells@redhat.com> > cc: Daniel Lezcano <daniel.lezcano@linaro.org> > cc: Thomas Gleixner <tglx@linutronix.de> > cc: linux-kernel@vger.kernel.org > --- > > drivers/clocksource/cs5535-clockevt.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/clocksource/cs5535-clockevt.c b/drivers/clocksource/cs5535-clockevt.c > index 9a7e37cf56b0..a1df588343f2 100644 > --- a/drivers/clocksource/cs5535-clockevt.c > +++ b/drivers/clocksource/cs5535-clockevt.c > @@ -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."); I'm not sure about this. AFAIR the parameter is required to work on anything else than some arbitrary hardware which has it mapped to 0. Cc'ed people who might know. Thanks, tglx
[toc] | [prev] | [next] | [standalone]
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-04-15 01:00 +0200 |
| Subject | Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ |
| Message-ID | <twim5-71X-5@gated-at.bofh.it> |
| In reply to | #1623829 |
Thomas Gleixner <tglx@linutronix.de> wrote: > > -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."); > > I'm not sure about this. AFAIR the parameter is required to work on > anything else than some arbitrary hardware which has it mapped to 0. Should it then be set through in-kernel platform initialisation since the AMD Geode is an embedded chip? Btw, is it possible to use IRQ grants to prevent a device that has limited IRQ options from being drivable? David
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2017-04-15 07:50 +0200 |
| Subject | Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ |
| Message-ID | <twoKR-2J8-3@gated-at.bofh.it> |
| In reply to | #1623947 |
On Fri, 14 Apr 2017, David Howells wrote: > Thomas Gleixner <tglx@linutronix.de> wrote: > > > > -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."); > > > > I'm not sure about this. AFAIR the parameter is required to work on > > anything else than some arbitrary hardware which has it mapped to 0. > > Should it then be set through in-kernel platform initialisation since the > AMD Geode is an embedded chip? I think so. > Btw, is it possible to use IRQ grants to prevent a device that has limited IRQ > options from being drivable? What do you mean with 'IRQ grants' ? Thanks tglx
[toc] | [prev] | [next] | [standalone]
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-04-15 08:00 +0200 |
| Subject | Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ |
| Message-ID | <twoUx-2NS-1@gated-at.bofh.it> |
| In reply to | #1624027 |
Thomas Gleixner <tglx@linutronix.de> wrote: > > Btw, is it possible to use IRQ grants to prevent a device that has limited > > IRQ options from being drivable? > > What do you mean with 'IRQ grants' ? request_irq(). David
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2017-04-15 12:00 +0200 |
| Subject | Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ |
| Message-ID | <twsEN-4Zo-1@gated-at.bofh.it> |
| In reply to | #1624028 |
On Sat, 15 Apr 2017, David Howells wrote: > Thomas Gleixner <tglx@linutronix.de> wrote: > > > > Btw, is it possible to use IRQ grants to prevent a device that has limited > > > IRQ options from being drivable? > > > > What do you mean with 'IRQ grants' ? > > request_irq(). I still can't parse the sentence above. If request_irq() fails the device initialization fails. If you request the wrong irq then request_irq() might succeed but the device won't work. Thanks, tglx
[toc] | [prev] | [next] | [standalone]
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-04-18 14:50 +0200 |
| Subject | Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ |
| Message-ID | <txAJX-6e5-3@gated-at.bofh.it> |
| In reply to | #1624041 |
Thomas Gleixner <tglx@linutronix.de> wrote: > > > > Btw, is it possible to use IRQ grants to prevent a device that has limited > > > > IRQ options from being drivable? > > > > > > What do you mean with 'IRQ grants' ? > > > > request_irq(). > > I still can't parse the sentence above. If request_irq() fails the device > initialization fails. If you request the wrong irq then request_irq() might > succeed but the device won't work. I was talking about having using a driver to make request_irq() grant an irq to that driver so that another driver can't bind to its device because all its irq options are taken and the irqs can't be shared. David
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2017-04-18 15:00 +0200 |
| Subject | Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ |
| Message-ID | <txATE-6he-21@gated-at.bofh.it> |
| In reply to | #1625301 |
On Tue, 18 Apr 2017, David Howells wrote:
> Thomas Gleixner <tglx@linutronix.de> wrote:
>
> > > > > Btw, is it possible to use IRQ grants to prevent a device that has limited
> > > > > IRQ options from being drivable?
> > > >
> > > > What do you mean with 'IRQ grants' ?
> > >
> > > request_irq().
> >
> > I still can't parse the sentence above. If request_irq() fails the device
> > initialization fails. If you request the wrong irq then request_irq() might
> > succeed but the device won't work.
>
> I was talking about having using a driver to make request_irq() grant an irq
> to that driver so that another driver can't bind to its device because all its
> irq options are taken and the irqs can't be shared.
Yes. That's possible.
init_driver1()
request_irq(X, flags,.....);
init_driver2()
request_irq(X, flags,.....);
The second driver can fail, when flags are not matching. That might be
disagreement about SHARED or the trigger type, i.e. egde vs. level.
Thanks,
tglx
[toc] | [prev] | [next] | [standalone]
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-04-19 17:40 +0200 |
| Subject | Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ |
| Message-ID | <txZS2-59Y-23@gated-at.bofh.it> |
| In reply to | #1623829 |
Jens Rottmann <Jens.Rottmann@ADLINKtech.com> wrote: > > When the kernel is running in secure boot mode [...] prevent > > access by means of configuring driver modules > > I may easily be wrong, but doesn't secure boot require EFI? For the patches I have, yes. It could feasibly be done by some other mechanism, though I don't know that such an alternative exists. > Do secure boot capable systems with old CS5535/36 even exist? No idea. David
[toc] | [prev] | [next] | [standalone]
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-04-19 17:40 +0200 |
| Subject | Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/ |
| Message-ID | <txZS2-59Y-33@gated-at.bofh.it> |
| In reply to | #1623829 |
Hi Thomas, Thomas Gleixner <tglx@linutronix.de> wrote: > > --- a/drivers/clocksource/cs5535-clockevt.c > > +++ b/drivers/clocksource/cs5535-clockevt.c > > @@ -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."); > > I'm not sure about this. AFAIR the parameter is required to work on > anything else than some arbitrary hardware which has it mapped to 0. > > Cc'ed people who might know. Given what Jens said: Parameter defaults to 0, which means: 1. autodetect (=keep IRQ BIOS has set up) 2. if that fails use CONFIG_CS5535_MFGPT_DEFAULT_IRQ (see drivers/misc/cs5535-mfgpt.c: cs5535_mfgpt_set_irq()) Autodetect works fine for our (ex-LiPPERT, now ADLINK) COTS boards: Linux auto-uses IRQ chosen in BIOS Setup. Wouldn't know about other companies, of course, but (2.) means parameter can be avoided via make menuconfig. are you willing to okay this? David
[toc] | [prev] | [next] | [standalone]
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-04-05 19:30 +0200 |
| Subject | [PATCH 02/38] Annotate hardware config module parameters in arch/x86/mm/ |
| Message-ID | <tsWUO-5zn-13@gated-at.bofh.it> |
| In reply to | #1617198 |
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 arch/x86/mm/. Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk> Signed-off-by: David Howells <dhowells@redhat.com> cc: Steven Rostedt <rostedt@goodmis.org> cc: Ingo Molnar <mingo@kernel.org> cc: Thomas Gleixner <tglx@linutronix.de> cc: "H. Peter Anvin" <hpa@zytor.com> cc: x86@kernel.org cc: linux-kernel@vger.kernel.org cc: nouveau@lists.freedesktop.org --- arch/x86/mm/testmmiotrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/mm/testmmiotrace.c b/arch/x86/mm/testmmiotrace.c index 38868adf07ea..f6ae6830b341 100644 --- a/arch/x86/mm/testmmiotrace.c +++ b/arch/x86/mm/testmmiotrace.c @@ -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).");
[toc] | [prev] | [next] | [standalone]
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Date | 2017-04-05 19:40 +0200 |
| Subject | Re: [PATCH 02/38] Annotate hardware config module parameters in arch/x86/mm/ |
| Message-ID | <tsX4u-5CF-29@gated-at.bofh.it> |
| In reply to | #1617216 |
On Wed, 05 Apr 2017 17:57:08 +0100 David Howells <dhowells@redhat.com> wrote: > 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 arch/x86/mm/. > > Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk> > Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> -- Steve > cc: Ingo Molnar <mingo@kernel.org> > cc: Thomas Gleixner <tglx@linutronix.de> > cc: "H. Peter Anvin" <hpa@zytor.com> > cc: x86@kernel.org > cc: linux-kernel@vger.kernel.org > cc: nouveau@lists.freedesktop.org > --- > > arch/x86/mm/testmmiotrace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/mm/testmmiotrace.c b/arch/x86/mm/testmmiotrace.c > index 38868adf07ea..f6ae6830b341 100644 > --- a/arch/x86/mm/testmmiotrace.c > +++ b/arch/x86/mm/testmmiotrace.c > @@ -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)."); >
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.kernel
csiph-web