xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Daniel De Graaf <dgdegra@tycho.nsa.gov>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel@lists.xenproject.org, cardoe@cardoe.com
Subject: Re: [PATCH] [RFC] xsm: add a default policy to .init.data
Date: Mon, 23 May 2016 11:32:01 -0400	[thread overview]
Message-ID: <57432271.20508@tycho.nsa.gov> (raw)
In-Reply-To: <574320F2.9040809@citrix.com>

On 05/23/2016 11:25 AM, Andrew Cooper wrote:
> On 23/05/16 15:51, Daniel De Graaf wrote:
>> diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c
>> index 634ec98..af1d86f 100644
>> --- a/xen/xsm/xsm_core.c
>> +++ b/xen/xsm/xsm_core.c
>> @@ -47,6 +47,17 @@ static void __init do_xsm_initcalls(void)
>>       }
>>   }
>>
>> +extern char __xsm_init_policy_start[], __xsm_init_policy_end[];
>> +
>> +static void __init xsm_policy_init(void)
>> +{
>> +    if ( policy_size == 0 )
>> +    {
>> +        policy_buffer = __xsm_init_policy_start;
>> +        policy_size = __xsm_init_policy_end - __xsm_init_policy_start;
>> +    }
>
> Logic like this is slightly problematic if there is no policy.
>
> With these changes, we presumably always expect to have an embedded policy.

People who already have the policy specified in the bootloader may want
to omit the built-in policy.  I'm not sure that this should be excluded
completely, although this patch doesn't support it (it would require the
Kconfig option I mentioned).

> It would be cleaner to have a linker ASSERT(__xsm_init_policy_start !=
> __xsm_init_policy_end) to guarentee that something is present, at which
> point policy_buffer can unilaterally point at __xsm_init_policy_start,
> and size can be initialised to __xsm_init_policy_end -
> __xsm_init_policy_start.

No, because this would break the ability to specify a policy module in
GRUB.  If there is no built-in policy present, this code will work
correctly: policy_size will remain set to zero, and that is the
condition checked (in flask_init) when the policy itself is used.

-- 
Daniel De Graaf
National Security Agency

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-05-23 15:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 14:51 [PATCH] [RFC] xsm: add a default policy to .init.data Daniel De Graaf
2016-05-23 15:08 ` Wei Liu
2016-05-23 15:25 ` Andrew Cooper
2016-05-23 15:32   ` Daniel De Graaf [this message]
2016-05-23 15:34 ` Jan Beulich
2016-05-23 16:00   ` Daniel De Graaf
2016-06-07 20:19 ` Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57432271.20508@tycho.nsa.gov \
    --to=dgdegra@tycho.nsa.gov \
    --cc=andrew.cooper3@citrix.com \
    --cc=cardoe@cardoe.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).