XSM support for recently added priv hypercall ops
The attached patch provides an update to XSM and the associated security modules. This patch enables
XSM to interpose on the recently added privileged hypercall operations as well as refactors the existing
IO assignment hooks.
The patch applies cleanly against changeset 16606:8f0cbfc478d6.
Signed-off by: George Coker <[email protected]>, <[email protected]>
XSM:
The following hooks are added:
xsm_sendtrigger
xsm_test_assign_device
xsm_assign_device
xsm_bind_pt_irq
xsm_pin_mem_cacheattr
xsm_ext_vcpucontext
xsm_firmware_info
xsm_acpi_sleep
xsm_change_freq
xsm_getideltime
xsm_debug_keys
xsm_getcpuinfo
xsm_availheap
xsm_add_range
xsm_remove_range
The following hooks are deprecated:
xsm_irq_permission
xsm_iomem_permission
xsm_ioport_permission
The functionality provided by the deprecated hooks has been refactored into the xsm_add_range andxsm_remove_range hooks. The refactoring enables XSM to centralize the interposition on IO resource
assignment. The refactoring was necessitated by the addition of the XEN_DOMCTL_memory_mapping
and XEN_DOMCTL_ioport_mapping operations to support HVM domains.
ACM:
- no updates to ACM
FLASK:
- updated and refactored to implement the new XSM hooks
xen/arch/x86/domctl.c +31 -8
@@ -67,14 +67,6 @@ long arch_do_domctl(if (unlikely ((d =rcu_lock_domain_by_id (domctl->domain)) ==NULL ) )break ; - ret =xsm_ioport_permission (d, fp, - domctl->u.ioport_permission.allow_access); -if ( ret ) - { -rcu_unlock_domain (d); -break ; - } -if ( np ==0 ) ret =0 ;else if ( domctl->u.ioport_permission.allow_access )
@@ -498,6 +490,10 @@ long arch_do_domctl(if ( (d =rcu_lock_domain_by_id (domctl->domain)) ==NULL )break ; + ret =xsm_sendtrigger (d); +if ( ret ) + goto sendtrigger_out; + ret = -EINVAL ;if ( domctl->u.sendtrigger.vcpu >=MAX_VIRT_CPUS ) goto sendtrigger_out;
@@ -536,6 +532,10 @@ long arch_do_domctl( bus = (domctl->u.assign_device.machine_bdf >>16 ) &0xff ; devfn = (domctl->u.assign_device.machine_bdf >>8 ) &0xff ; + ret =xsm_test_assign_device (domctl->u.assign_device.machine_bdf); +if ( ret ) +break ; +if (device_assigned (bus, devfn) ) { gdprintk(XENLOG_ERR, "XEN_DOMCTL_test_assign_device: "
@@ -562,6 +562,11 @@ long arch_do_domctl( "XEN_DOMCTL_assign_device: get_domain_by_id() failed\n");break ; } + + ret =xsm_assign_device (d, domctl->u.assign_device.machine_bdf); +if ( ret ) + goto assign_device_out; + bus = (domctl->u.assign_device.machine_bdf >>16 ) &0xff ; devfn = (domctl->u.assign_device.machine_bdf >>8 ) &0xff ;
@@ -576,6 +581,8 @@ long arch_do_domctl( ret =assign_device (d, bus, devfn);gdprintk (XENLOG_INFO ,"XEN_DOMCTL_assign_device: bdf = %x:%x:%x\n" , bus,PCI_SLOT (devfn),PCI_FUNC (devfn)); + + assign_device_out:put_domain (d); }break ;
@@ -589,10 +596,17 @@ long arch_do_domctl(if ( (d =rcu_lock_domain_by_id (domctl->domain)) ==NULL )break ; bind = &(domctl->u.bind_pt_irq); + + ret =xsm_bind_pt_irq (d, bind); +if ( ret ) + goto bind_out; +if (vtd_enabled) ret =pt_irq_create_bind_vtd (d, bind);if (ret <0 )gdprintk (XENLOG_ERR ,"pt_irq_create_bind failed!\n" ); + + bind_out:rcu_unlock_domain (d); }break ;
@@ -716,11 +730,16 @@ long arch_do_domctl(if ( d ==NULL )break ; + ret =xsm_pin_mem_cacheattr (d); +if ( ret ) + goto pin_out; + ret =hvm_set_mem_pinned_cacheattr ( d, domctl->u.pin_mem_cacheattr.start, domctl->u.pin_mem_cacheattr.end, domctl->u.pin_mem_cacheattr.type); + pin_out:rcu_unlock_domain (d); }break ;
@@ -738,6 +757,10 @@ long arch_do_domctl( d =rcu_lock_domain_by_id (domctl->domain);if ( d ==NULL )break ; + + ret =xsm_ext_vcpucontext (d, domctl->cmd); +if ( ret ) + goto ext_vcpucontext_out; ret = -ESRCH ; if ( (evc->vcpu >= MAX_VIRT_CPUS) ||
xen/arch/x86/platform_hypercall.c +16 -0
@@ -188,6 +188,10 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xebreak ;case XENPF_firmware_info: + ret =xsm_firmware_info (); +if ( ret ) +break ; +switch ( op->u.firmware_info.type ) {case XEN_FW_DISK_INFO : {
@@ -276,10 +280,18 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xebreak ;case XENPF_enter_acpi_sleep: + ret =xsm_acpi_sleep (); +if ( ret ) +break ; + ret =acpi_enter_sleep (&op->u.enter_acpi_sleep);break ;case XENPF_change_freq: + ret =xsm_change_freq (); +if ( ret ) +break ; + ret = -ENOSYS ;if ( cpufreq_controller != FREQCTL_dom0_kernel )break ;
@@ -300,6 +312,10 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xecpumask_t cpumap;XEN_GUEST_HANDLE (uint8_t ) cpumap_bitmap;XEN_GUEST_HANDLE (uint64_t ) idletimes; + + ret =xsm_getidletime (); +if ( ret ) +break ; ret = -ENOSYS ;if ( cpufreq_controller != FREQCTL_dom0_kernel )
xen/common/domctl.c +0 -10
@@ -723,16 +723,11 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domcif ( d ==NULL )break ; - ret =xsm_irq_permission (d, pirq, op->u.irq_permission.allow_access); -if ( ret ) - goto irq_permission_out; -if ( op->u.irq_permission.allow_access ) ret =irq_permit_access (d, pirq);else ret =irq_deny_access (d, pirq); - irq_permission_out:rcu_unlock_domain (d); }break ;
@@ -751,17 +746,12 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc d =rcu_lock_domain_by_id (op->domain);if ( d ==NULL )break ; - - ret =xsm_iomem_permission (d, mfn, op->u.iomem_permission.allow_access); -if ( ret ) - goto iomem_permission_out;if ( op->u.iomem_permission.allow_access ) ret =iomem_permit_access (d, mfn, mfn + nr_mfns -1 );else ret =iomem_deny_access (d, mfn, mfn + nr_mfns -1 ); - iomem_permission_out:rcu_unlock_domain (d); }break ;
xen/common/rangeset.c +9 -0
@@ -10,6 +10,7 @@#include <xen/sched.h> #include <xen/errno.h> #include <xen/rangeset.h> +#include <xsm/xsm.h> /* An inclusive range [s,e] and pointer to next range in ascending order. */ struct range {
@@ -95,6 +96,10 @@ int rangeset_add_range( {struct range *x, *y;int rc =0 ; + + rc =xsm_add_range (r->domain, r->name, s, e); +if ( rc ) +return rc;ASSERT (s <= e);
@@ -164,6 +169,10 @@ int rangeset_remove_range(struct range *x, *y, *t;int rc =0 ; + rc =xsm_remove_range (r->domain, r->name, s, e); +if ( rc ) +return rc; +ASSERT (s <= e);spin_lock (&r->lock);
xen/common/sysctl.c +12 -0
@@ -147,6 +147,10 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_syscchar c;uint32_t i; + ret =xsm_debug_keys (); +if ( ret ) +break ; +for ( i =0 ; i < op->u.debug_keys.nr_keys; i++ ) {if (copy_from_guest_offset (&c, op->u.debug_keys.keys, i,1 ) )
@@ -164,6 +168,10 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc nr_cpus =min_t (uint32_t, op->u.getcpuinfo.max_cpus,NR_CPUS ); + ret =xsm_getcpuinfo (); +if ( ret ) +break ; +for ( i =0 ; i < nr_cpus; i++ ) {/* Assume no holes in idle-vcpu map. */
@@ -186,6 +194,10 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysccase XEN_SYSCTL_availheap: { + ret =xsm_availheap (); +if ( ret ) +break ; + op->u.availheap.avail_bytes = avail_domheap_pages_region( op->u.availheap.node, op->u.availheap.min_bitwidth,
xen/include/xsm/xsm.h +96 -23
182 lines not on this page · raw message
xen/xsm/dummy.c +93 -20
173 lines not on this page · raw message
xen/xsm/flask/hooks.c +193 -8
268 lines not on this page · raw message
xen/xsm/flask/include/av_perm_to_string.h +13 -2
@@ -17,6 +17,13 @@ S_(SECCLASS_XEN, XEN__PRIVPROFILE, "privprofile") S_(SECCLASS_XEN, XEN__NONPRIVPROFILE, "nonprivprofile") S_(SECCLASS_XEN, XEN__KEXEC, "kexec") + S_(SECCLASS_XEN, XEN__FIRMWARE, "firmware") + S_(SECCLASS_XEN, XEN__SLEEP, "sleep") + S_(SECCLASS_XEN, XEN__FREQUENCY, "frequency") + S_(SECCLASS_XEN, XEN__GETIDLE, "getidle") + S_(SECCLASS_XEN, XEN__DEBUG, "debug") + S_(SECCLASS_XEN, XEN__GETCPUINFO, "getcpuinfo") + S_(SECCLASS_XEN, XEN__HEAP, "heap") S_(SECCLASS_DOMAIN, DOMAIN__SETVCPUCONTEXT, "setvcpucontext") S_(SECCLASS_DOMAIN, DOMAIN__PAUSE, "pause")S_ (SECCLASS_DOMAIN ,DOMAIN__UNPAUSE ,"unpause" )
@@ -39,6 +46,9 @@ S_(SECCLASS_DOMAIN, DOMAIN__SHUTDOWN, "shutdown") S_(SECCLASS_DOMAIN, DOMAIN__SETADDRSIZE, "setaddrsize") S_(SECCLASS_DOMAIN, DOMAIN__GETADDRSIZE, "getaddrsize") + S_(SECCLASS_DOMAIN, DOMAIN__TRIGGER, "trigger") + S_(SECCLASS_DOMAIN, DOMAIN__GETEXTVCPUCONTEXT, "getextvcpucontext") + S_(SECCLASS_DOMAIN, DOMAIN__SETEXTVCPUCONTEXT, "setextvcpucontext") S_(SECCLASS_HVM, HVM__SETHVMC, "sethvmc") S_(SECCLASS_HVM, HVM__GETHVMC, "gethvmc")S_ (SECCLASS_HVM ,HVM__SETPARAM ,"setparam" )
@@ -46,11 +56,12 @@ S_(SECCLASS_HVM, HVM__PCILEVEL, "pcilevel") S_(SECCLASS_HVM, HVM__IRQLEVEL, "irqlevel") S_(SECCLASS_HVM, HVM__PCIROUTE, "pciroute") + S_(SECCLASS_HVM, HVM__ASSIGN_DEVICE, "assign_device") + S_(SECCLASS_HVM, HVM__BIND_IRQ, "bind_irq") + S_(SECCLASS_HVM, HVM__CACHEATTR, "cacheattr") S_(SECCLASS_EVENT, EVENT__BIND, "bind") - S_(SECCLASS_EVENT, EVENT__CLOSE, "close") S_(SECCLASS_EVENT, EVENT__SEND, "send") S_(SECCLASS_EVENT, EVENT__STATUS, "status") - S_(SECCLASS_EVENT, EVENT__UNMASK, "unmask") S_(SECCLASS_EVENT, EVENT__NOTIFY, "notify") S_(SECCLASS_EVENT, EVENT__CREATE, "create")S_ (SECCLASS_EVENT ,EVENT__ALLOC ,"alloc" )
xen/xsm/flask/include/av_permissions.h +20 -9
@@ -17,6 +17,13 @@#define XEN__PRIVPROFILE 0x00008000UL#define XEN__NONPRIVPROFILE 0x00010000UL#define XEN__KEXEC 0x00020000UL +#define XEN__FIRMWARE 0x00040000UL +#define XEN__SLEEP 0x00080000UL +#define XEN__FREQUENCY 0x00100000UL +#define XEN__GETIDLE 0x00200000UL +#define XEN__DEBUG 0x00400000UL +#define XEN__GETCPUINFO 0x00800000UL +#define XEN__HEAP 0x01000000UL#define DOMAIN__SETVCPUCONTEXT 0x00000001UL#define DOMAIN__PAUSE 0x00000002UL
@@ -40,6 +47,9 @@#define DOMAIN__SHUTDOWN 0x00080000UL#define DOMAIN__SETADDRSIZE 0x00100000UL#define DOMAIN__GETADDRSIZE 0x00200000UL +#define DOMAIN__TRIGGER 0x00400000UL +#define DOMAIN__GETEXTVCPUCONTEXT 0x00800000UL +#define DOMAIN__SETEXTVCPUCONTEXT 0x01000000UL#define HVM__SETHVMC 0x00000001UL#define HVM__GETHVMC 0x00000002UL
@@ -48,17 +58,18 @@#define HVM__PCILEVEL 0x00000010UL#define HVM__IRQLEVEL 0x00000020UL#define HVM__PCIROUTE 0x00000040UL +#define HVM__ASSIGN_DEVICE 0x00000080UL +#define HVM__BIND_IRQ 0x00000100UL +#define HVM__CACHEATTR 0x00000200UL#define EVENT__BIND 0x00000001UL -#define EVENT__CLOSE 0x00000002UL -#define EVENT__SEND 0x00000004UL -#define EVENT__STATUS 0x00000008UL -#define EVENT__UNMASK 0x00000010UL -#define EVENT__NOTIFY 0x00000020UL -#define EVENT__CREATE 0x00000040UL -#define EVENT__ALLOC 0x00000080UL -#define EVENT__VECTOR 0x00000100UL -#define EVENT__RESET 0x00000200UL +#define EVENT__SEND 0x00000002UL +#define EVENT__STATUS 0x00000004UL +#define EVENT__NOTIFY 0x00000008UL +#define EVENT__CREATE 0x00000010UL +#define EVENT__ALLOC 0x00000020UL +#define EVENT__VECTOR 0x00000040UL +#define EVENT__RESET 0x00000080UL#define GRANT__MAP_READ 0x00000001UL#define GRANT__MAP_WRITE 0x00000002UL
xen/xsm/flask/include/flask.h +5 -6
@@ -1,6 +1,6 @@/* This file is automatically generated. Do not edit. */ -#ifndef _FLASK_FLASK_H_ -#define _FLASK_FLASK_H_ +#ifndef _SELINUX_FLASK_H_ +#define _SELINUX_FLASK_H_/* * Security object class definitions
@@ -27,10 +27,9 @@#define SECINITSID_SECURITY 7#define SECINITSID_IOPORT 8#define SECINITSID_IOMEM 9 -#define SECINITSID_VCPU 10 -#define SECINITSID_VIRQ 11 -#define SECINITSID_PIRQ 12 +#define SECINITSID_PIRQ 10 +#define SECINITSID_DEVICE 11 -#define SECINITSID_NUM 12 +#define SECINITSID_NUM 11#endif
xen/xsm/flask/include/initial_sid_to_string.h +1 -2
@@ -11,8 +11,7 @@ static char *initial_sid_to_string[] ="security" ,"ioport" ,"iomem" , -"vcpu" , -"virq" ,"pirq" , + "device", };
xen/xsm/flask/include/security.h +2 -4
@@ -69,13 +69,11 @@ int security_get_user_sids(u32 callsid,int security_pirq_sid (int pirq,u32 *out_sid); -int security_virq_sid (int virq,u32 *out_sid); - -int security_vcpu_sid (int vcpu,u32 *out_sid); -int security_iomem_sid (unsigned long ,u32 *out_sid);int security_ioport_sid (u32 ioport,u32 *out_sid); + +int security_device_sid (u32 device,u32 *out_sid);int security_validate_transition (u32 oldsid,u32 newsid,u32 tasksid,u16 tclass);
xen/xsm/flask/ss/policydb.h +6 -7
@@ -133,10 +133,9 @@ struct ocontext {union {char *name;/* name of initial SID, fs, netif, fstype, path */ int pirq; -int virq; -int vcpu;u32 ioport;unsigned long iomem; +u32 device; } u;struct context context[2 ];/* security context(s) */ u32 sid[2 ];/* SID(s) */
@@ -157,11 +156,11 @@ struct ocontext {/* object context array indices */ #define OCON_ISID 0/* initial SIDs */ #define OCON_PIRQ 1/* physical irqs */ -#define OCON_VIRQ 2/* virtual irqs */ -#define OCON_VCPU 3/* virtual cpus */ -#define OCON_IOPORT 4/* io ports */ -#define OCON_IOMEM 5/* io memory */ -#define OCON_DUMMY 6 +#define OCON_IOPORT 2/* io ports */ +#define OCON_IOMEM 3/* io memory */ +#define OCON_DEVICE 4/* pci devices */ +#define OCON_DUMMY1 5/* reserved */ +#define OCON_DUMMY2 6/* reserved */ #define OCON_NUM 7/* The policy database */
xen/xsm/flask/ss/services.c +40 -0
@@ -1418,6 +1418,46 @@ out:return rc; } +/** +* security_ioport_sid - Obtain the SID for an ioport. +* @ioport: ioport +* @out_sid: security identifier +*/ +int security_device_sid (u32 device,u32 *out_sid) +{ +struct ocontext *c; +int rc =0 ; + +POLICY_RDLOCK ; + + c = policydb.ocontexts[OCON_DEVICE ]; +while ( c ) + { +if ( c->u.device == device ) +break ; + c = c->next; + } + +if ( c ) + { +if ( !c->sid[0 ] ) + { + rc =sidtab_context_to_sid (&sidtab, &c->context[0 ], &c->sid[0 ]); +if ( rc ) + goto out; + } + *out_sid = c->sid[0 ]; + } +else + { + *out_sid =SECINITSID_DEVICE ; + } + +out: +POLICY_RDUNLOCK ; +return rc; +} +#define SIDS_NEL 25/**
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
George,
when these hooks are enforced, do today's libraries and applications react approriately?
Would it not make sense to use the same hook for getting the cpu context and the extended cpu context?
Stefan
[email protected] wrote on 12/13/2007 01:43:16 PM:
Quoted 9 lines
The attached patch provides an update to XSM and the associated security modules. This patch enables
XSM to interpose on the recently added privileged hypercall operations as well as refactors the existing
IO assignment hooks.The patch applies cleanly against changeset 16606:8f0cbfc478d6.
Signed-off by: George Coker <[email protected]>,
Quoted 36 lines
XSM:
The following hooks are added:
xsm_sendtrigger
xsm_test_assign_device
xsm_assign_device
xsm_bind_pt_irq
xsm_pin_mem_cacheattr
xsm_ext_vcpucontext
xsm_firmware_info
xsm_acpi_sleep
xsm_change_freq
xsm_getideltime
xsm_debug_keys
xsm_getcpuinfo
xsm_availheap
xsm_add_range
xsm_remove_rangeThe following hooks are deprecated:
xsm_irq_permission
xsm_iomem_permission
xsm_ioport_permissionThe functionality provided by the deprecated hooks has been refactored into the
xsm_add_rangeandxsm_remove_rangehooks. The refactoring enables XSM to centralize the interposition on IO resource
assignment. The refactoring was necessitated by the addition of theXEN_DOMCTL_memory_mapping
andXEN_DOMCTL_ioport_mappingoperations to support HVM domains.ACM:
- no updates to ACM
Quoted 7 lines
FLASK:
- updated and refactored to implement the new XSM hooks
[attachment "update-xsm-121307-xen-16606.diff" deleted by Stefan Berger/Watson/IBM] _______________________________________________ Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 4 lines
when these hooks are enforced, do today's libraries and applications react approriately?
I believe yes, these hooks are in code paths where today IS_PRIV is also checked
and may cause a return value of -EPERM or -ESRCH. In my checking, few of the libraries and
applications that I know about are sensitive to the exact value of the return, but I understand that this isn't
always true.
Quoted 3 lines
Would it not make sense to use the same hook for getting the cpu context and the extended cpu context?
I would like to distinguish the difference between the implementation of a security module and the implementation of the framework. The framework defines distinct hooks for flexibility. A security module may instrument the same security function for all hooks because the goals of the module are simple, e.g. is the caller privileged or not. However, a security module may instrument distinct security functions to meet finer grain goals. One example could be to eliminate or limit the use of particular code paths. I would prefer that XSM not place constraints on the goals of a security module.
For the get/set_vcpucontext and get/set_ext_vcpucontext hooks, the get/set_vcpucontext hooks are in the common domctl code path and are architecture neutral. The get/set_ext_vcpucontext hooks are only found, today, in the x86 code path. Forcing the same hook assumes something which isn't true, that all architectures are the same and the impact of these operations are the same on all architectures/platforms.
Quoted 60 lines
Stefan
[email protected] wrote on 12/13/2007 01:43:16 PM:
Quoted 9 lines
The attached patch provides an update to XSM and the associated security modules. This patch enables
XSM to interpose on the recently added privileged hypercall operations as well as refactors the existing
IO assignment hooks.The patch applies cleanly against changeset 16606:8f0cbfc478d6.
Signed-off by: George Coker <[email protected]>,
Quoted 43 lines
XSM:
The following hooks are added:
xsm_sendtrigger
xsm_test_assign_device
xsm_assign_device
xsm_bind_pt_irq
xsm_pin_mem_cacheattr
xsm_ext_vcpucontext
xsm_firmware_info
xsm_acpi_sleep
xsm_change_freq
xsm_getideltime
xsm_debug_keys
xsm_getcpuinfo
xsm_availheap
xsm_add_range
xsm_remove_rangeThe following hooks are deprecated:
xsm_irq_permission
xsm_iomem_permission
xsm_ioport_permissionThe functionality provided by the deprecated hooks has been refactored into the
xsm_add_rangeandxsm_remove_rangehooks. The refactoring enables XSM to centralize the interposition on IO resource
assignment. The refactoring was necessitated by the addition of theXEN_DOMCTL_memory_mapping
andXEN_DOMCTL_ioport_mappingoperations to support HVM domains.ACM:
- no updates to ACMFLASK:
- updated and refactored to implement the new XSM hooks
[attachment "update-xsm-121307-xen-16606.diff" deleted by Stefan Berger/Watson/IBM] _______________________________________________ Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 25 lines · II
Quoted 4 lines
when these hooks are enforced, do today's libraries and applications react approriately?
I believe yes, these hooks are in code paths where today
IS_PRIVis also checked
and may cause a return value of-EPERMor-ESRCH. In my checking, few of the libraries and
applications that I know about are sensitive to the exact value of the return, but I understand that this isn't
always true.Quoted 3 lines
Would it not make sense to use the same hook for getting the cpu context and the extended cpu context?
I would like to distinguish the difference between the implementation of a security module and the implementation of the framework. The framework defines distinct hooks for flexibility. A security module may instrument the same security function for all hooks because the goals of the module are simple, e.g. is the caller privileged or not. However, a security module may instrument distinct security functions to meet finer grain goals. One example could be to eliminate or limit the use of particular code paths. I would prefer that XSM not place constraints on the goals of a security module.
Quoted 8 lines
For the get/set_vcpucontext and get/set_ext_vcpucontext hooks, the get/set_vcpucontext hooks are in the common domctl code path and are architecture neutral. The get/set_ext_vcpucontext hooks are only found, today, in the x86 code path. Forcing the same hook assumes something which isn't true, that all architectures are the same and the impact of these operations are the same on all architectures/platforms.
Stefan,
In looking at the vcpucontext case again, it would be entirely reasonable to create a generic hook with an additional argument for the hypercall op. A module would then have the burden of checking the op for the architecture dependent ops. However, I dislike this approach because it obscures an arch dependency of the hook, something which has not been done for the other ops. I find the inconsistency problematic.
Do you have a specific observation here, perhaps based on other architectures?
George
Signature · 1 line
George S. Coker, II <[email protected]>
"George S. Coker, II" <[email protected]> wrote on 12/17/2007 05:00:39 PM:
Quoted 4 lines
On 12/13/07 7:20 PM, "George S. Coker, II" <[email protected]>
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
when these hooks are enforced, do today's libraries and applications
react
Quoted 33 lines
Quoted 11 lines
Quoted 2 lines
approriately?
I believe yes, these hooks are in code paths where today
IS_PRIVis also checked
and may cause a return value of-EPERMor-ESRCH. In my checking, few of the libraries and
applications that I know about are sensitive to the exact value of the return, but I understand that this isn't
always true.Quoted 1 line
Would it not make sense to use the same hook for getting the cpu
context and
Quoted 12 lines
Quoted 2 lines
the extended cpu context?
I would like to distinguish the difference between the implementation of a security module and the implementation of the framework. The framework defines distinct hooks for flexibility. A security module may instrument the same security function for all hooks because the goals of the module are simple, e.g. is the caller privileged or not. However, a security module may instrument distinct security functions to meet finer grain goals. One example could be to eliminate or limit the use of particular code paths. I would prefer that XSM not place constraints on the goals of a security module.
Quoted 8 lines
For the get/set_vcpucontext and get/set_ext_vcpucontext hooks, the get/set_vcpucontext hooks are in the common domctl code path and are architecture neutral. The get/set_ext_vcpucontext hooks are only found, today, in the x86 code path. Forcing the same hook assumes something which isn't true, that all architectures are the same and the impact of these operations are the same on all architectures/platforms.
Quoted 3 lines
Stefan,
In looking at the vcpucontext case again, it would be entirely
reasonable to
Quoted 1 line
create a generic hook with an additional argument for the hypercall op.
A
Quoted 1 line
module would then have the burden of checking the op for the
architecture
Quoted 1 line
dependent ops. However, I dislike this approach because it obscures an
arch
Quoted 1 line
dependency of the hook, something which has not been done for the other
ops.
Quoted 4 lines
I find the inconsistency problematic.
Do you have a specific observation here, perhaps based on other architectures?
Reading the extended vCPU context is part of suspend and migration operations, among a set of other hypercalls. Now these operations will fail if for example only reading the extended vCPU context is denied by a different hook than reading the 'normal' vCPU context. Also the operations will fail depending on the processor type. I am afraid that none of this makes it easier to write a policy.
Stefan
Quoted 7 lines
George
Signature · 1 line
George S. Coker, II <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 56 lines · Stefan Berger
"George S. Coker, II" <[email protected]> wrote on 12/17/2007 05:00:39 PM:
Quoted 49 lines · II
Quoted 5 lines
Quoted 5 lines
when these hooks are enforced, do today's libraries and applications react approriately?
Quoted 9 lines
I believe yes, these hooks are in code paths where today
IS_PRIVis also checked
and may cause a return value of-EPERMor-ESRCH. In my checking, few of the libraries and
applications that I know about are sensitive to the exact value of the return, but I understand that this isn't
always true.Quoted 1 line
Would it not make sense to use the same hook for getting the cpu
context and
Quoted 12 lines
Quoted 2 lines
the extended cpu context?
I would like to distinguish the difference between the implementation of a security module and the implementation of the framework. The framework defines distinct hooks for flexibility. A security module may instrument the same security function for all hooks because the goals of the module are simple, e.g. is the caller privileged or not. However, a security module may instrument distinct security functions to meet finer grain goals. One example could be to eliminate or limit the use of particular code paths. I would prefer that XSM not place constraints on the goals of a security module.
Quoted 8 lines
For the get/set_vcpucontext and get/set_ext_vcpucontext hooks, the get/set_vcpucontext hooks are in the common domctl code path and are architecture neutral. The get/set_ext_vcpucontext hooks are only found, today, in the x86 code path. Forcing the same hook assumes something which isn't true, that all architectures are the same and the impact of these operations are the same on all architectures/platforms.
Stefan,
In looking at the vcpucontext case again, it would be entirely reasonable to create a generic hook with an additional argument for the hypercall op. A module would then have the burden of checking the op for the architecture dependent ops. However, I dislike this approach because it obscures an arch dependency of the hook, something which has not been done for the other ops. I find the inconsistency problematic.
Quoted 2 lines
Do you have a specific observation here, perhaps based on other architectures?
Quoted 7 lines
Reading the extended vCPU context is part of suspend and migration operations, among a set of other hypercalls. Now these operations will fail if for example only reading the extended vCPU context is denied by a different hook than reading the 'normal' vCPU context. Also the operations will fail depending on the processor type. I am afraid that none of this makes it easier to write a policy.
In looking into the issue further, it appears that the suspend code will silently take the security fault on get_ext_vcpucontext and manifest the fault as not implemented vice not permitted. This issue and others like it can be handled by a simple modification to libxc for more explicit error checking. Thanks for pointing this issue out. I'll update my patches in the new year.
While both get_ext_vcpucontext and get_vcpucontext are required for the correct operation of the suspend code, they are distinct code paths. XSM strives to be consistent with Xen by recognizing this distinction and not burying architectural assumptions in some parts of the framework while explicitly stating others. Although, I think the vcpucontext operations may be an exception since it is the only (off the top of my head) example of complementary functionality that spans arch and common trees. However, I would rather XSM not make this exception and remain consistent with Xen. In this case and others like it, XSM provides a given security module the flexibility to drop the arch and common distinction and marshal both code paths through a common security operation, but I don't think the framework should make these kind of implementation choices especially since the framework has no impact on policy complexity.
George