aboutsummaryrefslogtreecommitdiffstats
path: root/tools/flask/policy
Commit message (Collapse)AuthorAgeFilesLines
* Add DOMCTL to limit the number of event channels a domain may useDavid Vrabel2013-10-142-2/+2
| | | | | | | | | | | | | | | Add XEN_DOMCTL_set_max_evtchn which may be used during domain creation to set the maximum event channel port a domain may use. This may be used to limit the amount of Xen resources (global mapping space and xenheap) that a domain may use for event channels. A domain that does not have a limit set may use all the event channels supported by the event channel ABI in use. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Keir Fraser <keir@xen.org>
* flask: use DESTDIR directly in install target rulesVadim A. Misbakh-Soloviov2013-08-021-3/+3
| | | | | | | | | | 30.07.2013 13:51, Ian Campbell wrote: > I think it would be a bit less surprising for drive by patchers etc to > remove the DESTDIR from POLICY_LOADPATH and add it to the install > target, which is the usual way to do things. Up to you/Vadim though. Signed-off-by: Vadim A. Misbakh-Soloviov <mva@mva.name> Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
* flask: avoid installing policy file as '/boot'Vadim A. Misbakh-Soloviov2013-08-021-0/+1
| | | | | Signed-off-by: Vadim A. Misbakh-Soloviov <mva@mva.name> Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
* flask/policy: device model stubdom fixesDaniel De Graaf2013-06-121-1/+1
| | | | | | | | | This fixes framebuffer support for device model stubdoms after 3f28d007 which added the target_hack permission but did not allow the permission to the stubdom it was created for. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xsm: add hooks for claimDaniel De Graaf2013-05-071-1/+1
| | | | | | | | | | | Adds XSM hooks for the recently introduced XENMEM_claim_pages and XENMEM_get_outstanding_pages operations, and adds FLASK access vectors for them. This makes the access control decisions for these operations match those in the rest of the hypervisor. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> (for 4.3 release) Acked-by: Keir Fraser <keir@xen.org>
* x86/hvm: convert access check for nested HVM to XSMDaniel De Graaf2013-04-231-1/+2
| | | | | | | | | | | | This adds an XSM hook for enabling nested HVM support, replacing an IS_PRIV check. This hook is a partial duplicate with the xsm_hvm_param hook, but using the existing hook would require adding the index to the hook and would require the use of a custom hook for the xsm-disabled case (using XSM_OTHER, which is less immediately readable) - whereas adding a new hook retains the clarity of the existing code. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> (release perspective)
* xen: allow for explicitly specifying node-affinityDario Faggioli2013-04-173-6/+6
| | | | | | | | | | | | | | | Make it possible to pass the node-affinity of a domain to the hypervisor from the upper layers, instead of always being computed automatically. Note that this also required generalizing the Flask hooks for setting and getting the affinity, so that they now deal with both vcpu and node affinity. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com> Acked-by: Keir Fraser <keir@xen.org>
* flask/policy: rework policy build systemDaniel De Graaf2013-02-226-153/+96
| | | | | | | | This adds the ability to define security classes and access vectors in FLASK policy not defined by the hypervisor, for the use of stub domains or applications without their own security policies. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
* flask/policy: sort dom0 accessesDaniel De Graaf2013-02-221-12/+48
| | | | | | | | For the example policy shipped with Xen, it makes sense to allow dom0 access to all system calls so that policy does not need to be updated for each new hypervisor or toolstack feature used. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
* xen/xsm: distinguish scheduler get/set operationsDaniel De Graaf2013-01-112-5/+5
| | | | | | | | Add getscheduler and setscheduler permissions to replace the monolithic scheduler permission in the scheduler_op domctl and sysctl. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* tmem: add XSM hooksDaniel De Graaf2013-01-111-1/+4
| | | | | | | | | | | This adds a pair of XSM hooks for tmem operations: xsm_tmem_op which controls any use of tmem, and xsm_tmem_control which allows use of the TMEM_CONTROL operations. By default, all domains can use tmem while only IS_PRIV domains can use control operations. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com> Committed-by: Keir Fraser <keir@xen.org>
* xen: add XSM hook for XENMEM_exchangeDaniel De Graaf2013-01-111-0/+2
| | | | | Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* arch/x86: use XSM hooks for get_pg_owner access checksDaniel De Graaf2013-01-112-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are three callers of get_pg_owner: * do_mmuext_op, which does not have XSM hooks on all subfunctions * do_mmu_update, which has hooks that are inefficient * do_update_va_mapping_otherdomain, which has a simple XSM hook In order to preserve return values for the do_mmuext_op hypercall, an additional XSM hook is required to check the operation even for those subfunctions that do not use the pg_owner field. This also covers the MMUEXT_UNPIN_TABLE operation which did previously have an XSM hook. The XSM hooks in do_mmu_update were capable of replacing the checks in get_pg_owner; however, the hooks are buried in the inner loop of the function - not very good for performance when XSM is enabled and these turn in to indirect function calls. This patch removes the PTE from the hooks and replaces it with a bitfield describing what accesses are being requested. The XSM hook can then be called only when additional bits are set instead of once per iteration of the loop. This patch results in a change in the FLASK permissions used for mapping an MMIO page: the target for the permisison check on the memory mapping is no longer resolved to the device-specific type, and is instead either the domain's own type or domio_t (depending on if the domain uses DOMID_SELF or DOMID_IO in the map command). Device-specific access is still controlled via the "resource use" permisison checked at domain creation (or device hotplug). Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Jan Beulich <jbeulich@suse.com> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Keir Fraser <keir@xen.org>
* xsm/flask: add distinct SIDs for self/target accessDaniel De Graaf2013-01-112-15/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because the FLASK XSM module no longer checks IS_PRIV for remote domain accesses covered by XSM permissions, domains now have the ability to perform memory management and other functions on all domains that have the same type. While it is possible to prevent this by only creating one domain per type, this solution significantly limits the flexibility of the type system. This patch introduces a domain type transition to represent a domain that is operating on itself. In the example policy, this is demonstrated by creating a type with _self appended when declaring a domain type which will be used for reflexive operations. AVCs for a domain of type domU_t will look like the following: scontext=system_u:system_r:domU_t tcontext=system_u:system_r:domU_t_self This change also allows policy to distinguish between event channels a domain creates to itself and event channels created between domains of the same type. The IS_PRIV_FOR check used for device model domains is also no longer checked by FLASK; a similar transition is performed when the target is set and used when the device model accesses its target domain. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* xsm/flask: add missing hooksDaniel De Graaf2013-01-111-1/+3
| | | | | | | | The FLASK module was missing implementations of some hooks and did not have access vectors defined for 10 domctls; define these now. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* xsm: Move flask policy files into hypervisor (missed from earlier commit).Keir Fraser2013-01-115-448/+0
| | | | | | | | | | | Signed-off-by: Keir Fraser <keir@xen.org> --HG-- rename : tools/flask/policy/policy/flask/access_vectors => xen/xsm/flask/policy/access_vectors rename : tools/flask/policy/policy/flask/initial_sids => xen/xsm/flask/policy/initial_sids rename : tools/flask/policy/policy/flask/mkaccess_vector.sh => xen/xsm/flask/policy/mkaccess_vector.sh rename : tools/flask/policy/policy/flask/mkflask.sh => xen/xsm/flask/policy/mkflask.sh rename : tools/flask/policy/policy/flask/security_classes => xen/xsm/flask/policy/security_classes
* flask: move policy headers into hypervisorDaniel De Graaf2013-01-104-47/+6
| | | | | | | | | | Rather than keeping around headers that are autogenerated in order to avoid adding build dependencies from xen/ to files in tools/, move the relevant parts of the FLASK policy into the hypervisor tree and generate the headers as part of the hypervisor's build. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* libxl: introduce XSM relabel on buildDaniel De Graaf2012-12-132-13/+53
| | | | | | | | | | | | | | | | | | | | | | Allow a domain to be built under one security label and run using a different label. This can be used to prevent the domain builder or control domain from having the ability to access a guest domain's memory via map_foreign_range except during the build process where this is required. Example domain configuration snippet: seclabel='customer_1:vm_r:nomigrate_t' init_seclabel='customer_1:vm_r:nomigrate_t_building' Note: this does not provide complete protection from a malicious dom0; mappings created during the build process may persist after the relabel, and could be used to indirectly access the guest's memory. However, if dom0 correctly unmaps the domain upon building, a the domU is protected against dom0 becoming malicious in the future. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xsm/flask: add domain relabel supportDaniel De Graaf2012-09-173-1/+9
| | | | | | | | | | | | | | | | This adds the ability to change a domain's XSM label after creation. The new label will be used for all future access checks; however, existing event channels and memory mappings will remain valid even if their creation would be denied by the new label. With appropriate security policy and hooks in the domain builder, this can be used to create domains that the domain builder does not have access to after building. It can also be used to allow a domain to drop privileges - for example, prior to launching a user-supplied kernel loaded by a pv-grub stubdom. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* xsm/flask: remove unneeded create_sid fieldDaniel De Graaf2012-09-171-2/+0
| | | | | | | | | This field was only used to populate the ssid of dom0, which can be handled explicitly in the domain creation hook. This also removes the unnecessary permission check on the creation of dom0. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* xsm/flask: remove inherited class attributesDaniel De Graaf2012-09-173-106/+2
| | | | | | | | | | | The ability to declare common permission blocks shared across multiple classes is not currently used in Xen. Currently, support for this feature is broken in the header generation scripts, and it is not expected that this feature will be used in the future, so remove the dead code. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* flask/policy: add accesses used by newer dom0sDaniel De Graaf2012-08-222-3/+3
| | | | | Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* flask/policy: add device model types to example policyDaniel De Graaf2012-02-092-1/+23
| | | | | | | This adds an example user for device_model_stubdomain_seclabel. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* flask/policy: Add boolean exampleDaniel De Graaf2012-02-021-1/+9
| | | | | | | | | This shows an example boolean (prot_doms_locked) which can be set at runtime to prevent dom0 from mapping memory of domains of type prot_domU_t. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* flask/policy: use declare_domain for dom0_tDaniel De Graaf2012-02-022-5/+3
| | | | | Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* flask/policy: Add user and constraint examplesDaniel De Graaf2012-02-023-18/+39
| | | | | | | | | These examples show how to use constraints and the user field of the security label to prevent communication between virtual machines of different customers in a multi-tenant environment. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* flask/policy: Policy build updatesDaniel De Graaf2012-02-023-63/+20
| | | | | | | | | | Eliminate temporary files used in creating FLASK policy to improve error reporting during policy build. Syntax errors now point to the file and line number visible to the user, not the intermediate temporary file. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* xen: allow global VIRQ handlers to be delegated to other domainsDaniel De Graaf2012-01-281-0/+1
| | | | | | | | | | | | | | | | | This patch sends global VIRQs to a domain designated as the VIRQ handler instead of sending all global VIRQ events to dom0. This is required in order to run xenstored in a stubdom, because VIRQ_DOM_EXC must be sent to xenstored for domain destruction to work properly. This patch was inspired by the xenstored stubdomain patch series sent to xen-devel by Alex Zeffertt in 2009. Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com> Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* flask/policy: add missing manage_domain rulesDaniel De Graaf2012-01-102-0/+9
| | | | | | | | The updated example policy did not include rules to allow managing the created domains (pause, unpause, destroy); allow these actions. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* docs: Update xsm-flask documentationDaniel De Graaf2012-01-101-1/+1
| | | | | Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* flask/policy: Update example policyDaniel De Graaf2011-12-202-152/+178
| | | | | | | | Rewrite the example policy to make it easier to understand and demonstrate some of the security goals that FLASK can enforce. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xsm: Add missing access checksDaniel De Graaf2011-12-181-0/+14
| | | | | | | | | Actions requiring IS_PRIV should also require some XSM access control in order for XSM to be useful in confining multiple privileged domains. Add XSM hooks for new hypercalls and sub-commands that are under IS_PRIV but not currently under any access checks. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
* xsm: add remote_remap permissionDaniel De Graaf2011-12-181-0/+1
| | | | | | | | The mmu_update hypercall can be used to manipulate the page tables of a remote domain. Add a check for this in the XSM hook in addition to the existing check on mapping pages of a remote domain. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
* xsm: clean up initial SIDsDaniel De Graaf2011-12-023-9/+7
| | | | | | | | | | The domU SID is never used before a policy load, and so does not belong in the initial_sids list. The PIRQ SID is now incorrectly named; it should simply be called IRQ. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* xsm: remove unused xsm_assign_vector checkDaniel De Graaf2011-12-023-3/+0
| | | | | | | | The PHYSDEVOP_alloc_irq_vector hypercall is a noop, so its XSM check is not useful. Remove it and the "event vector" FLASK permission. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* flask: Fix policy build with new checkpolicyDaniel De Graaf2011-12-021-0/+1
| | | | | | | | | Version 26 of checkpolicy (shipped with Fedora 16) now requires that roles be declared prior to setting types for a role. Add a declaration of the system_r role to fix the build of default XSM/FLASK policy. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* xsm: Add support for HVMOP_track_dirty_vram.Jean Guyader2011-11-082-1/+2
| | | | | | | | | Xen try to inforce the xsm policy when a HVMOP_track_dirty_vram is received (xen/arch/x86/hvm/hvm.c:3637). It was failing because in flask_hvmcontext, xsm didn't have any case for this operation. Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* xsm/flask: Fix permission tablesKeir Fraser2011-02-061-0/+2
| | | | | | | | | | | | | | | | | | At some point, it seems that someone manually added Flask permission definitions to one header file without updating the corresponding policy configuration or the other related table. The end result is that we can get uninterpretable AVC messages like this: # xl dmesg | grep avc (XEN) avc: denied { 0x4000000 } for domid=0 scontext=system_u:system_r:dom0_t tcontext=system_u:system_r:domU_t tclass=domain Fix this by updating the flask config and regenerating the headers from it. In the future, this can be further improved by integrating the automatic generation of the headers into the build process as is presently done in SELinux. Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
* Fix Makefile targets that generate several files at onceKeir Fraser2010-03-051-2/+4
| | | | | | | | | | | | | | | | | | | | In a few places in the tree the Makefiles have constructs like this: one_file another_file: $(COMMAND_WHICH_GENERATES_BOTH_AT_ONCE) This is wrong, because make will run _two copies_ of the same command at once. This generally causes races and hard-to-reproduce build failures. Notably, `make -j4' at the top level will build stubdom libxc twice simultaneously! In this patch we replace the occurrences of this construct with the correct idiom: one_file: another_file another_file: $(COMMAND_WHICH_GENERATES_BOTH_AT_ONCE) Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xsm: Dynamic update to device ocontextsKeir Fraser2009-11-132-1/+3
| | | | | | | | | | | | | | Added the ability to add and delete ocontexts dynamically on a running system. Two new commands have been added to the xsm hypercall, add and delete ocontext. Twelve new library functions have been implemented that use the hypercall commands to label and unlabel pirqs, PCI devices, I/O ports and memory. The base policy has been updated so dom0 has the ability to use the hypercall commands by default. Items added to the list will not be present next time the system reloads. They will need to be added to the static policy. Signed-off-by : George Coker <gscoker@alpha.ncsc.mil> Signed-off-by : Paul Nuzzi <pjnuzzi@tycho.ncsc.mil>
* xsm: Add support for Xen device policiesKeir Fraser2009-10-273-1/+81
| | | | | | | | | | | | | Add support for Xen ocontext records to enable device polices. The default policy will not be changed and instructions have been added to enable the new functionality. Examples on how to use the new policy language have been added but commented out. The newest version of checkpolicy (>= 2.0.20) and libsepol (>= 2.0.39) is needed in order to compile it. Devices can be labeled and enforced using the following new commands; pirqcon, iomemcon, ioportcon and pcidevicecon. Signed-off-by : George Coker <gscoker@alpha.ncsc.mil> Signed-off-by : Paul Nuzzi <pjnuzzi@tycho.ncsc.mil>
* tools/flask/policy: Updates to policy and policy build infrastructureKeir Fraser2009-08-2012-1217/+342
| | | | | | | | | | | | | | | The original xen policy infrastructure was based off of an early version of refpolicy. Because of this there was a lot of cruft that does not apply to building a policy for xen. This patch does several things. First it cleans up the makefile as to remove many unnecessary build targets. Second it fixes an issue that the policy build process wasn't handling interface files properly. Third it pulls in the MLS suppport functions from current ref policy and makes use of them. Finally it updates the xen policy with new rules to address changes in xen since the policy was last worked on, and provides several new abstractions for creating domains. Signed-off-by: David P. Quigley <dpquigl@tycho.nsa.gov>
* Update Xen Flask module to policy.24.Keir Fraser2009-08-191-1/+1
| | | | | | | | | | This is a back-port of the latest SELinux code to Xen, adjusted for Xen coding style and interfaces. Unneeded functionality such as most object context config data, handle_unknown, MLS field defaulting, etc has been omitted. Signed-off-by: Stephen D. Smalley <sds@tycho.nsa.gov> Signed-off-by: George S. Coker, II <gscoker@alpha.ncsc.mil>
* tools: clean up handling of xen config and scripts directories.Keir Fraser2009-05-191-1/+1
| | | | | | | For now hardcode /etc w/o a prefix as there are hardcoded config paths in the code which would break otherwise. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* Add 2 more permissions to the XSM/Flask default policy.Keir Fraser2008-10-271-1/+2
| | | | Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
* flask: Add 2 permissions to the default flask policy to get a VIF-enabled ↵Keir Fraser2008-10-081-0/+3
| | | | | | | | | guest to work This adds two more permissions to the default Flask policy to get a VM with a network interface to work. Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
* flask: Fix to default policy to get simple VM runningKeir Fraser2008-10-081-1/+1
| | | | | | | This fix gets to the default Flask/XSM policy gets a simple guest VM (Ramdisk only, no VIF) running. Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
* xsm, flask: sample flask policyKeir Fraser2008-09-0421-0/+2291
- The patch includes a policy for xen that can be booted into enforcing mode and supports creation and management of paravirtualized guests. The policy follows the dom0/domU usage model, extension to other models or the addition of management or IO permissions should be much more straightforward now. The option flask_enforcing=1 can be passed on the xen line in grub to boot into enforcing mode. - The policy provides a basic policy for booting the platform and creating a domU with the label system_u:object_r:domU_t. The policy can be easily extended to support new types by modifying the xen.te source file. - The policy includes some basic macros which may be helpful in extending the policy. - The policy is compatible with and requires the most recent XSM patch, xsm-flask-io-sysctl-hooks-090308.diff. - The policy is not built as part of the make all as it requires the SELinux policy compiler which may/may not be installed on all systems. Users must go into the tools/flask/policy directory and explicitly compile the policy. Signed-off-by: George Coker <gscoker@alpha.ncsc.mil>