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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 3 Sep 2012 16:50:10 +0200
From:	Sjur Brændeland <sjurbren@...il.com>
To:	"Michael S. Tsirkin" <mst@...hat.com>
Cc:	Rusty Russell <rusty@...tcorp.com.au>,
	linux-kernel@...r.kernel.org,
	"Guzman Lugo, Fernadndo" <fernando.lugo@...com>,
	virtualization@...ts.linux-foundation.org,
	Ohad Ben-Cohen <ohad@...ery.com>
Subject: Re: [PATCH] virtio: Don't access device data after unregistration.

Hi Michael,

>> Fix panic in virtio.c when CONFIG_DEBUG_SLAB is set.
>
> What's the root cause of the panic?

I believe the cause of the panic is calling
ida_simple_remove(&virtio_index_ida, dev->index);
when the dev structure is "poisoned" after kfree.
It might be the "BUG_ON((int)id < 0)" that bites...

>> Use device_del() and put_device() instead of
>> device_unregister(), and access device data before
>> calling put_device().

> Why does this help? Does device_unregister free the
> device so dev->index access crashes?

Yes, if device ref-count is one when calling unregister
the device is freed.

> If yes virtio_pci_remove will crash too
> as it accesses the device after the
> call to unregister_virtio_device so the
> fix won't be effective.

I discovered this using the remoteproc framework.
It might be that device is unregistered with ref-count greater
than one normally, in that case this bug will not show up.

Regards,
Sjur
--
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