[SLOF] [PATCH slof] virtio-serial: Close device completely

Greg Kurz groug at kaod.org
Tue Mar 10 08:28:22 AEDT 2020


On Fri, 6 Mar 2020 11:12:43 +0100
Greg Kurz <groug at kaod.org> wrote:

> On Fri,  6 Mar 2020 15:39:33 +1100
> Alexey Kardashevskiy <aik at ozlabs.ru> wrote:
> 
> > Linux closes stdout at the end of prom_init which triggers the FW quiesce
> > code which closes the virtio-serial instance. This misses stopping
> > the virtio queues, clearing the "emit" token and other things. However
> > this seemed working for a little longer (until the Linux driver took over)
> > till 0cdb2dd13c3e which moved the VQ descriptors around which caused
> > use-after-free corruption.
> > 
> > This adds virtio_queue_term_vq(), cleanup in the forth driver, few checks
> > and reverts emit to hvterm-emit.
> > 
> > Fixes: 0cdb2dd13c3e ("virtio: Store queue descriptors in virtio_device")
> 
> SHA1 is wrong.
> 
> https://git.qemu.org/?p=SLOF.git;a=commit;h=300384f3dc68588a051f5737aee3b5eab4dd19e4
> 
> > Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
> > ---
> > 
> > Turns out it is close(stdout) what triggers quiesce, not the client
> > interface's "quiesce".
> > 
> 
> Yeah I discovered that while trying to debug :)
> 

It turns out to be close(stdin) actually:

commit ac2fc97106aab80f842144968884e1dbe09c47eb
Author: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
Date:   Wed Jul 24 14:27:32 2013 +0530

    slof: call quiesce on closing of stdin
    
    As quiesce is not a standard interface which is not what everybody
    supports. Now make quiesce call when the stdin is closed. This makes
    sure that the inteface is call always and is not dependent on OS
    calling quiesce.
    
    Signed-off-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
    Acked-by: Thomas Huth <thuth at linux.vnet.ibm.com>

Triggered by this in prom_init():

	/*
	 * in case stdin is USB and still active on IBM machines...
	 * Unfortunately quiesce crashes on some powermacs if we have
	 * closed stdin already (in particular the powerbook 101).
	 */
	if (of_platform != PLATFORM_POWERMAC)
		prom_close_stdin();


More information about the SLOF mailing list