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: <20130125041411.GB12562@kroah.com>
Date:	Thu, 24 Jan 2013 20:14:11 -0800
From:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:	Bjorn Helgaas <bhelgaas@...gle.com>
Cc:	Joonsoo Kim <iamjoonsoo.kim@....com>,
	"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org,
	x86@...nel.org, Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH] x86, reboot: skip reboot_fixups in early boot phase

On Thu, Jan 24, 2013 at 07:59:01PM -0700, Bjorn Helgaas wrote:
> [+cc Greg for driver core]
> 
> On Fri, Jan 25, 2013 at 10:13:03AM +0900, Joonsoo Kim wrote:
> > Hello, Bjorn.
> > 
> > On Thu, Jan 24, 2013 at 10:45:13AM -0700, Bjorn Helgaas wrote:
> > > On Fri, Dec 28, 2012 at 6:50 AM, Joonsoo Kim <js1304@...il.com> wrote:
> > > > During early boot phase, PCI bus subsystem is not yet initialized.
> > > > If panic is occured in early boot phase and panic_timeout is set,
> > > > code flow go into emergency_restart() and hit mach_reboot_fixups(), then
> > > > encounter another panic. When second panic, we can't hold a panic_lock, so
> > > > code flow go into panic_smp_self_stop() which prevent system to restart.
> > > >
> > > > For avoid second panic, skip reboot_fixups in early boot phase.
> > > > It makes panic_timeout works in early boot phase.
> > > >
> > > > Cc: Thomas Gleixner <tglx@...utronix.de>
> > > > Cc: Ingo Molnar <mingo@...hat.com>
> > > > Cc: "H. Peter Anvin" <hpa@...or.com>
> > > > Signed-off-by: Joonsoo Kim <js1304@...il.com>
> > > >
> > > > diff --git a/arch/x86/kernel/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c
> > > > index c8e41e9..b9b8ec9 100644
> > > > --- a/arch/x86/kernel/reboot_fixups_32.c
> > > > +++ b/arch/x86/kernel/reboot_fixups_32.c
> > > > @@ -89,6 +89,10 @@ void mach_reboot_fixups(void)
> > > >         if (in_interrupt())
> > > >                 return;
> > > >
> > > > +       /* During early boot phase, PCI is not yet initialized */
> > > > +       if (system_state == SYSTEM_BOOTING)
> > > > +               return;
> > > > +
> > > >         for (i=0; i < ARRAY_SIZE(fixups_table); i++) {
> > > >                 cur = &(fixups_table[i]);
> > > >                 dev = pci_get_device(cur->vendor, cur->device, NULL);
> > > 
> > > I guess you're saying that if we call pci_get_device() too early, it
> > > panics?  Did you figure out why that happens?
> > > 
> > > If we call pci_get_device() before PCI has been initialized, it would
> > > be good if it just returned NULL, indicating that we didn't find any
> > > matching device.  I looked briefly, and I thought that's what would
> > > happen, but apparently I'm missing something.
> > 
> > In bus_find_device(), klist_iter_init_node() is called with 
> > @bus->p->klist_device. Before initialization, bus->p is NULL,
> > so panic is occured.
> 
> I see.  pci_bus_type.p is initialized by __bus_register() in this path:
> 
>   pci_driver_init        # postcore_initcall
>     bus_register(&pci_bus_type)
>       __bus_register
>         priv = kzalloc(sizeof(struct subsys_private))
> 	bus->p = priv
> 	klist_init(&priv->klist_devices, klist_devices_get, klist_devices_put)
> 
> I was hoping we could statically initialize the klist, but that doesn't
> seem likely.
> 
> But I wonder if we could do something like the following.  If we could,
> then callers wouldn't have to worry about whether or not the bus has been
> initialized.

<snip>

I have no objection to that patch, but really, someone wants to call
pci_find_device() before PCI is initialized?  Can't that be fixed
instead, as that is the root problem, not the driver core.

But, to paper over your subsystem's bugs, I guess I can take it :)

Care to resend it in a format that I can apply it in?

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