From: Stefan Berger Subject: [PATCH] [xend] [ACM] Fix a problem when resetting the policy Date: Wed, 30 Jan 2008 07:08:31 -0500 Message-ID: <1201694911.8674.4.camel@localhost.localdomain> Reply-To: stefanb@us.ibm.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-5Wl1CSEmoGCRI/3/PPXV" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: keir.fraser@cl.cam.ac.uk List-Id: xen-devel@lists.xenproject.org --=-5Wl1CSEmoGCRI/3/PPXV Content-Type: text/plain Content-Transfer-Encoding: 7bit The attached patch fixes a problem when resetting the policy and the label of Domain-0 needs to be renamed. Signed-off-by: Stefan Berger --=-5Wl1CSEmoGCRI/3/PPXV Content-Disposition: attachment; filename=xend_acm_policy_reset_fix.diff Content-Type: text/x-vhdl; name=xend_acm_policy_reset_fix.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit --- xen-unstable.hg/tools/python/xen/util/acmpolicy.py | 3 ++- xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) Index: root/xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py +++ root/xen-unstable.hg/tools/python/xen/util/xsm/acm/acm.py @@ -1342,7 +1342,8 @@ def relabel_domains(relabel_list): def change_acm_policy(bin_pol, del_array, chg_array, - vmlabel_map, reslabel_map, cur_acmpol, new_acmpol): + vmlabel_map, reslabel_map, cur_acmpol, new_acmpol, + is_reset): """ Change the ACM policy of the system by relabeling domains and resources first and doing some access checks. @@ -1451,8 +1452,11 @@ def change_acm_policy(bin_pol, del_array continue new_vmlabel = vmlabel - if vmlabel_map.has_key(vmlabel): - # renaming of the label + if vmlabel_map.has_key(vmlabel) and \ + (not is_reset or name == "Domain-0") : + # renaming of the label; this is only allowed if it's + # not a reset of the policy or if it is a reset, then + # only for Domain-0 new_vmlabel = vmlabel_map[vmlabel] polname = new_policyname elif new_vmlabel not in polnew_vmlabels and \ Index: root/xen-unstable.hg/tools/python/xen/util/acmpolicy.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/util/acmpolicy.py +++ root/xen-unstable.hg/tools/python/xen/util/acmpolicy.py @@ -337,7 +337,8 @@ class ACMPolicy(XSPolicy): rc, errors = security.change_acm_policy(bin_pol, del_array, chg_array, vmlabel_map, reslabel_map, - self, acmpol_new) + self, acmpol_new, + acmpol_new.is_default_policy()) if rc == 0: # Replace the old DOM with the new one and save it --=-5Wl1CSEmoGCRI/3/PPXV Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-5Wl1CSEmoGCRI/3/PPXV--