lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090711033459.GC1344@suse.de>
Date:	Fri, 10 Jul 2009 20:34:59 -0700
From:	Greg KH <gregkh@...e.de>
To:	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] platform_driver_register:  warn if probe is in
 .init.text

On Mon, Jun 29, 2009 at 09:55:35AM +0200, Uwe Kleine-König wrote:
> Hi Greg,
> 
> On Fri, Jun 19, 2009 at 04:43:54PM +0200, Uwe Kleine-König wrote:
> > On Fri, Jun 19, 2009 at 07:11:28AM -0700, Greg KH wrote:
> > > On Fri, Jun 19, 2009 at 03:42:19PM +0200, Uwe Kleine-König wrote:
> > > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
> > > > ---
> > > >  drivers/base/platform.c |   42 ++++++++++++++++++++++++++++++++++++------
> > > >  include/linux/kernel.h  |    2 ++
> > > >  include/linux/module.h  |   12 ++++++++++++
> > > >  kernel/extable.c        |   12 ++++++++++++
> > > >  kernel/module.c         |   36 ++++++++++++++++++++++++++++++++++++
> > > >  5 files changed, 98 insertions(+), 6 deletions(-)
> > > > 
> > > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> > > > index 81cb01b..851ba84 100644
> > > > --- a/drivers/base/platform.c
> > > > +++ b/drivers/base/platform.c
> > > > @@ -470,11 +470,7 @@ static void platform_drv_shutdown(struct device *_dev)
> > > >  	drv->shutdown(dev);
> > > >  }
> > > >  
> > > > -/**
> > > > - * platform_driver_register
> > > > - * @drv: platform driver structure
> > > > - */
> > > > -int platform_driver_register(struct platform_driver *drv)
> > > > +static int __platform_driver_register(struct platform_driver *drv)
> > > >  {
> > > >  	drv->driver.bus = &platform_bus_type;
> > > >  	if (drv->probe)
> > > > @@ -489,6 +485,40 @@ int platform_driver_register(struct platform_driver *drv)
> > > >  
> > > >  	return driver_register(&drv->driver);
> > > >  }
> > > > +
> > > > +/**
> > > > + * platform_driver_register
> > > > + * @drv: platform driver structure
> > > > + */
> > > > +int platform_driver_register(struct platform_driver *drv)
> > > > +{
> > > > +	int ret = __platform_driver_register(drv);
> > > > +
> > > > +#if defined(CONFIG_HOTPLUG)
> > > > +	/*
> > > > +	 * drivers that are registered by platform_driver_register
> > > > +	 * should not have their probe function in .init.text.  The
> > > > +	 * reason is that a probe can happen after .init.text is
> > > > +	 * discarded which then results in an oops.  The alternatives
> > > > +	 * are using .devinit.text for the probe function or "register"
> > > > +	 * with platform_driver_probe.
> > > > +	 */
> > > 
> > > That's not true, remember, drivers built into the system, like platform
> > > ones, can have their probe function in .init.text, as it will be called
> > > before we discard .init.text, and will never be called again as the
> > > device will never be "hot added" at any future time.
> > > 
> > > So this could trigger a lot of false positives :(
> > IMHO this is not a false positive.  You can still do
> > 
> > 	for f in unbind bind do echo $deviceid > /sys/bus/platform/drivers/$drivername/$f; done
> > 
> > This type of driver should use platform_driver_probe.
> Are you conviced and took the patch or did you give up to convince me?

Heh, no, sorry, it got burried in my queue.

> I still think the patch is correct and I'd like to have it applied.

Ok, let's test it out in the linux-next tree for a while to make sure it
works properly.  Care to send me an updated version?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ