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]
Message-ID: <20180522123829.4e758646@w520.home>
Date:   Tue, 22 May 2018 12:38:29 -0600
From:   Alex Williamson <alex.williamson@...hat.com>
To:     Halil Pasic <pasic@...ux.ibm.com>
Cc:     kwankhede@...dia.com, Dong Jia <bjsdjshi@...ux.vnet.ibm.com>,
        kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        cohuck@...hat.com
Subject: Re: [PATCH v4 0/2] vfio/mdev: Device namespace protection

On Tue, 22 May 2018 19:17:07 +0200
Halil Pasic <pasic@...ux.ibm.com> wrote:

>  From vfio-ccw perspective I join Connie's assessment: vfio-ccw should
> be fine with these changes. I'm however not too deeply involved with
> the mdev framework, thus I don't feel comfortable r-b-ing. That results
> in
> Acked-by: Halil Pasic <pasic@...ux.ibm.com>
> for both patches.
> 
> While at it I have would like to ask about the semantics and intended
> use of the mdev interfaces.
> 
> static int vfio_ccw_sch_probe(struct subchannel *sch)
> {
> 
> /* HALIL: 8< Not so interesting stuff happens here. >8 */

This was interesting:

	private->state = VFIO_CCW_STATE_NOT_OPER;

>          ret = vfio_ccw_mdev_reg(sch);
>          if (ret)
>                  goto out_disable;
> /*
>   * HALIL:  
>   * This might be racy. Somewhere in vfio_ccw_mdev_reg() the create attribute
>   * is made available (it calls mdev_register_device()). For instance create will
>   * attempt to decrement private->avail which is initialized below. I fail to
>   * understand how is  this well synchronized.
>   */
>          INIT_WORK(&private->io_work, vfio_ccw_sch_io_todo);
>          atomic_set(&private->avail, 1);
>          private->state = VFIO_CCW_STATE_STANDBY;
> 
>          return 0;
> 
> out_disable:
>          cio_disable_subchannel(sch);
> out_free:
>          dev_set_drvdata(&sch->dev, NULL);
>          kfree(private);
>          return ret;
> }
> 
> Should not initialization  of go before mdev_register_device(), and then rolled
> back if necessary if mdev_register_device() fails?
> 
> In practice it does not seem very likely that userspace can trigger
> mdev_device_create() before vfio_ccw_sch_probe() finishes so it should
> not be a practical problem. But I would like to understand how synchronization
> is supposed to work.
> 
> [Added Dong Jia, maybe he is also able to answer my question.]

vfio_ccw_mdev_create() requires that private->state is not
VFIO_CCW_STATE_NOT_OPER but vfio_ccw_sch_probe() explicitly sets state
to this value before calling vfio_ccw_mdev_reg(), so a create should
return -ENODEV if racing with parent registration.  Is there something
else that I'm missing?  Thanks,

Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ