Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1623829 > unrolled thread

Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/

Started byThomas Gleixner <tglx@linutronix.de>
First post2017-04-14 20:30 +0200
Last post2017-04-19 17:40 +0200
Articles 9 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#1623829 — Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/

FromThomas Gleixner <tglx@linutronix.de>
Date2017-04-14 20:30 +0200
SubjectRe: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/
Message-ID<twe8N-4tn-1@gated-at.bofh.it>
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] | [next] | [standalone]


#1623947 — Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/

FromDavid Howells <dhowells@redhat.com>
Date2017-04-15 01:00 +0200
SubjectRe: [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]


#1624027

FromThomas Gleixner <tglx@linutronix.de>
Date2017-04-15 07:50 +0200
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]


#1624028 — Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/

FromDavid Howells <dhowells@redhat.com>
Date2017-04-15 08:00 +0200
SubjectRe: [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]


#1624041

FromThomas Gleixner <tglx@linutronix.de>
Date2017-04-15 12:00 +0200
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]


#1625301 — Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/

FromDavid Howells <dhowells@redhat.com>
Date2017-04-18 14:50 +0200
SubjectRe: [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]


#1625308

FromThomas Gleixner <tglx@linutronix.de>
Date2017-04-18 15:00 +0200
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]


#1626391 — Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/

FromDavid Howells <dhowells@redhat.com>
Date2017-04-19 17:40 +0200
SubjectRe: [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]


#1626401 — Re: [PATCH 06/38] Annotate hardware config module parameters in drivers/clocksource/

FromDavid Howells <dhowells@redhat.com>
Date2017-04-19 17:40 +0200
SubjectRe: [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] | [standalone]


Back to top | Article view | linux.kernel


csiph-web