From: Daniel De Graaf Subject: Re: [PATCH] xsm_remove_from_physmap is (so far) only defined for X86 architecture, not for ARM Date: Thu, 17 Jan 2013 12:13:50 -0500 Message-ID: <50F8314E.3060002@tycho.nsa.gov> References: <1357922782.20328.151.camel@zakaz.uk.xensource.com> <50F04DBF.60702@tycho.nsa.gov> <1358248725.15691.57.camel@zakaz.uk.xensource.com> <50F5691B.1020805@tycho.nsa.gov> <1358442302.13856.98.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1358442302.13856.98.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: Lars Rasmusson , "Tim (Xen.org)" , Stefano Stabellini , "Keir (Xen.org)" , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On 01/17/2013 12:05 PM, Ian Campbell wrote: > On Tue, 2013-01-15 at 14:35 +0000, Daniel De Graaf wrote: >> The rest of the changes look correct. The #ifdefs are a bit ugly, but >> refactoring the MSI code into an arch-specific function should fix >> that. > > I've just sent out a new patch which takes are of only the build failure > on ARM with XSM disabled. > > For fixing the flask build on ARM: what does security_device_sid return? > If I want to refactor this: > #ifdef CONFIG_X86 > if ( desc->msi_desc ) { > struct pci_dev *dev = desc->msi_desc->dev; > u32 sbdf = (dev->seg << 16) | (dev->bus << 8) | dev->devfn; > if (ad) { > AVC_AUDIT_DATA_INIT(ad, DEV); > ad->device = sbdf; > } > return security_device_sid(sbdf, sid); > } > #endif > into an arch specific function I need to be able to return something in > the !desc->msi_desc case. Can a sid be any integer or could I return > e.g. 0 in this case? > > Ian. > There are some reserved sids that might be useful here (SECINITSID_UNLABELED if this case shouldn't be encountered). Zero might be the most suitable value, since zero is not a valid sid and can be used to indicate "unable to resolve". Zero will be treated as the unlabeled SID if passed to avc_has_perm. security_device_sid returns either SECINITSID_DEVICE or the assigned SID of the requested PCI device (as indexed by its sbdf number, and set either in XSM policy or by flask-label-pci). -- Daniel De Graaf National Security Agency