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: <CAOmrzk+bY5wUxJhNAwO-pf+O--HiqJ63rB3BmxRsY8qq_PeLmw@mail.gmail.com>
Date:   Mon, 7 May 2018 09:51:12 +1200
From:   Michael Schmitz <schmitzmic@...il.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Finn Thain <fthain@...egraphics.com.au>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        "Linux/m68k" <linux-m68k@...ts.linux-m68k.org>,
        Linux Kernel Development <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] nubus: Unconditionally register bus type

Hi Greg,

the BUG() was triggered by loading a Mac Nubus network card module on
a multiplatform kernel running on an Amiga machine. Up to Finn's Nubus
core rewrite (this February), we've seen no errors. Since then, Nubus
drivers fail to register because the Nubus bus is only registered on
Macs.

Can't see link order involved here at all.

Safeguarding against this bug could be done by checking a
bus-is-registered flag, or checking what machine model the kernel runs
on. Simply registering the Nubus bus driver regardless of machine
model seemed the easiest way.

Cheers,

  Michael


On Mon, May 7, 2018 at 8:20 AM, Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
> On Sun, May 06, 2018 at 04:00:15PM +1000, Finn Thain wrote:
>> On Sat, 5 May 2018, Greg Kroah-Hartman wrote:
>>
>> > On Sun, May 06, 2018 at 11:47:52AM +1000, Finn Thain wrote:
>> > > Loading a NuBus driver module on a non-NuBus machine triggers the
>> > > BUG_ON(!drv->bus->p) in driver_register() because the bus does not get
>> > > registered unless MACH_IS_MAC(). Avoid this by registering the bus
>> > > unconditionally using postcore_initcall().
>> > >
>> > > Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
>> > > Reported-by: Michael Schmitz <schmitzmic@...il.com>
>> > > Tested-by: Stan Johnson <userm57@...oo.com>
>> > > Fixes: 7f86c765a6a2 ("nubus: Add support for the driver model")
>> > > Signed-off-by: Finn Thain <fthain@...egraphics.com.au>
>> > > ---
>> > >  drivers/nubus/bus.c   | 3 ++-
>> > >  drivers/nubus/nubus.c | 5 -----
>> > >  include/linux/nubus.h | 1 -
>> > >  3 files changed, 2 insertions(+), 7 deletions(-)
>> > >
>> > > diff --git a/drivers/nubus/bus.c b/drivers/nubus/bus.c
>> > > index d306c348c857..27ca9f1a281b 100644
>> > > --- a/drivers/nubus/bus.c
>> > > +++ b/drivers/nubus/bus.c
>> > > @@ -63,7 +63,7 @@ static struct device nubus_parent = {
>> > >   .init_name      = "nubus",
>> > >  };
>> > >
>> > > -int __init nubus_bus_register(void)
>> > > +static int __init nubus_bus_register(void)
>> > >  {
>> > >   int err;
>> > >
>> > > @@ -78,6 +78,7 @@ int __init nubus_bus_register(void)
>> > >   device_unregister(&nubus_parent);
>> > >   return err;
>> > >  }
>> > > +postcore_initcall(nubus_bus_register);
>> >
>> > Why not just have an "bus is registered" flag in your driver register
>> > function that refuses to let drivers register with the driver core if it
>> > isn't set?
>>
>> Perhaps that should happen in the core driver_register() function. BUG_ON
>> is frowned upon, after all. Would that be acceptable?
>
> I don't understand what you mean here, perhaps make a patch to show it?
>
>> I found a few drivers that set a flag the way you describe, which could
>> then be simplified.
>>
>> But that pattern is rare. Most buses use the postcore_initcall() pattern,
>> and so my patch took the conventional approach.
>
> It all depends on link order, not necessarily the postcore stuff.
>
>> > And then fix your linking error, the bus should come first in link
>> > order, before your drivers :)
>> >
>>
>> I didn't encounter any errors. How shall I reproduce this?
>
> If you have not seen this error, then why change the code at all if it
> is working properly?  Most busses do not need this as they have their
> link order set up correctly, no need to mess with stuff that is not
> broken :)
>
> thanks,
>
> greg k-h
> --
> To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ