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]
Date:	Thu, 18 Jun 2015 10:14:40 +0200
From:	Gerd Hoffmann <kraxel@...hat.com>
To:	"Michael S. Tsirkin" <mst@...hat.com>
Cc:	"open list:VIRTIO CORE, NET..." 
	<virtualization@...ts.linux-foundation.org>,
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] virtio-pci: alloc only resources actually used.

  Hi,

> > +static struct resource *request_capability(struct pci_dev *dev, int off,
> > +					   const char *name)
> > +{
> > +	u8 bar;
> > +	u32 offset, length;
> > +
> > +	pci_read_config_byte(dev, off + offsetof(struct virtio_pci_cap,
> > +						 bar),
> > +			     &bar);
> > +	pci_read_config_dword(dev, off + offsetof(struct virtio_pci_cap, offset),
> > +			     &offset);
> > +	pci_read_config_dword(dev, off + offsetof(struct virtio_pci_cap, length),
> > +			      &length);
> > +
> > +	return request_mem_region(pci_resource_start(dev, bar) + offset,
> > +				  length, name);
> > +}
> > +
> 
> For device config, this might request too much. The spec says:
> 	The drivers SHOULD only map part of configuration structure large enough
> 	for device operation.

We don't map it here though.  We just reserve what belongs to virtio
according to the capabilities.

> I think you should limit this to PAGE_SIZE like we do for map_capability.

notify is much larger than PAGE_SIZE.

> >  	err = -EINVAL;
> >  	vp_dev->common = map_capability(pci_dev, common,
> >  					sizeof(struct virtio_pci_common_cfg), 4,
> 
> map_capability has a bunch of checks in place to validate the capability
> structure. With request_capability called earlier, they are now done too
> late.

Hmm, lets move the checks to find_capability then?

cheers,
  Gerd


--
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