天天看点

【XEN学习笔记】XEN中ACM模块编译注意事项

在默认设置下,ACM模块是不被编译和加载到内核中的。如果需要编译该模块,需要手动修改根目录下的Config.mk文件

# Enable XSM security module.  Enabling XSM requires selection of an 
# XSM security module (FLASK_ENABLE or ACM_SECURITY).
XSM_ENABLE ?= n
FLASK_ENABLE ?= n
ACM_SECURITY ?= n
           

注意事项1:此处除需要更改ACM_SECURITY项外,XSM_ENABLE也需要打开

注释写的不大负责任啊。逻辑上来讲XSM是个统称,ACM是属于XSM的,所以要使用ACM必须打开XSM

# Enable XSM security module.  Enabling XSM requires selection of an 
# XSM security module (FLASK_ENABLE or ACM_SECURITY).
XSM_ENABLE ?= y
FLASK_ENABLE ?= n
ACM_SECURITY ?= y
           

否则,将出现错误:

acm_core.c: In function ‘acm_init’:
acm_core.c:283: error: ‘policy_buffer’ undeclared (first use in this function)
acm_core.c:283: error: (Each undeclared identifier is reported only once
acm_core.c:283: error: for each function it appears in.)
acm_core.c:283: error: ‘policy_size’ undeclared (first use in this function)
cc1: warnings being treated as errors
acm_core.c:319: warning: implicit declaration of function ‘register_xsm’
acm_core.c: At top level:
acm_core.c:325: warning: data definition has no type or storage class
acm_core.c:325: warning: type defaults to ‘int’ in declaration of ‘xsm_initcall’
acm_core.c:325: warning: parameter names (without types) in function declaration
make[4]: *** [acm_core.o] Error 1
make[4]: Leaving directory `/xen/xen-3.4.2/xen/xsm/acm'
make[3]: *** [acm/built_in.o] Error 2
make[3]: Leaving directory `/xen/xen-3.4.2/xen/xsm'
make[2]: *** [/xen/xen-3.4.2/xen/xsm/built_in.o] Error 2
make[2]: Leaving directory `/xen/xen-3.4.2/xen/arch/x86'
make[1]: *** [/xen/xen-3.4.2/xen/xen] Error 2
make[1]: Leaving directory `/xen/xen-3.4.2/xen'
make: *** [build] Error 2
           

此错误是因为/xen/include/xsm/xsm.h中定义了如下内容:

#ifdef XSM_ENABLE

extern char *policy_buffer;
extern u32 policy_size;
……
           

 注意事项2:xend-config.sxp

增加如下内容

(xsm_module_name acm)
           

否则,ACM策略类型将被认为不支持(未指定使用的xsm类型)

继续阅读