Re: [PATCH v2] device-assignment: chmod the rom file before opening read/write

2011-01-05 Thread Avi Kivity
On 01/04/2011 08:45 PM, Alex Williamson wrote: The PCI sysfs rom file is exposed read-only by default, but we need to write to it to enable and disable the ROM around the read. When running as root, the code works fine as is, but when running de-privileged via libvirt, the fopen(r+) will fail

Re: [PATCH v2] device-assignment: chmod the rom file before opening read/write

2011-01-05 Thread Alex Williamson
On Wed, 2011-01-05 at 10:57 +0200, Avi Kivity wrote: On 01/04/2011 08:45 PM, Alex Williamson wrote: The PCI sysfs rom file is exposed read-only by default, but we need to write to it to enable and disable the ROM around the read. When running as root, the code works fine as is, but when

Re: [PATCH v2] device-assignment: chmod the rom file before opening read/write

2011-01-05 Thread Avi Kivity
On 01/05/2011 04:57 PM, Alex Williamson wrote: A valid argument. I think it could also be argued that the user is providing ownership of the file and writing to the file is part of the low level details of the sysfs rom file API and should be handled by the user of that API. We basically have

Re: [PATCH v2] device-assignment: chmod the rom file before opening read/write

2011-01-05 Thread Daniel P. Berrange
On Wed, Jan 05, 2011 at 05:14:55PM +0200, Avi Kivity wrote: On 01/05/2011 04:57 PM, Alex Williamson wrote: A valid argument. I think it could also be argued that the user is providing ownership of the file and writing to the file is part of the low level details of the sysfs rom file API and

Re: [PATCH v2] device-assignment: chmod the rom file before opening read/write

2011-01-05 Thread Alex Williamson
On Wed, 2011-01-05 at 17:14 +0200, Avi Kivity wrote: On 01/05/2011 04:57 PM, Alex Williamson wrote: A valid argument. I think it could also be argued that the user is providing ownership of the file and writing to the file is part of the low level details of the sysfs rom file API and

Re: [PATCH v2] device-assignment: chmod the rom file before opening read/write

2011-01-05 Thread Alex Williamson
On Wed, 2011-01-05 at 15:26 +, Daniel P. Berrange wrote: On Wed, Jan 05, 2011 at 05:14:55PM +0200, Avi Kivity wrote: On 01/05/2011 04:57 PM, Alex Williamson wrote: A valid argument. I think it could also be argued that the user is providing ownership of the file and writing to the file

[PATCH v2] device-assignment: chmod the rom file before opening read/write

2011-01-04 Thread Alex Williamson
The PCI sysfs rom file is exposed read-only by default, but we need to write to it to enable and disable the ROM around the read. When running as root, the code works fine as is, but when running de-privileged via libvirt, the fopen(r+) will fail if the file doesn't have owner write permissions.