Skip to contentSkip to conversation

Fix policy buffer layout changed with XSM

PATCH In review Stefan Berger 3 participants 7 messages Sep 4, 2007 – Sep 5, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix policy buffer layout changed with XSM

This fixes a regression due to changes in the policy buffer layout submitted by the XSM module.

xen/include/public/xsm/acm.h +1 -1
diff -r e8b71d5e584d xen/include/public/xsm/acm.h
@@ -150,8 +150,8 @@ struct acm_policy_version
  * tools that assume packed representations (e.g. the java tool)
  */
 struct acm_policy_buffer {
+    uint32_t policy_version; /* ACM_POLICY_VERSION */
     uint32_t magic;
-    uint32_t policy_version; /* ACM_POLICY_VERSION */
     uint32_t len;
     uint32_t policy_reference_offset;
     uint32_t primary_policy_code;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 3 lines · Stefan Berger

This fixes a regression due to changes in the policy buffer layout submitted by the XSM module.

Hi Stefan,

This was done to make the ACM magic number the first word in the policy file. This seemed to be the logical choice to afford ACM the greatest flexibility for loading policies under XSM. In principal, under XSM, a security module could be capable of loading and parsing policies over a range of policy versions.

Your patch reverts the ACM module to the original form where the first word of the policy file is the policy version - which could change over time. This is the general problem of magic numbers.

A benefit of your patch is old ACM policies will not need to be recompiled to work under XSM with this patch, but I see there being future confusion and a potential loss of flexibility for ACM by making this change. I would argue that the ACM policy version should instead be bumped for the move to XSM since the XSM patches actually caused a format change to the ACM policy binary.

Admittedly, this discussion is moot because ACM has only one policy version at this time. The XSM_MAGIC number must also be updated to 03000000 to ensure proper boot time policy detection under XSM with your patch.

I also see that there are dups of /xsm in the includes dir. Since this was a restructuring from inclusion in xen-staging, perhaps some cleanups are in order. Keir?

George

#2 lore raw

"George S. Coker, II" <[email protected]> wrote on 09/04/2007 02:29:10 PM:

Quoted 5 lines · Stefan Berger
Quoted 3 lines

This fixes a regression due to changes in the policy buffer layout submitted by the XSM module.

Quoted 7 lines

Hi Stefan,

This was done to make the ACM magic number the first word in the policy file. This seemed to be the logical choice to afford ACM the greatest flexibility for loading policies under XSM. In principal, under XSM, a security module could be capable of loading and parsing policies over a range of policy versions.

Did you adapt the tools to generate a binary policy in that form?

Quoted 4 lines

Your patch reverts the ACM module to the original form where the first word of the policy file is the policy version - which could change over time. This is the general problem of magic numbers.

Yes, I changed it back because it was broken, at least it did not accept the policy I tried to load.

Stefan

Quoted 13 lines

A benefit of your patch is old ACM policies will not need to be recompiled to work under XSM with this patch, but I see there being future confusion and a potential loss of flexibility for ACM by making this change. I would argue that the ACM policy version should instead be bumped for the move to XSM since the XSM patches actually caused a format change to the ACM policy binary.

Admittedly, this discussion is moot because ACM has only one policy version at this time. The XSM_MAGIC number must also be updated to 03000000 to ensure proper boot time policy detection under XSM with your patch.

Quoted 5 lines

I also see that there are dups of /xsm in the includes dir. Since this was a restructuring from inclusion in xen-staging, perhaps some cleanups are in order. Keir?

George

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 14 lines · Stefan Berger

"George S. Coker, II" <[email protected]> wrote on 09/04/2007 02:29:10 PM:

Quoted 8 lines · Stefan Berger
Quoted 3 lines

This fixes a regression due to changes in the policy buffer layout submitted by the XSM module.

Hi Stefan,

This was done to make the ACM magic number the first word in the

policy

Quoted 1 line

file. This seemed to be the logical choice to afford ACM the

Quoted 8 lines

greatest

Quoted 1 line

flexibility for loading policies under XSM. In principal, under

XSM, a

Quoted 1 line

security module could be capable of loading and parsing policies

over a

Quoted 1 line

range of policy versions.

Did you adapt the tools to generate a binary policy in that form?

Yes, I did, so actually there would be more changes required should we go forward. I apologize for the confusion.

Quoted 11 lines
Quoted 3 lines

Your patch reverts the ACM module to the original form where the

first

Quoted 1 line

word of the policy file is the policy version - which could change

over

Quoted 1 line

time. This is the general problem of magic numbers.

Yes, I changed it back because it was broken, at least it did not accept the policy I tried to load.

If you recompile your policy everything *should* work fine. If not, let me know and I'll make it right.

#4 lore raw

"George S. Coker, II" <[email protected]> wrote on 09/04/2007 02:44:51 PM:

Quoted 32 lines · Stefan Berger
Quoted 14 lines

"George S. Coker, II" <[email protected]> wrote on 09/04/2007 02:29:10 PM:

Quoted 8 lines · Stefan Berger
Quoted 3 lines

This fixes a regression due to changes in the policy buffer layout submitted by the XSM module.

Hi Stefan,

This was done to make the ACM magic number the first word in the

policy

Quoted 1 line

file. This seemed to be the logical choice to afford ACM the

Quoted 8 lines

greatest

Quoted 1 line

flexibility for loading policies under XSM. In principal, under

XSM, a

Quoted 1 line

security module could be capable of loading and parsing policies

over a

Quoted 1 line

range of policy versions.

Did you adapt the tools to generate a binary policy in that form?

Yes, I did, so actually there would be more changes required should we go forward. I apologize for the confusion.

Quoted 5 lines
Quoted 3 lines

Your patch reverts the ACM module to the original form where the

first

Quoted 1 line

word of the policy file is the policy version - which could change

Quoted 9 lines
Quoted 6 lines

over

Quoted 1 line

time. This is the general problem of magic numbers.

Yes, I changed it back because it was broken, at least it did not accept the policy I tried to load.

If you recompile your policy everything *should* work fine. If not, let me know and I'll make it right.

The problem is just that nothing triggers previously compiled policies to be recompiled and now those policies don't work anymore.

Stefan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#6 lore raw

[email protected] wrote on 09/05/2007 01:17:36 PM:

Quoted 1 line

Is this one still to go in, or did you decide against it?

Please don't apply it for now.

Stefan

Quoted 17 lines

-- Keir

Quoted 9 lines · Stefan Berger

This fixes a regression due to changes in the policy buffer layout submitted by the XSM module.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel